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 the dhcpconfig(1M) man page for information about the files dhcpconfig uses to obtain information.
IP Address Allocation
Manual allocation - The server provides a specific IP address chosen by the administrator for a specific DHCP client. The address cannot be reclaimed or assigned to any other client.
Automatic, or permanent, allocation - The server provides an IP address that has no expiration time, making it permanently associated with the client until the administrator changes the assignment or the client releases the address.
Dynamic allocation - The server provides an IP address to a requesting client, with a lease for a specific period of time. When the lease expires, the address is taken back by the server and can be assigned to another client. The period of time is determined by the lease time configured for the server.
Network Configuration Information
The administrator determines what information to provide 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 by way of an option called NISservs 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 create macros to group options and assign values to the options. If you prefer a nongraphical tool, you can use dhtadm, the DHCP configuration table management utility, to work with options and macros.
In Solaris DHCP, an option is a piece of network information to be passed to a client. The DHCP literature also refers to options as symbols or tags. An option is defined by a numeric code and a text label. An option receives a value when it is used in the DHCP service.
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 shown in the dhcp_inittab man page. You cannot modify the standard option keywords in any way, but you can assign values to the options that are relevant to your network when you include the options 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:
Extended - Reserved for options that have become standard DHCP options, but are not yet included in the DHCP server implementation. You might use this if you know of a standard option that you want to use, but do not want to upgrade your DHCP server.
Site - Reserved for options that are unique to your site. The system administrator creates these options.
Vendor - Reserved for options that should apply only to clients of a particular class, such as hardware or vendor platform. The Solaris DHCP implementation includes a number of vendor options for Solaris clients. For example, the option SrootIP4 is used to specify the IP address of a server that a client that boots from the network should use for its root file system.
Chapter 10, Administering DHCP (Task) includes procedures for creating, modifying, and deleting options.
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 the DHCP server processes a macro, it places the network options and values defined in the macro in a DHCP message to a client. The server processes some macros automatically for clients of a particular type.
In order for the server to process a macro automatically, the name of the macro must comply with one of the categories shown in the following table.
Table 7-3 Macro Categories for Automatic Processing
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 whose hardware implementation is SUNW,Ultra-1 automatically receives the values in the SUNW.Ultra-1 macro.
The macro name matches a DHCP-managed network IP address. For example, if a server has a macro named 10.53.224.0, any client connected to the 10.53.224.0 network automatically receives the values in the 10.53.224.0 macro.
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 with the client ID 08002011DF32 (derived from the Ethernet address 8:0:20:11:DF:32) automatically receives the values in the macro named 08002011DF32.
A macro with a name that does not use one of the categories listed in Table 7-3 can be processed only if one of the following is true:
Macro is mapped to an IP address.
Macro is included in another macro that is processed automatically.
Macro is included in another macro that is mapped to an IP address.
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:
Client class macros - the most general category
Network address macros - more specific than Client class
Macros mapped to IP addresses - more specific than Network address
Client ID macros - the most specific category, pertaining to one client
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 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 Ultra 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.