Linux Help

DHCP Setup Guide   
Printable Version

DHCP Server Setup Guide by Joey.
Created on December 3rd, 2003.

DHCP (Dynamic Host Configuration Protocol) is an Internet protocol for automating the configuration of computers that use TCP/IP. DHCP can be used to automatically assign IP addresses, to deliver TCP/IP stack configuration parameters such as the subnet mask and default router, and to provide other configuration information such as the addresses for printer, time and news servers.

This simple guide will cover the installation and configuration of ISC's DHCP Client for a local network. Their DHCP client can be downloaded at


Once you've downloaded it, move the file to your favourite location (/usr/local/src for this guide) and unpack it by running the following command:

    tar -zxvf dhcp-*.tar.gz

This will create a directory called dhcp-3.0pl2 (the version number may vary). Enter into this directory and run the following command as root:


If there are no errors you may run the following command (as root):


If there are no errors you may run the following command (as root):

    make install

If you come across any errors when running the above commands you are likely missing a library or file on your system. Your best bet is to visit and perform a search on the error message. This should give you somewhat of an idea of what is missing and how to correct it. You might also want to have a look at the ISC DCHP Client Readme which can be found at

Once DHCP has finished compiling you must copy the dhcpd.conf file to your /etc directory. You can find a sample dhcpd.conf file in the server/ directory of the DHCP package you downloaded. I've also included a sample dhcpd.conf file below.

Sample dhcpd.conf file

# Sample dhcpd.conf
# Sample configuration file for ISC dhcpd

ddns-update-style ad-hoc;

# option definitions common to all supported networks...
option domain-name "";

# Your name servers. You can normally find these in 
# your /etc/resolv.conf file. These will be distributed to all DHCP 
# clients.
option domain-name-servers,,;

default-lease-time 600;
max-lease-time 7200;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# Configuration for an internal subnet.
subnet netmask {
  option domain-name-servers,,;
  option domain-name "";
  option routers;
  option broadcast-address;
  default-lease-time 600;
  max-lease-time 7200;

Static IP's & MAC Addresses

If you would like to assign a static IP to a peticular machine on your network you'll need to know the MAC address of the ethernet card on that peticular machine. To find the MAC address in Linux type:


You should then see something similar to HWaddr 00:C0:9E:05:BD:D6. The MAC address for that ethernet card would be 00:C0:9E:05:BD:D6

If you are running Windows XP you can find out the MAC address by clicking on "Start --> Programs --> Accessories --> Command Prompt". At the prompt type:
    ipconfig /all

You should then see "Physical Address" and the MAC address listed. Note: Windows might list the MAC address with hyphens (-) instead of colons (:), if so, just replace them with colons when entering them into your dhcpd.conf file. (ex: change 00-45-40-10-FE-12 to 00:45:40:10:FE:12)

Once you've found the MAC address you can add the following entry to the bottom your dhcpd.conf file:

# Assign a static IP to
host atlantis {
  hardware ethernet 00:45:40:10:FE:12;

Running DHCP

Once you've edited the config file to suit your network IP address ranges etc, you'll want to create a file called dhcpd.leases in your /var/state/dhcp/ directory. To do so, run the following command as root:

    touch /var/state/dhcp/dhcpd.leases

If you receive an error that the file already exists, simply ignore it and continue. Once the file has been created you can start up the DHCP server by running the following command as root:

Note: By default, DHCP runs on the first ethernet device on your machine (generally eth0). If you would like to have DHCP run on a different device you must specify it when you start the DHCP server. If you wanted DHCP to operate on eth1 you would start up the DHCP server by running:
    /usr/sbin/dhcpd eth1

If there are any errors with your dhcpd.conf file, dhcpd will not start and you should be presented with an error message indicating what is wrong. If you cannot figure out what is causing the error message I suggest you visit and perform a search on it.

If everything started up fine you should see something like this

# /usr/sbin/dhcpd eth1
Internet Software Consortium DHCP Server V3.0pl2
Copyright 1995-2003 Internet Software Consortium.
All rights reserved.
For info, please visit
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 0 leases to leases file.
Listening on LPF/eth1/00:40:44:16:2e:e8/
Sending on   LPF/eth1/00:40:44:16:2e:e8/
Sending on   Socket/fallback/fallback-net

Now simply set the machines on your local network to obtain their IP addresses via DHCP and you're all set.

Mailing Lists

ISC runs a few mailing lists with regards to their DHCP distribution. You should really consider signing up to the dhcp-announce list so you can be made aware of any software updates, security vulnerabilities etc that come up in the future. You can sign up at

Having trouble? Got questions? Require further assistance? If so please feel free to visit our Help Forums and ask the experts!

Copyright © 1997 - 2017 Private World Domination Inc. All rights reserved.
Linux is a registered trademark of Linus Torvalds. All other trademarks and copyrights are the property of their respective owners.
| Contact Us | Link to Us | RSS Feed | Staff |

DNS Hosting by easyDNS