Config Server Firewall

Install and Configure DHCP Server in Ubuntu

In this tutorial we are going to learn How to Install DHCP Server on Ubuntu Server 16.04. At the end of this tutorial you should be able to configure your Ubuntu Server as DHCP server and issue dynamic IP Address to the DHCP clients on your Network.

Install isc-dhcp-server Package on Ubuntu

The DHCP Server for Ubuntu 16.04 provides by the isc-dhcp-server package.

Install the isc-dhcp-server on Ubuntu 16.04 using apt-get install command.

sudo apt-get install isc-dhcp-server

Install and Configure DHCP Server in Ubuntu

Now we have installed the dhcp server on Ubuntu, Next step is to configure Ubuntu dhcp server to assign Dynamic IP Address to the dhcp clients in our network.

Configure Ubuntu DHCP Server

The /etc/dhcp/dhcpd.conf file is the main configuration file for the Ubuntu DHCP Server.

Following is the sample configuration use in /etc/dhcp/dhcpd.conf to issue dynamic IP Address on Specific Subnet.

subnet 10.0.0.0 netmask 255.255.255.0 {
 range 10.0.0.100 10.0.0.150;
 option domain-name-servers 8.8.8.8;
 option subnet-mask 255.255.255.0;
 option routers 10.0.0.1;
 default-lease-time 43200;
 max-lease-time 86400;
}

As per the Above DHCP Configuration,

You need to restart the dhcp server after you edit the configuration file.

systemctl restart isc-dhcp-server

If your Ubuntu Server is connected to multiple networks, you can add configuration blocks for the each subnet.

subnet 10.0.0.0 netmask 255.255.255.0 {
 range 10.0.0.100 10.0.0.150;
 option domain-name-servers 8.8.8.8;
 option subnet-mask 255.255.255.0;
 option routers 10.0.0.1;
 default-lease-time 43200;
 max-lease-time 86400;
}

subnet 192.168.1.0 netmask 255.255.255.0 {
 range 192.168.1.200 192.168.1.240;
 option domain-name-servers 8.8.8.8;
 option subnet-mask 255.255.255.0;
 option routers 192.168.1.1;
 default-lease-time 43200;
 max-lease-time 86400;
}

Start/Restart DHCP Server in Ubuntu

Start ubuntu dhcp server

systemctl start isc-dhcp-server

Restart ubuntu dhcp server

systemctl restart isc-dhcp-server

Summary - Ubuntu Server DHCP Configuration

In this tutorial we learned how to configure dhcp server on Ubuntu 16.04.