[manual index][section index]


dhcp - configure network interface details using DHCP


ip/dhcp [ -bdmpr ] [ -g gateway ] [ -h hostname ] [ -x net ] ifcdir [ localip [ localmask ]]


Dhcp uses the Dynamic Host Configuration Protocol (DHCP) to configure the ip(3) interface represented by ifcdir (eg, /net/ipifc/1). The interface must have a device already bound to it. Dhcp uses the MAC address of that device in its requests.

Dhcp broadcasts a DHCP request for an address and various network parameters. It takes the first acceptable offer, sets the interface to that address, and writes the address and parameter values, in ndb(6) format, to /net/ndb, where cs(8), dns(8) and others will find them. If the address is provided with a limited lease, dhcp itself returns, but it leaves a process in the background that periodically renews the lease (or requests a new address if the lease is not renewed).

If localip is given, dhcp attempts to reacquire that address. If successful, it configures the interface with that address (and mask if supplied), maintaining any lease as before. If it cannot reacquire the address, it broadcasts a request for a new address, as above.

The options are:

Use plain BOOTP without the DHCP options
Enable debugging output on standard output
-g gateway
Suggest gateway as the default gateway (the server might change it)
-h hostname
Use hostname as the current host's name in DHCP messages
Monitor the DHCP status and print a summary on standard output whenever it changes
Do not configure the interface
Print the resulting configuration on standard output
Retry DHCP periodically until it succeeds
-x net
Use mount point net to access the network, and write the results to net/ndb (default: /net)


Allocate a new interface, bind an ether device to it, and configure it with dhcp:

x=`{cat /net/ipifc/clone}
echo bind ether /net/ether0 >/net/ipifc/$x/ctl &&
ip/dhcp /net/ipifc/$x




ip(3), ndb(6), cs(8), dns(8)


Dhcp returns an error status if it receives no acceptable reply, unless the -r option is given to force retries.

DHCP(8 ) Rev:  Tue Mar 31 02:42:38 GMT 2015