This section summarizes the command options, which are documented in the ifconfig(1M) man page. The only difference between the DHCPv4 and the DHCPv6 versions of these commands is the “inet6” keyword. Include the “inet6” keyword for DHCPv6, but leave it out when running DHCPv4.
The ifconfig command enables you to do the following:
Start the DHCP client – The command ifconfig interface [inet6] dhcp start initiates the interaction between dhcpagent and the DHCP server to obtain an IP address and a new set of configuration options. This command is useful when you change information that you want a client to use immediately, such as when you add IP addresses or change the subnet mask.
Request network configuration information only – The command ifconfig interface [inet6] dhcp inform causes dhcpagent to issue a request for network configuration parameters, with the exception of the IP address. This command is useful when the network interface has a static IP address, but the client system needs updated network options. For example, this command is useful if you do not use DHCP to manage IP addresses, but you do use it to configure hosts on the network.
Request a lease extension – The command ifconfig interface [inet6] dhcp extend causes dhcpagent to issue a request to renew the lease. The client does automatically request to renew leases. However, you might want to use this command if you change the lease time and want clients to use the new lease time immediately, rather than waiting for the next attempt at lease renewal.
Release the IP address – The command ifconfig interface [inet6] dhcp release causes dhcpagent to relinquish the IP address used by the network interface. Release of the IP address happens automatically when the lease expires. You might want to issue this command with a laptop, for example, when leaving a network and planning to start the system on a new network. See also the /etc/default/dhcpagent configuration file RELEASE_ON_SIGTERM property.
Drop the IP address – The command ifconfig interface [inet6] dhcp drop causes dhcpagent to take down the network interface without informing the DHCP server and cache the lease in the file system. This command enables the client to use the same IP address when it reboots.
Ping the network interface – The command ifconfig interface [inet6] dhcp ping lets you determine if the interface is under the control of DHCP.
View the DHCP configuration status of the network interface – The command ifconfig interface [inet6] dhcp status displays the current state of the DHCP client. The display indicates the following items:
If an IP address has been bound to the client
The number of requests sent, received, and declined
If this interface is the primary interface
Times when the lease was obtained, when it expires, and when renewal attempts are scheduled to begin
For example:
# ifconfig hme0 dhcp status Interface State Sent Recv Declined Flags hme0 BOUND 1 1 0 [PRIMARY] (Began,Expires,Renew)=(08/16/2005 15:27, 08/18/2005 13:31, 08/17/2005 15:24) |
# ifconfig hme0 inet6 dhcp status Interface State Sent Recv Declined Flags hme0 BOUND 1 0 0 [PRIMARY] (Began,Expires,Renew)=(11/22/2006 20:39, 11/22/2006 20:41, 11/22/2006 20:40) |