System Administration Guide: IP Services

Solaris DHCP Client

The term “client” is sometimes used to refer to a physical machine that is performing a client role on the network. However, the DHCP client described here is a software entity. The Solaris DHCP client is a daemon (dhcpagent) that runs in the Solaris operating environment on a system that is configured to receive its network configuration from a DHCP server. DHCP clients from other vendors can also use the services of the Solaris DHCP server. However, this section describes only the Solaris DHCP client.

Notice that the description assumes one network interface. The section DHCP Client Systems With Multiple Network Interfaces discusses issues important for hosts that have two or more network interfaces.

DHCP Client Installation

The Solaris DHCP client is installed and enabled on a system during installation of the Solaris operating environment when you specify that you want to use DHCP to configure network interfaces. You do not need to do anything else on the Solaris client to use DHCP.

If you want a system that is already running the Solaris operating environment to use DHCP to obtain network configuration information, see Configuring and Unconfiguring a Solaris DHCP Client.

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.hme0 on a Sun Enterprise UltraTM 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 the dhcpagent daemon.

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 dhcp option.

How Solaris DHCP Client Manages Network Configuration Information

After the information packet is obtained from a DHCP server, dhcpagent configures the network interface and brings it up, controlling the interface for the duration of the lease time for the IP address. The dhcpagent daemon maintains the configuration data in an internal table held in memory. The system startup scripts use the dhcpinfo command to extract configuration option values from the dhcpagent daemon's table. The values are used to configure the system and enable it to join the network.

The agent waits passively until a period of time elapses, usually half the lease time, and then requests an extension of the lease from a DHCP server. If the dhcpagent daemon finds that the interface is down or the IP address has changed, it does not control the interface until it is instructed by the ifconfig command to do so. If the dhcpagent daemon finds that the interface is up and the IP address hasn't changed, it sends a request to the server for a lease renewal. If the lease cannot be renewed, the dhcpagent daemon takes down the interface at the end of the lease time.

DHCP Client Management

The Solaris DHCP client does not require management under normal system operation. It automatically starts when the system boots, renegotiates leases, and stops when the system shuts down. You cannot manually start and stop the dhcpagent daemon. However, you can use the ifconfig command as superuser on the client system to affect the client's management of the network interface if necessary.

ifconfig Command Options Used With DHCP Client

The ifconfig command enables you to:

DHCP Client Parameter File

The file /etc/default/dhcpagent on the client system contains tunable parameters for the dhcpagent daemon. You can use a text editor to change several parameters that affect client operation. The file is well documented so you should refer to the file for more information, as well as referring to the dhcpagent man page.

DHCP Client Shutdown

When the system running the DHCP client shuts down normally, the dhcpagent daemon 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, the DHCP client sends an abbreviated request to use the same IP address and network configuration information it had used before the system rebooted. If the DHCP server permits this, the client 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, the client initiates the DHCP protocol sequence described previously and obtains new network configuration information.

DHCP Client Systems and Name Services

Solaris systems support the following name services: DNS, NIS, NIS+, and a local file store (/etc/hosts). Each name service requires some configuration before it is usable. The name service switch configuration file (see nsswitch.conf(4)) must also be set up appropriately to indicate the name services to be used.

Before a DHCP client system can use a name service, you must configure the system as a client of the name service.

The following table summarizes issues related to each name service and DHCP, and includes links to documentation that can help you set up clients for each name service.

Table 7–4 Name Service Client Setup Information for DHCP Client Systems

Name Service  

Client Setup Notes 

NIS 

If you are installing the Solaris operating environment on a client system by using Solaris DHCP, you can use a configuration macro that contains the NISservs and NISdmain options to pass the IP addresses of NIS servers and the NIS domain name to the client. The client then automatically becomes a NIS client.

If a DHCP client system is already running the Solaris operating environment, the NIS client is not automatically configured on that system when the DHCP server sends NIS information to the client. 

If the DHCP server is configured to send NIS information to the DHCP client system, you can see the values given to the client if you use the dhcpinfo command on the client as follows:

# /sbin/dhcpinfo NISdmain

# /sbin/dhcpinfo NISservs

Use the values returned for the NIS domain name and NIS servers when you set up the system as a NIS client.  

You set up a NIS client for a Solaris DHCP client system in the standard way, as documented in “Setting Up and Configuring NIS Service” in System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP).


Note –

You can write a script that uses dhcpinfo and ypinit to automate NIS client configuration on DHCP client systems.


