Ubuntu 20.04 – DHCP & DNS Server

OK, now most of the hosted services have been moved off-prem, its time to build a new office server to run the place!

One of the first things after installing the latest Ubuntu it DHCP/DNS …

Assigning Static IP:

In Ubuntu 20.04 LTS server, network configuration is controlled and managed by the netplan utility.

During installation, cloud-init configures a dynamic IP to interface on server if the dhcp server is available. so, to configure a static IP, first we must make sure and confirm that network interface is not managed by cloud-init.

Check that the file “/etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg” does not include an entry “network: {config: disabled}”:

sudo cat /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg

If not, add it manually.

sudo echo ‘network: {config: disabled}’ >> /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg

Use “ip addr show” command to view IP address and interface details:

Installing Bind9 DNS Server:

The Bind9 DNS server package is available in the official package repository of Ubuntu 20.04 LTS. So, you can easily install it using the APT package manager with the following command:

sudo apt install bind9

RNDC Key

First step is to create rndc key file and configuration file. rndc provides command line tool rndc-confgen to generate it.

# rndc-confgen

Installing ISC DHCP Server:

The ISC DHCP server package is available in the official package repository of Ubuntu 20.04 LTS. So, you can easily install it using the APT package manager with the following command:

sudo apt install isc-dhcp-server

Configurng ISC DHCP Server:

The main configuration file of ISC DHCP server is /etc/dhcp/dhcpd.conf. Lets make a backup before we start!

sudo cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.backup

Once you do, you have to restart the isc-dhcp-server service as well for the changes to take effect.

To restart the isc-dhcp-server service, run the following command:

sudo systemctl restart isc-dhcp-server

Now, check whether the isc-dhcp-server is running correctly with the following command:

sudo systemctl status isc-dhcp-server

One thought on “Ubuntu 20.04 – DHCP & DNS Server

Leave a Reply