Configuring and Administering DHCP Clients
This chapter discusses the Dynamic Host Configuration Protocol (DHCP) client DHCPv4, which enables DHCP servers to pass configuration parameters such as IPv4 network addresses to IPv4 nodes. The chapter explains how the client works, and how you can affect the behavior of the client.
This chapter contains the following information:
About the Solaris DHCP Client
The Solaris DHCP client is the dhcpagent daemon, which is part of the Solaris Operating System (Solaris OS). When you install the Solaris OS, you are prompted to use DHCP to configure network interfaces. If you specify Yes, the DHCP client software is enabled on your system during Solaris installation. You do not need to do anything else with the Solaris client to use DHCP. The DHCP server's configuration determines what information is given to DHCP client systems that use the DHCP service.
If a client system is already running the Solaris OS, but not using DHCP, you can reconfigure the client system to use DHCP. You can also reconfigure a DHCP client system so that it stops using DHCP and uses static network information that you provide. See Enabling and Disabling a Solaris DHCP Client for more information.
Logical Interfaces
In the DHCPv4 client, each logical interface is independent and is an administrative unit. In addition to the zeroth logical interface (which defaults to the interface MAC address as an identifier), the user may configure specific logical interfaces to run DHCP by specifying a CLIENT_ID in the dhcpagent configuration file. For example:
hme0:1.CLIENT_ID=orangutan
DHCP Client Startup
The dhcpagent daemon obtains configuration information that is needed by other processes involved in booting the system. For this reason, the system startup scripts start dhcpagent early in the boot process and wait until the network configuration information from the DHCP server arrives.
The presence of the file /etc/dhcp.interface (for example, /etc/dhcp.ce0 on a Sun Fire 880 system) indicates to the startup scripts that DHCP is to be used on the specified interface. Upon finding a dhcp.interface file, the startup scripts start dhcpagent.
After startup, dhcpagent waits until it receives instructions to configure a network interface. The startup scripts issue the ifconfig interface dhcp start command, which instructs dhcpagent to start DHCP as described in How DHCP Works. If commands are contained within the dhcp.interface file, they are appended to the dhcp start option of ifconfig. See the ifconfig(1M) man page for more information about options used with the ifconfig interface dhcp command.
How the DHCP Client Manages Network Configuration Information
After the information packet is obtained from a DHCP server, dhcpagent configures the network interface and brings up the interface. The daemon controls the interface for the duration of the lease time for the IP address, and maintains the configuration data in an internal table. The system startup scripts use the dhcpinfo command to extract configuration option values from the internal table. The values are used to configure the system and enable it to communicate on the network.
The dhcpagent daemon waits passively until a period of time elapses, usually half the lease time. The daemon then requests an extension of the lease from a DHCP server. If dhcpagent finds that the interface is down or that the IP address has changed, the daemon does not control the interface until instructed by the ifconfig command to do so. If dhcpagent finds that the interface is up and the IP address hasn't changed, the daemon sends a request to the server for a lease renewal. If the lease cannot be renewed, dhcpagent takes down the interface at the end of the lease time.
Each time dhcpagent performs an action related to the lease, the daemon looks for an executable file called /etc/dhcp/eventhook. If an executable file with this name is found, dhcpagent invokes the executable. See DHCP Client Event Scripts for more information about using the event executable.
DHCP Client Shutdown
When the DHCP client system shuts down normally, dhcpagent writes the current configuration information to the file /etc/dhcp/interface.dhc. The lease is dropped rather than released, so the DHCP server does not know that the IP address is not in active use.
If the lease is still valid when the system reboots, dhcpagent sends an abbreviated request to use the same IP address and network configuration information. If the DHCP server permits this request, dhcpagent can use the information that it wrote to disk when the system shut down. If the server does not permit the client to use the information, dhcpagent initiates the DHCP protocol sequence described in How DHCP Works. As a result, the client obtains new network configuration information.
Enabling and Disabling a Solaris DHCP Client
To enable the DHCP client on a system that is already running the Solaris OS and is not using DHCP, you must first unconfigure the system. When the system boots, you must issue some commands to set up the system and enable the DHCP client.
If your DHCP client is not a Solaris DHCP client, consult the client documentation for instructions.
Note - Routers, NIS or NIS+ servers, DNS servers, and other hosts that are critical to the network should not be DHCP clients. Hosts that provide services to the network should not rely on the network to obtain their IP addresses. Hosts that are print servers or file servers should have consistent IP addresses as well. However, print servers and file servers can become DHCP clients to receive their network configurations through DHCP. You can configure the DHCP server to provide consistent IP addresses to such DHCP clients, as described in Assigning a Reserved IP Address to a DHCP Client.
How to Enable the Solaris DHCP Client
This procedure is necessary only if DHCP was not enabled during Solaris installation.
Become superuser on the client system.
If this system uses preconfiguration instead of interactive configuration, edit the sysidcfg file. Add the dhcp subkey to the network_interface keyword in the sysidcfg file.
For example, network_interface=hme0 {dhcp}. See the sysidcfg(4) man page for more information.
Unconfigure and shut down the system.
# sys-unconfig
See the sys-unconfig(1M) man page for more information about the configuration information that is removed by this command.
Reboot the system after shutdown is complete.
If the system uses preconfiguration, the dhcp subkey in the sysidcfg file configures the system to use the DHCP client as the system boots.
If the system does not use preconfiguration, you are prompted for system configuration information by sysidtool programs when the system reboots. See the sysidtool(1M) man page for more information.
When prompted to use DHCP to configure network interfaces, specify Yes.
How to Disable a Solaris DHCP Client
Become superuser on the client system.
If you used a sysidcfg file to preconfigure the system, remove the dhcp subkey from the network_interface keyword.
Unconfigure and shut down the system.
# sys-unconfig
See the sys-unconfig(1M) man page for more information about the configuration information that is removed by this command.
Reboot the system after shutdown is complete.
If the system uses preconfiguration, you are not prompted for configuration information, and the DHCP client is not configured.
If the system does not use preconfiguration, you are prompted for system configuration information by sysidtool programs when the system reboots. See the sysidtool(1M) man page for more information.
When prompted to use DHCP to configure network interfaces, specify No.