Setting Up a DHCP Server on Ubuntu

Updated on June 9, 2015
Setting Up a DHCP Server on Ubuntu header image

DHCP can be used to dynamically provide local IP addresses to client computers. This prevents you from having to setup static IP addresses for every computer on your network. DHCP is very useful for busy environments such as schools and businesses.

Setting up a DHCP server on Ubuntu is not very difficult. Simply follow the steps in this tutorial and you will have a DHCP server running.

Step 1: Installing the DHCP server

First off, install the server.

apt-get install isc-dhcp-server

Step 2: Setting the network interface

We will need to determine the network interface that we want to lease addresses on. To do this, replace eth0 with the sufficient network interface.

vi /etc/default/isc-dhcp-server

Step 3: Configuring the DHCP server

Next, configure the DHCP server.

vi /etc/dhcp/dhcpd.conf

You will see the following sample configuration. Review the configuration options and set them to your liking. Take into account that the option domain-name is the name of your DNS zone.

#Sample configuration file for ISC dhcpd for Debian
#Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as
#configuration file instead of this file.
option domain-name;
option domain-name-servers,;
option domain-name;
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet netmask {
option routers;
option subnet-mask;
option broadcast-address;
option domain-name-servers,;
option ntp-servers;
option netbios-name-servers;
option netbios-node-type 8;

Step 4: Starting the DHCP server

Finally, restart the DHCP server.

service isc-dhcp-server restart

The setup is complete. You can now use your DHCP server to assign IP addresses.