NIS+ 

If the DHCP client system receives a nonreserved IP address (the address may not always be the same), you must set up the NIS+ client for a DHCP client system in a nonstandard way, which is documented in Setting Up DHCP Clients as NIS+ Clients. This procedure is necessary because NIS+ uses security measures to authenticate requests for service. The security measures depend upon the IP address.

If the DHCP client system has been manually assigned an IP address (the client's address is always the same), you can set up the NIS+ client in the standard way, which is documented in “Setting Up NIS+ Client Machines” in System Administration Guide: Naming and Directory Services (FNS and NIS+)

/etc/inet/hosts

You must set up the /etc/inet/hosts file for a DHCP client system that is to use /etc/inet/hosts for its name service.

The DHCP client system's host name is added to its own /etc/inet/hosts file by the DHCP tools. However, you must add the host name manually to the /etc/inet/hosts files of other systems in the network. If the DHCP server system uses /etc/inet/hosts for name resolution, you must also add the client's host name manually on the system.

DNS  

If the DHCP client system receives the DNS domain name through DHCP, the client system's /etc/resolv.conf file is configured automatically. To actually use DNS on systems that use /etc/inet/hosts files, you must modify the /etc/nsswitch.conf file to add dns to the hosts line. See “Adding and Deleting Clients” in System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP) for more information about DNS clients.

If the client system uses NIS or NIS+ for local name resolution, you should be aware of the following:  

  • NIS – If the NIS server allows DNS forwarding (which it does by default), the NIS client system can also use DNS. No further DNS client setup is needed in this case. If the NIS server does not allow DNS forwarding, the client system can use DNS by becoming a DNS client as described in “Adding and Deleting Clients” in System Administration Guide: Naming and Directory Services (DNS, NIS, and LDAP). Note that if the client receives the DNS domain name from the DHCP server, the /etc/resolv.conf file needed for a DNS client is configured automatically, so you need only be concerned with the nsswitch.conf file.

  • NIS+ – The NIS+ client system can be configured to also use DNS if you edit the nsswitch.conffile to add dns to the hosts line.

Client Host Name Registration

If you let the DHCP server generate host names for the IP addresses you place in the DHCP service, the DHCP server can register those host names in NIS+, /etc/inet/hosts, or DNS name services. Host name registration cannot be done in NIS because NIS does not provide a protocol to allow programs to update and propagate NIS maps.


Note –

The DHCP server can update DNS with generated host names only if the DNS server and DHCP server are running on the same system.


If a DHCP client provides its host name and the DNS server is configured to allow dynamic updates from the DHCP server, the DHCP server can update DNS on the client's behalf, even if the DNS and DHCP servers are running on different systems. See Enabling Dynamic DNS Updates by DHCP Server for more information about enabling this feature.

The following table summarizes client host name registration for DHCP client systems with the various name services.

Table 7–5 Client Host Name Registration in Name Services

 

Who Registers Host Name 

Name Service 

DHCP Generated Host Name 

DHCP Client Supplied Host Name 

NIS 

NIS Administrator 

NIS Administrator 

NIS+ 

DHCP tools 

DHCP tools 

/etc/hosts

DHCP tools 

DHCP tools 

DNS 

DHCP tools, if the DNS server runs on the same system as the DHCP server. 

DNS Administrator, if the DNS sever runs on a different system. 

DHCP server, if configured for dynamic DNS updates.  

DNS Administrator, if DHCP server is not so configured. 

Note that Solaris DHCP clients can request particular host names in DHCP requests if configured to do so as described in How to Enable a Solaris Client to Request Specific Host Name. Please consult the documentation for non-Solaris clients to determine if the capability is supported.

DHCP Client Systems With Multiple Network Interfaces

The DHCP client daemon can manage several different interfaces on one system simultaneously, each with its own IP address and lease time. If more than one network interface is configured for DHCP, the client issues separate requests to configure them and maintains a separate set of network configuration options for each interface. However, although the parameters are stored separately, some of the parameters are global in nature, applying to the system as a whole, rather than to a particular network interface.

Options such as hostname, NIS domain name, and timezone are global parameters and should have the same values for each interface, but these values may differ due to errors in the information entered by the DHCP administrator. To ensure that there is only one answer to a query for a global parameter, only the parameters for the primary network interface are requested. You can insert the word primary in the /etc/dhcp.interface file for the interface you want to be treated as the primary interface.