Low Orbit Flux Logo 2 F

Setup ISC DHCP Server on Ubuntu

In this guide we are going to show you how to setup an ISC DHCP server on Ubuntu Linux. This has been tested on Ubuntu 20.04.

You can install the package for the ISC DHCP Server like this:


sudo apt update  
sudo apt install isc-dhcp-server

This is an example of how the man configuration file could be setup. In this example we show you how to specify a range of possible IPs that can be assigned to hosts. You can actually specify multiple ranges as shown below. We also show how you can explicitly map a MAC address to an IP address. Note that 8.8.8.8 and 8.8.4.4 are googles DNS servers which I generally prefer over any ISP’s DNS servers because they are more trustable. You should probably use these unless you are running your own DNS server.

vi /etc/dhcp/dhcpd.conf
option domain-name "example.org"; option domain-name-servers 8.8.8.8, 8.8.4.4; default-lease-time 600; max-lease-time 7200; ddns-update-style none; authoritative; subnet 192.168.3.0 netmask 255.255.255.0 { option routers 192.168.3.1; option subnet-mask 255.255.255.0; option broadcast-address 192.168.3.255; option domain-name-servers 8.8.8.8; default-lease-time 86400; max-lease-time 86400; range 192.168.3.150 192.168.3.180; range 192.168.3.190 192.168.3.250; host test1 { hardware ethernet 08:00:27:85:AE:C9; fixed-address 192.168.3.150; } }

Specify the interface to use like this. Swap the interface name for the interface name on your system. At one point I specified a bridge interface that was used for KVM on the same host ( br0 ).

sudo vi /etc/default/isc-dhcp-server
INTERFACESv4="eno2"

You can restart the service like this:


sudo service isc-dhcp-server restart

You can check the logs like this:


journalctl -u isc-dhcp-server

You can see current leases in this file. This seems to be for dynamically allocated addressses and not for statically configured addresss that have been explicitly mapped to a MAC address.


cat /var/lib/dhcp/dhcpd.leases