Ubuntu 12.04 DHCP Server


A DHCP server issues computers on the network IP addresses. Normally this is done by the router but a computer is more flexible because:


sudo apt-get install dhcp3-server


Configuring a DHCP server is where most of the complexities and bulk of the work lies. First thing to do is set the network interface should us DHCP. Edit /etc/default/isc-dhcp-server and change INTERFACES="" to INTERFACES="eth0" where eth0 is the network interface. Save and exit the file.

The DHCP server configuration file is located at /etc/dhcp/dhcpd.conf. It’s probably best to make a backup of the file first

sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.old

Edit the configuration file using the preferred text editor. The remainder of this post will be about configuring the server.

Basic Configuration

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

subnet netmask {
option subnet-mask;
option broadcast-address;
option routers;
option domain-name-servers,;

What they mean:

IP Reservation

IP addresses can be reserved so that computers can be assigned the same IP address all the time (except when there’s already assigned). Add the following lines to the bottom of the config file:
host MyComputer {
hardware ethernet AA:11:BB:22:CC:33;

Change the above parts highlighted in bold. MyComputer is the name of the computer, hardware ethernet is the MAC address of the network card and fixed-address is the IP address to be reserved.

Completing Configuration

For the changes to take hold, restart the DHCP server sudo service isc-dhcp-server restart


Setting up the DHCP server was fairly easy but configuring it is a lot harder than using a web interface like almost all routers nowadays. This setup is a precursor to creating a server to replace a router and will be more instrumental when used with other services such as proxy, DNS, etc


About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Linux and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *.

All comments must go through an approval and anti-spam process before appearing on the website. Please be patience and do not re-submit your comment if it does not appear.

This site uses Akismet to reduce spam. Learn how your comment data is processed.