I often use Linux systems as routers for the simple reason that virtual machines require them. But I thought, since I’m doing it anyway, why not write a blog post about it?

So… let’s get started with the installation!

Installing isc-dhcp-server

First, we need to install a package called isc-dhcp-server.

sudo apt install isc-dhcp-server

Configuring DHCP Server

After installation, we need to edit the configuration file /etc/dhcp/dhcpd.conf. Here’s an example:

option domain-name "network.steveyi.net"; # Domain name
option domain-name-servers; # DNS server

default-lease-time 600; # Default lease time
max-lease-time 3600; # Maximum lease time

# Subnet, allocated /24
subnet netmask {
    option subnet-mask;
    option routers;

Next, we need to edit the network interface for sending DHCP packets: /etc/default/isc-dhcp-server.

Finally, enter service isc-dhcp-server restart. That’s it!