Building an Ubuntu Router Part 2 - DHCP

Installation

To deliver ip to clients, isc-dhcp-server will be used.

1
sudo apt-get install isc-dhcp-server -y

Configuration

It is always recommended to backup the files to be edited.

1
2
sudo cp /etc/default/isc-dhcp-server{,.bak}
sudo nano /etc/default/isc-dhcp-server

The interface enp0s8 will be used to assign ip to the clients and it is the one that is added in the corresponding line.

1
2
INTERFACESv4="enp0s8"
INTERFACESv6=""

Then you configure dhcpd.conf for the subnet and the ip addresses that you can assign to the clients, adding or uncommenting some lines.

1
2
sudo cp /etc/dhcp/dhcpd.conf{,.bak}
sudo nano /etc/dhcp/dhcpd.conf
1
2
3
4
5
6
7
8
9
10
11
option domain-name "juvenal-yescas";
option domain-name-servers 128.0.0.1, 1.1.1.1, 1.0.0.1;

authoritative;

subnet 128.0.0.0 netmask 255.255.255.224 {
range 128.0.0.2 128.0.0.30;
option subnet-mask 255.255.255.224;
option broadcast-address 128.0.0.31;
option routers 128.0.0.1;
}

domain-name-servers: It will be the same server.
range: The ip addresses for clients are from.2 up to .30

Finally, restart the DHCP server so the new configuration will take effect and enable it so that it will start automatically on boot:

1
2
sudo systemctl restart isc-dhcp-server
sudo systemctl enable isc-dhcp-server

And check the status:

1
sudo systemctl status isc-dhcp-server

Check status isc-dhcp-server

© 2020 Juvenal Yescas All Rights Reserved.
Theme by hiero