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.
krizna@leela:~$ sudo apt-get update
Step 2 » Now install isc-dhcp-server package and dependencies.
krizna@leela:~$ sudo apt-get install isc-dhcp-server -y
Step 3 » After installing, open /etc/default/isc-dhcp-server file and assign interface.
krizna@leela:~$ sudo nano /etc/default/isc-dhcp-server

Step 4 » We need to define below values in dhcpd.conf file located in /etc/dhcp/ directory.
Example scenario:
Network :
Range : ( Starting IP ) – ( Ending IP )
Gateway :
Primary DNS :
Sec DNS :
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 .
krizna@leela:~$ sudo mv /etc/dhcp/dhcpd.conf /etc/dhcp/
krizna@leela:~$ sudo nano /etc/dhcp/dhcpd.conf and add the below code after making changes as per your network values.

# option definitions common to all supported networks...
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;

subnet netmask {  #network
	range; # Range
	option domain-name-servers,; #Pri DNS , Sec DNS
	option domain-name ""; #Domain name 
	option routers; #Gateway
	option broadcast-address; #Broadcast
	default-lease-time 600;
	max-lease-time 7200;

Step 5 » Now start/restart dhcp service using the below command.
krizna@leela:~$ 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 IP. For this, you need to add code like below to that subnet.

subnet netmask {  #network
       -  -   -    -   -  
       max-lease-time 7200;
     host printer-finance {
                hardware ethernet 00:DD:HD:66:55:9B; 
       host cam-gate {
                hardware ethernet 00:KK:HD:44:55:22;

and restart DHCP service.
krizna@leela:~$ sudo service isc-dhcp-server restart
That’s it . All the best
Troubleshooting and more config options


  1. How many users can supported by Linux based DHCP server?I want confiure it for 400-500 users. Will it work for me? And Can I use two gateway to access internet?

  2. Dear Krizna,


    One more question (or maybe answer), to disable the dhcp server is it sufficient to edit the /etc/default/isc-dhcp-server
    and edit the line INTERFACES= (# remove the “eth0”)
    and issue a command:
    sudo service isc-dhcp-server stop

    Or do I need to take additional action to avoid autostart at reboot ?

1 Trackback / Pingback

  1. Ubuntu:How do I install and configure a DHCP server? – Ubuntu Linux Questions

Leave a Reply

Your email address will not be published.