Intelligent Solutions for Enterprise IT

Home | Articles |

| Links | Contact

Navigation :-



 * Trixbox


  ** What is?

  ** Server

  ** Tools

  ** Comparison

 * TermServ



Server-side Installation of DHCP

by Herman Verkade

The DHCP implementation that comes with most Linux distribution is from the Internet Software Consortium (ISC). This is a general, open source implementation that runs on many platforms, including Linux. The project page for this project is at The most current stable release from ISC is 3.0p2. Version 3.0.1 is in the pipeline, and at the time of writing (Oct 2003) 3.0.1rc12 is available.

Step 1: Choose a version to use.

Whilst looking on the net for binary packages that I could use on my Red Hat 8 server, I found the following versions:

Source Version Package Date
Red Hat 8 3.0pl1-9 28 Aug 2002
Red Hat 9 3.0pl1-23 3 Feb 2003
Latest update for RH 8/9 3.0pl1-26 26 Mar 2003
Latest update 3.0pl2-6.16 8 Oct 2003

Being a sucker for the latest versions (but not quite for beta software), I decided to go with version 3.0pl2-6.16. Full details, including the change log and the package itself, can be found on

Step 2: Install/Upgrade the DHCP package.

The server had a full install of Red Hat 8, including DHCP, so I needed to upgrade this package. To do so, type the following command:

# rpm -U dhcp-3.0pl2-6.16.i386.rpm


  1. "-U" upgrades the existing package. If you had not installed the DHCP package, replace "-U" with "-i".

  2. If you had installed development packages on your machine, then you will also need to download the equivalent dhcp-devel package. The two packages contain circular dependencies, so you would need to upgrade them together:

    # rpm -U dhcp-3.0pl2-6.16.i386.rpm dhcp-devel-3.0pl2-6.16.i386.rpm

Step 3: Ensure multicasting is enabled.

When a client requests configuration information over DHCP, it has not yet got any IP information and needs to rely on multicasts. The computer running DHCP will therefore need to have multicast enabled on its network interface(s). Use ifconfig to see whether it is enabled:

# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:60:97:B8:92:8E
          inet addr:  Bcast:  Mask:
          RX packets:86329 errors:0 dropped:0 overruns:0 frame:0
          TX packets:46097 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:92753859 (88.4 Mb)  TX bytes:8467928 (8.0 Mb)
          Interrupt:11 Base address:0xb800

Check that the word MULTICAST is included in the third line. If it isn't there, then you must first reconfigure your kernel with multicast support.

Step 4: Create a basic configuration file.

The DHCP daemon is called dhcpd, and is configured through /etc/dhcpd.conf (You can use a different configuration file by specifying -cf on the dhcpd command line). The daemon will not start without this file. Use your favourite editor to create the following file (replacing addresses and subnet masks as appropriate for your network):

# Sample /etc/dhcpd.conf
# <Further comments go here>

default-lease-time 600;
max-lease-time 7200;
option domain-name-servers,;
option domain-name “”;
ddns-update-style none;

subnet netmask {
        option subnet-mask;
        option broadcast-address;
        option routers;

When the DHCP daemon responds to a client, it provides the configuration information as 'options'. In the configuration file, the word "option" defines a piece of information to be sent to clients. Other lines contain configuration information for the daemon itself.

The first section contains settings that apply to the whole server. The second section defines a DHCP scope for a subnet, with further settings that apply only to that scope. The settings in this example file can be placed in either section, depending on whether you want each of them to apply to all scopes, or just to a specific scope. In most cases the DNS information applies throughout a company, whilst broadcast and router addresses apply to a specific subnet. The subnet mask is usually the same throughout a company, but is really an attribute of a subnet, which is why I prefer to this option for each subnet individually.

Step 5: Create an empy leases file.

The DHCP daemon needs to keep track of leases across restarts, so the daemon writes them to the 'leases file' in /var/lib/dhcp/dhcp.leases (You can use a different leases file by specifying -lf on the dhcpd command line). When the DHCP daemon starts, it reads the current lease file, renames it to dhcp.leases~, and writes the active leases from the original file to a fresh lease file. Because it want to read it on starting, the DHCP daemon will not start without this file. You will need to create an empyt leases file first:

# touch /var/lib/dhcp/dhcp.leases

Step 6: Test the configuration.

Now you should be ready to do a test run of the DHCP daemon. Note that is you are migrating from, for example, Microsoft DHCP to the Linux implementation, then you will need to stop that other one first. Run the daemon as follows:

# /usr/sbin/dhcpd -d -f

The -d option prints logging information to the screen. The -f option tells the daemon to remain in the foreground.

Now, boot a client and the DHCP daemon should provide it with a network configuration, conforming to the settings in your dhcpd.conf file.

Step 7: Start the daemon proper, and enable it to start automatically at startup.

This bit may differ from distribution to distribution. On Red Hat, you can start the daemon as follows:

# service dhcpd start

You can add it to run at runlevels 3 and 5 as follows:

# chkconfig –-level 35 dhcpd on

Remember that you will not want it to start under runlevel 2, as that is the runlevel without networking.

Step 8: Refine your configuration.

You now have a working DHCP server with a basic configuration. You can further refine your dhcpd.conf by adding additional options to be sent to clients, and/or by adding further settings for the server itself. You are very likely to want to increase the lease time, which in the configuration file above was set to only 10 minutes. Unless you have a very volatile network, you are more likely to want a lease time of a number of days rather than minutes. A full list of settings can be found in the man page:

# man dhcpd.conf

Please pay attention to the 'authoritative' statement. By default, a DHCP daemon is not 'authoritative', meaning that it will never send a DHCPNAK message, but simply leave the client wating for another server to respond. Once you are happy with your configuration and ready for production use, you can add the 'authoritative' to dhcp.conf.


© 2003-07, IQWare Limited Powered by: