Configuring a Solaris 7 System to be a DHCP Server

Run /usr/sbin/dhcpconfig to configure the system as a DHCP server. You will be presented with the menu below:

***             DHCP Configuration              ***

Would you like to:

        1) Configure DHCP Service

        2) Configure BOOTP Relay Agent

        3) Unconfigure DHCP or Relay Service

        4) Exit


Type "1" and hit enter. You will see the following prompt:

Would you like to stop the DHCP service? (recommended) ([Y]/N):

If you haven't been running the dhcpd service on the system, i.e. the system isn't a DHCP server already, it shouldn't matter which selection you make. But, if the service was already running, you would want to stop it to reconfigure it. Since answering "Y" works in either case, type "Y" and hit enter. You will then see the following:

###     DHCP Service Configuration      ###
###     Configure DHCP Database Type and  Location      ###

Enter datastore (files or nisplus) [nisplus]: 

Type "files" and hit enter, which will produce the following prompts. Take the default selections by hitting enter at each one:

Enter absolute path to datastore directory [/var/dhcp]: 

###     DHCP server daemon option setup ###

Would you like to specify nondefault daemon options (Y/[N]): 

###     Initialize dhcptab table        ###

Enter default DHCP lease policy (in days) [3]: 
Do you want to allow clients to renegotiate their leases? ([Y]/N):

###     Select Networks For BOOTP/DHCP Support  ###

Enable DHCP/BOOTP support of networks you select? ([Y]/N):

That will lead to prompts asking whether you wish to configure BOOTP/DHCP for the network interfaces on the server. If you have only one interface, you would answer "Y" for that interface. In this example, I have two interfaces and I only want the DHCP server to serve addresses on the interface, so I answer "N" when prompted to enable support for the interface and "Y" for the interface

###     Configure Local Networks        ###

Configure BOOTP/DHCP on local LAN network: ([Y]/N):N

Configure BOOTP/DHCP on local LAN network: ([Y]/N):Y

The next prompt inquires about putting hostnames in the files hosts table. You can take the default answer by hitting enter.

Do you want hostnames generated and inserted in the files hosts table? (Y/[N]):

When prompted to enter the starting IP address, put in the first address you want to have served. In the case of the subnet, I have the interface to that subnet on the system that will be the DHCP server set to and I want the server to start assigning addresses from, so I put that address in as the starting IP address. I only want to dole out two addresses, and, so I put in 2 at the next prompt regarding the number of clients. I have a netmask of in /etc/netmask for that interface, so that is the maximum number of valid addresses I could assign for that subnet with that netmask, which is why the prompt shows "X < 3". I then choose the default "N" answer when questioned about disabling ping verification of the addresses by hitting enter at that prompt.

Enter starting IP address []:
Enter the number of clients you want to add (x < 3): 2
Disable (ping) verification of address(es)? (Y/[N]):

I actually forgot to put in as the starting IP address to be assigned by DHCP. I have already assigned to the system that will be the DHCP server, so I can't assign that address to a client as well. The configuration script is smart enough to catch that error as shown below.

Warning: Address in in use... skipping...
- 00% Complete.
Configured 1 entries for network:

###     Configure Remote Networks       ###

Would you like to configure BOOTP/DHCP service on remote networks? ([Y]/N):

I answered "N" to the prompt regarding remote networks, since I don't want to configure the service on remote networks. The last prompt asks whether you wish to restart the DHCP service. Take the default answer of "Y" by hitting enter. You will then be returned to the original menu where you can type "4" to exit the menu.

The system is now functioning as a DHCP server. To test it you can disconnect the network cable from a client system and reconnect it. If it is configured to get its IP address by DHCP, it should be assigned an IP address by the system you just configured. As an alternative to disconnecting the network cable at the client, if it is a Windows client, you can type "ipconfig /renew" to force it to attempt to obtain an IP address from a DHCP server.

The DNS servers assigned to a client by the DHCP server will be those the system functioning as the DHCP server is configured to use, i.e. the nameservers listed in /etc/resolv.conf on the DHCP server. The domain name, e.g., assigned to a client will be the domain listed in the "domain" line in /etc/resolv.conf.

If you need to start or stop the DHCP server, you can use /etc/init.d/dhcp.

# /etc/init.d/dhcp
Usage: /etc/init.d/dhcp { start | stop }

The configuration file is /etc/default/dhcp. The contents of an example file are shown below.

# This file controls the defaults for datastore type and location.
# for the DHCP service. Two directives are currently supported,
# 'RESOURCE' and 'PATH'. 'RESOURCE' can be either 'files' or 'nisplus'.
# 'PATH' can be a unix pathname for 'files' resources, or a legal
# nisplus directory for 'nisplus' resources.

In this case there are two configuration files, 192_168_1_0 and dhcptab, in /var/dhcp, which is the directory specified in the PATH statement in /etc/default/dhcp. The names that you see for the network address macro, e.g. 192_168_1_0 in this case, will match the network address or addresses you picked for the subnets over which the DHCP server should offer its service. The dhcptab file contains the values the server will provide to DHCP clients. You will see values assigned to the following items that you may want to modify:

Value Description
DNSdmain The domain name the server will assign. If you don't want to use the value taken from /etc/resolv.conf, you can change the value here.
DNSserv The name server addresses, which were obtained from /etc/resolv.conf. You can change the addresses handed out to clients here.
Router This is the gateway address given out to clients. It will be the same gateway address used by the system on which the DHCP server software is running.

If you want to change the DNS server address or addresses that will be provided to clients by the DNS server, you can edit dhcptab. For instance, since I have the DHCP server also functioning as a DNS server on interface, I deleted the default addresses listed after "DNSserv=" up to the following colon and used "DNSServ=".

If you need more information on the dhcpconfig command, type man dhcpconfig.