System Administration Guide, Volume 3

Chapter 8 Overview of DHCP

This chapter introduces the Dynamic Host Configuration Protocol (DHCP), explains the concepts underlying the protocol, and describes the advantages of using it in your network.

This chapter contains the following information:

About DHCP

DHCP is a standard developed to enable host systems in a TCP/IP network to be configured automatically for the network as they boot. DHCP uses a client/server mechanism: servers store and manage configuration information for clients, and provide that information upon a client's request. The information includes the client's IP address and information about network services available to the client.

DHCP evolved from an earlier protocol, BOOTP, which was designed for booting over a TCP/IP network. DHCP builds upon BOOTP by using the same format for messages between client and sever, while including more information in the messages. The extra information is the network configuration data for the client.

A primary benefit of DHCP is its ability to manage IP address assignments through leasing, which allows IP addresses to be reclaimed when not in use and reassigned to other clients. This enables a site to use a smaller pool of IP address than would be needed if all clients were assigned a permanent address.

Advantages of Using Solaris DHCP

DHCP relieves the system or network administrator of some of the time-consuming tasks involved in setting up a TCP/IP network and the daily management of that network. Note that Solaris DHCP works only with IPv4.

Solaris DHCP offers the following advantages:

How DHCP Works

The DHCP server must first be installed and configured by a system administrator. During configuration, the administrator enters information about the network that clients will need for operating on the network. After this information is in place, clients are able to request and receive network information.

The sequence of events for DHCP service is shown in the following diagram. The numbers in circles correlate to the numbered items in the description following the diagram.

