7.3. DHCP Server Setup for Linux

Retrieve DHCPD if your machine does not already have it installed. Get DHCPD


If there is not a binary distribution for your version of linux you will have to compile DHCPD.

Edit your /etc/rc.d/rc.local to reflect an addition of a route for

Quoted from DHCPd README:

In order for dhcpd to work correctly with picky DHCP clients (e.g., Windows 95), it must be able to send packets with an IP destination address of Unfortunately, Linux insists on changing into the local subnet broadcast address (here, that's This results in a DHCP protocol violation, and while many DHCP clients don't notice the problem, some (e.g., all Microsoft DHCP clients) do. Clients that have this problem will appear not to see DHCPOFFER messages from the server.

Type the following as root:

route add -host dev eth0

If the message appears: Unknown host

Try adding the following entry to your /etc/hosts file: dhcp

Then, try:

route add -host dhcp dev eth0

7.3.1. Options for DHCPD

Now you need to configure DHCPd. In order to do this you will have to create or edit /etc/dhcpd.conf. There is a graphical interface for dhcpd configuration under linuxconf. This makes configuring and managing DHCPD extremely simple.

If you want to configure it by hand follow instructions below. I suggest configuring it by hand at least once. It will help in the diagnostics that a GUI can't give you. Unfortunately Micrsoft doesn't believe this.

The easiest thing to do is assign IP addresses randomly. Below is a sample configuration file that shows this type of setup.

# Sample /etc/dhcpd.conf
# (add your comments here)
default-lease-time 1200;
max-lease-time 9200;
option subnet-mask;
option broadcast-address;
option routers;
option domain-name-servers,;
option domain-name "mydomain.org";

subnet netmask {

This will allow the DHCP server to assign the client an IP address from the range or

It will lease an IP address for 1200 seconds if the client doesn't request a longer time frame. Otherwise the maximum (allowed) lease the server will allow is 9200 seconds. The server send the following paramaters to the client:

Use as your subnet mask Use as your broadcast address Use as your default gateway USE and as your DNS servers.

If you specify a WINS server for your Windows clients you need to include the following option in the dhcpd.conf file.

option netbios-name-servers;

You can also assign specific IP addresses based on clients ethernet MAC address e.g.

  host haagen {
     hardware ethernet 08:00:2b:4c:59:23;

This will assign IP address to a client with ethernet MAC address of 08:00:2b:4c:59:23.

7.3.2. Starting the server

In most cases the DHCP installation doesn't create a dhcpd.leases file. Therefore before you start the server you must type to create an empty file:

touch /var/state/dhcp/dhcpd.leases

To start the DHCP server, simply type (or include in the bootup scripts)


This will start dhcpd on eth0 device. If you need to start it on another device simply supply it on the command line e.g.

/usr/sbin/dhcpd eth1

If you wish to test the configuration for any oddities you can start dhcpd with the debugging mode. Typing the command below will allow you to see exactly what is going on with the server.

/usr/sbin/dhcpd -d -f

Boot up a client take a look at the console of the server. You will see a number of debugging messages come up.

Your done