Skip to main content

Setup DHCP server on ubuntu 14.04


DHCP server is used to assign IP address to client computers and other Network devices . Basically we need Ipaddress, Subnet mask, Gateway and DNS for network settings . We need to define these values in the DHCP server, so that the client computer connected to that network gets values automatically from DHCP server.
This guide helps you to setup DHCP server on ubuntu 14.04.

Setup DHCP server on ubuntu 14.04

Before installation, Make sure you have assigned static IP to the server.
Step 1 » Issue the below command to update repository.
[email protected]:~$ sudo apt-get update
Step 2 » Now install isc-dhcp-server package and dependencies.
[email protected]:~$ sudo apt-get install isc-dhcp-server -y
Step 3 » After installing, open /etc/default/isc-dhcp-server file and assign interface.
[email protected]:~$ sudo nano /etc/default/isc-dhcp-server
INTERFACES="eth0"

Step 4 » We need to define below values in dhcpd.conf file located in /etc/dhcp/ directory.
Example scenario:
Network : 192.168.100.0/24
Range : 192.168.100.20 ( Starting IP ) – 192.168.100.100 ( Ending IP )
Gateway : 192.168.100.1
Primary DNS : 192.168.100.5
Sec DNS : 8.8.8.8
Setup DHCP server on ubuntu 14.04
Take backup copy before making changes to the original file .Better rename the file and create a new one .
[email protected]:~$ sudo mv /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.org
[email protected]:~$ sudo nano /etc/dhcp/dhcpd.conf and add the below code after making changes as per your network values.

Step 5 » Now start/restart dhcp service using the below command.
[email protected]:~$ sudo service isc-dhcp-server restart

Address Reservation

Sometimes you need to reserve IP to some devices like printers, camera, linux machines etc.
In this case, first you need to find MAC Address of that device and define values in that particular subnet.
For example, Printer with 00:DD:HD:66:55:9B MAC Address has to be assigned with 192.168.100.50 IP. For this, you need to add code like below to that subnet.

and restart DHCP service.
[email protected]:~$ sudo service isc-dhcp-server restart
That’s it . All the best
Troubleshooting and more config options