Figure 8-1 Sequence of Events for DHCP Service



  1. The client discovers a DHCP server by broadcasting a discover message to the limited broadcast address ( on the local subnet. If a router is present and configured to behave as a BOOTP relay agent, the request is passed to other DHCP servers on different subnets. The client's broadcast includes its unique ID, which in the Solaris DHCP implementation, is derived from the client's MAC address.

    DHCP servers receiving the discover message can determine the client's network by looking at the following information:

    • Which of the server's network interfaces did the request come in on? This tells the server that the client is either on the network to which the interface is connected, or that the client is using a BOOTP relay agent connected to that network.

    • Does the request include the IP address of a BOOTP relay agent? When a request passes through a relay agent, the relay agent inserts its address in the request header. When the server detects a relay agent address, it knows that the network portion of the address indicates the client's network address because the relay agent must be connected to the client's network.

    • Is the client's network subnetted? The server consults the netmasks table, keying on the relay agent address or the address of the network interface that received the request. Once the server knows the subnet mask used, it can determine which portion of the network address is the host portion, and then select an IP address appropriate for the client. (See netmasks(4) for information on netmasks.)

  2. After determining the client's network, DHCP servers select an appropriate IP address and verify that the address is not already in use. The DHCP servers then respond to the client by broadcasting an offer message that includes the selected IP address and information about services that can be configured for the client. Each server temporarily reserves the offered IP address until it can determine if the client will use it.

  3. The client selects the best offer (based on the number and type of services offered) and broadcasts a request, specifying the IP address of the server that made the best offer. The broadcast ensures that all the responding DHCP servers know the client has chosen a server, and those servers not chosen can cancel the reservations for the IP addresses they had offered.

  4. The selected server allocates the IP address for the client, storing the information in the DHCP data storage area, and sends an acknowledgement to the client. The acknowledgement message contains the network configuration parameters for the client. The client tests the IP address to make sure no other system is using it, and continues booting to join the network.

  5. The client monitors the lease time, and when a set period of time has elapsed, the client sends a new message to the chosen server to increase its lease time.

  6. The DHCP server receiving the request extends the lease time if it still adheres to the local lease policy set by the administrator. If the server does not respond within 20 seconds, the client broadcasts a request so that one of the other DHCP servers can extend the lease.

  7. When the client no longer needs the IP address, it sends a message notifying the server that it is releasing the IP address. This can happen during an orderly shutdown and can also be done manually.

Solaris DHCP Server

The Solaris DHCP server runs as a daemon in the Solaris operating environment on a host system. The server has two basic functions:

The Solaris DHCP server can also be configured to perform the following additional functions:

DHCP Server Management

As superuser, you can start, stop, and configure the DHCP server using the DHCP Manager, or by using command line utilities. Generally, the DHCP server is configured to start automatically when the system boots, and stop when the system is shutdown, so starting and stopping the server manually should be an infrequent occurence.

DHCP Server Data Storage

All the data used by the DHCP server is maintained in two data repositories, which you can view and manage using either the DHCP Manager or command-line utilities. The data repositories are:

The DHCP data can be stored in files on a local directory, or in a NIS+ database. "Choosing the Data Store" discusses selecting a data storage method.

The dhcptab File

The dhcptab file contains all the information that clients can obtain from the DHCP server. The DHCP server scans the file each time it starts.

The DHCP protocol defines a number of standard items of information that can be passed to clients. These items are referred to as parameters, symbols, or options. Options are defined in the DHCP protocol by numeric codes and text labels, but without values. For example, some commonly used standard options are shown in the following table.

Table 8-1 Sample DHCP Standard Options





Subnet mask IP address 


IP address for router 


IP address for DNS server 



Text string for client hostname 



DNS domain name 

Some options are automatically assigned values when the administrator provides information during server configuration. The administrator can also explicitly assign values to other options at a later time. Options and their values are passed to the client to provide configuration information. For example, the option/value pair, DNSdmain=Georgia.Peach.COM, sets the client's DNS domain name to Georgia.Peach.COM.

Options can be grouped with other options in containers known as macros, which makes it easier to pass information to a client. Some macros are created automatically during server configuration, and contain options that were assigned values during configuration. Macros can also contain other macros.

The format of the dhcptab file is described in dhcptab(4). In DHCP Manager, all the information shown in the Options and Macros tabs comes from the dhcptab file. See "About Options" for more information about options, and "About Macros" for more information about macros.

Note that the dhcptab file is a text file, but should not be edited manually. You should use either dhtadm or DHCP Manager to create, delete, or modify options and macros.

DHCP Network Tables

A DHCP network table maps client identifiers to IP addresses and the configuration parameters associated with each address. The format of the network tables is described in dhcp_network(4). In DHCP Manager, all the information shown in the Addresses tab is acquired from the network tables.

DHCP Manager

DHCP Manager is a graphical tool you can use to perform all management duties associated with DHCP services. You can use it to manage the server itself as well as the data the server uses. You can use DHCP Manager with the server in the following ways:

DHCP Manager also allows you to manage the IP addresses, network configuration macros, and network configuration options in the following ways:

DHCP Manager includes extensive online help for procedures you can perform with the tool.

DHCP Command-Line Utilities

All DHCP management functions can be performed using command-line utilities. The following table lists the utilities and describes the purpose of each utility. See the man pages for the utilities for detailed information about using them by clicking on the command names in the table.

Table 8-2 DHCP Command-Line Utilities

DHCP Command Manual Page 

Description and Purpose 


The DHCP service daemon. It provides command-line arguments that allow you to set several runtime options.


Shell script that presents a text-based menu system to help you configure a DHCP server. dhcpconfig collects information from the server machine's network topology files to create useful information for the initial configuration. dhcpconfig uses the dhtadm and pntadm utilities in the background to create the initial dhcptab and network tables.


Used for adding, deleting, and modifying configuration options and macros for DHCP clients. This utility lets you edit the dhcptab file indirectly, ensuring the format of the dhcptab file is correct. You should not directly edit the dhcptab file.


Used to manage the DHCP network tables. You can use this utility to add and remove IP addresses and networks under DHCP management, modify the network configuration of specified IP addresses, and display information about IP addresses and networks under DHCP management. 

DHCP Server Configuration

You configure the DHCP server the first time you run DHCP Manager on the system where you want to run the DHCP server. DHCP Manager server configuration dialogs prompt you for essential information needed to enable and run the DHCP server on one network. Some default values are obtained from existing system files. If you have not configured the system for the network, there will be no default values. DHCP Manager prompts for the following information:

You can also configure the DHCP server using the dhcpconfig command. This utility gathers information from existing system files automatically in order to provide a useful initial configuration. Therefore, you must ensure that the files are correct before running dhcpconfig. See dhcpconfig(1M) for information about the files dhcpconfig uses to obtain information. To make configuration changes after the initial configuration, you must make changes to the system files and rerun dhcpconfig so that it picks up the changes.

IP Address Allocation

The Solaris DHCP server supports the following types of IP address allocation:

Network Configuration Information

The administrator determines what information is provided to DHCP clients. When you configure the DHCP server you provide essential information about the network; later, you can add more information you want to provide to clients.

The DHCP server stores network configuration information in the dhcptab database, in the form of option/value pairs and macros. Options are keywords for network data you want to supply to clients. Values are assigned to options and passed to clients in DHCP messages. For example, the NIS server address is passed using an option called NISservrs that has a value (a list of IP addresses) assigned by the DHCP server. Macros provide a convenient way to group together any number of options that you want to supply to clients. You can use the DHCP Manager to assign values to the options, and create macros to group the options. If you prefer a non-graphical tool, you can use dhtadm, the DHCP configuration table management utility, to work with options and macros.

About Options

In Solaris DHCP, an option is a piece of network information to be passed to a client. In the DHCP literature, options are also referred to as symbols or tags. An option is defined by a numeric code and a text label, and is then assigned a value.

The DHCP protocol defines a large number of standard options for commonly specified network data: Subnet, Router, Broadcast, NIS+dom, Hostname, and LeaseTim are a few examples. A complete list of standard options is included in the DHCP Manager help. You cannot modify the standard option keywords in any way, but you can assign values to the options that are relevant to your network, and include the option/value pairs in macros.

You can create new options for data that is not represented by the standard options. Options you create must be classified in one of three categories:

Chapter 11, Administering DHCP includes procedures for creating, modifying, and deleting options.

About Macros

In the Solaris DHCP service, a macro is a collection of network configuration options and the values assigned to them by the system administrator. Macros are created to group options together to be passed to specific clients or types of clients. For example, a macro intended for all clients of a particular subnet might contain option/value pairs for subnet mask, router IP address, broadcast address, NIS+ domain, and lease time.

Macro Processing by the DHCP Server

When a macro is processed by the server, the network options and values defined in the macro are placed in a DHCP message to a client. Some macros are processed automatically by the server for clients of a particular type.

In order for a macro to be processed automatically, it must be named according to one of the categories shown in the following table.

Table 8-3 Macro Categories for Automatic Processing

Macro Category 


Client class 

The macro name matches a class of client, indicated by the client machine type and/or operating system. For example, if a server has a macro named SUNW.Ultra-1, any client that is a SUNW,Ultra-1 machine automatically receives the values in the SUNW.Ultra-1 macro.

Network address 

The macro name matches a DHCP-managed network IP address. For example, if a server has a macro named, any client connected to the network automatically receives the values in the macro.

Client ID 

The macro name matches some unique identifier for the client, usually derived from an Ethernet or MAC address. For example, if a server has a macro named 08002011DF32, the client having the client ID 08002011DF32 (derived from the Ethernet address 8:0:20:11:DF:32) automatically receives the values in a macro named 08002011DF32.

A macro with a name that does not use one of the categories listed in Table 8-3 can be processed only if one of the following is true:

Note -

When you configure a server, a macro that is named to match the server's name is created by default. This server macro is not processed automatically for any client because it is not named with one of the name types that cause automatic processing. When you later create IP addresses on the server, the IP addresses are mapped to use the server macro by default.

Order of Macro Processing

When a DHCP client requests DHCP services, the DHCP server determines which macros match the client. The server processes the macros, using the macro categories to determine the order of processing, from the more general to the specific. The macros are processed in the following order:

  1. Client class macros - the most general category

  2. Network address macros - more specific than Client class

  3. Macros mapped to IP addresses - more specific than Network address

  4. Client ID macros - the most specific category

A macro that is included in another macro is processed as part of the containing macro.

If the same option is included in more than one macro, the value set for that option in the macro with the most specific category is used because it is processed last. For example, if a Network address macro contained the lease time option with a value of 24 hours, and a Client ID macro contained the lease time option with a value of 8 hours, the client would receive a lease time of 8 hours.

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 machine 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 Clients With Multiple Network Interfaces" discusses issues important for hosts having 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. There is nothing further you need to do on the Solaris client to use DHCP.

If you want a machine that is already running the Solaris environment to use DHCP to configure network interfaces, 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, dhcpagent is started early in the boot process by the system startup scripts; booting is suspended until the network configuration information is obtained.

The presence of the file /etc/dhcp.interface (for example, /etc/dhcp.hme0 on a Sun Enterprise UltraTM machine) 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.

After starting up, dhcpagent waits until it receives instructions to configure a network interface. The startup scripts issue the ifconfig interface dhcp startcommand, 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 theifconfig(1M) man page for more information about options used with dhcp.

How 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. dhcpagent 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's table. The values are used in configuring the system and becoming part of the network.

The agent waits passively until a set period of time elapses, usually half the lease time, and then requests an extension of the lease from a DHCP server. If dhcpagent finds that the interface is down or the IP address has changed, it does not control the interface until it is instructed by ifconfig to do so. If dhcpagent 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, dhcpagent takes the interface down at the end of the lease time.

DHCP Client Management

The Solaris DHCP client does not need to be managed 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 machine to affect the client's management of the network interface if necessary.

ifconfig Commands Used With DHCP Client

The ifconfig command lets you:

DHCP Client Parameter File

The file /etc/default/dhcpagent on the client system contains tunable parameters for dhcpagent. You can use a text editor to change several parameters that affect client operation. The file is well-documented so please refer to the file for more information about the parameters.

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 is rebooted, the DHCP client sends an abbreviated request to use the same IP address and network configuration information it had used before the system was 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 using the information, the client initiates the DHCP protocol sequence described previously and obtains new network configuration information.

DHCP Clients 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 it might not be the case 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.