Install DHCP Services on Ubuntu

The goal here is simply to install DHCP Services so that the Ubuntu host will allocate IP addresses to clients on the network.   Using this method allows more control over DHCP options handed out to the clients over most consumer based routers.  I’ve done this on both Ubuntu 10.04 LTS and 12.04 LTS with one minor difference.   In 10.04, conf files are in /etc/dhcp3.  In 12.04, conf files are in /etc/dhcp.     With that in mind, here are the steps.

Get the DHCP server from repository.

apt-get install dhcp3-server

   (Don’t worry if it says startup fails, its not configured yet)

For 10.04, edit /etc/dhcp3/dhcpd.conf

For 12.04, edit /etc/dhcp/dhcpd.conf

Add the following sections for the subnet

#option definitions common to all supported networks...
#replace mydomain.local your internal dns namespace
#replace server1.mydomain.local with the domain name of the dns server
option domain-name "mydomain.local";
option domain-name-servers server1.mydomain.local;

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

# This is a very basic subnet declaration.
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.10.150;
option routers gateway.mydomain.local;
}

# also add in the following for each ip reservations:
# Instead of assigning an IP address here, I referred
# to the dns entry. This way, if I need to change the IP
# I only need to edit the DNS entry.

host  PCNAME;{
hardware ethernet MAC ADDRESS GOES HERE;
fixed-address PCNAME.mydomain.local;
}

Start the DHCP service on 10.04 with

 /etc/init.d/dhcp3-server start 

Start the DHCP service on 12.04 with

 start isc-dhcp-server

Add user dhcpd as owner and assign permissions
For 10.04

Chown dhcpd:root /etc/dhcp3/dhcpd.conf
Chmod 660 /etc/dhcp3/dhcpd.conf

For 12.04

Chown dhcpd:root /etc/dhcp/dhcpd.conf
Chmod 660 /etc/dhcp/dhcpd.conf
Bookmark the permalink.

Leave a Reply

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

Solve : *
26 − 10 =