This is accomplished by specifying *IP4DHCP rather than an IP address when adding a TCP/IP interface (ADDTCPIFC command). Only one of these special interfaces can be added for any given line description. The following command is an example of adding a DHCP client interface for the ethernet line description ETHLINE: ADDTCPIFC INTNETADR(*IP4DHCP) LIND(ETHLINE)
Once the interface has been added, use the start TCP/IP interface command to start the interface and to acquire an IP address: STRTCPIFC INTNETADR(*IP4DHCP) LIND(ETHLINE)
Since a system can have multiple DHCP-client interfaces, the line description must be specified in order to start or end the DHCP client interface.
The starting of the DHCP client interface will cause the client interface to go into an "acquiring" state until it has successfully been assigned an IP address by a DHCP server. Once the IP address has been assigned, the special *IP4DHCP interface will disappear from the list of interfaces shown by NETSTAT option 1. The IP address that was acquired by DHCP will then show up in the list of interfaces. The lease expiration time for a DHCP-created interface can be seen by displaying the details of the interface from NETSTAT option 1.
When a DHCP client interface is ended, the IP address is released. In order to end a DHCP client interface, you must specify the *IP4DHCP special value rather than the acquired IP address. Depending on the DHCP-server configuration, it’s possible the next time the DHCP-client interface is started it could receive a different IP address, particularly if the interface is left in an inactive state for an extended period of time.
When configuring a DHCP client interface an optional parameter DHCP dynamic DNS updates (keyword DHCPDYNDNS) can be specified. A value of *YES will request the DHCP server to update the DNS records for the DHCP client. A value of *NO omits this request from the messages sent to the DHCP server.
I'd like to thank Clair Wood and Brian Jongekryg for writing this blog article. Clair and Brian work on the TCP/IP Networking team in the development lab.