1- Network Setup :
We assume the following network configuration:
- Server (Debian 1) - Internal Network: 192.168.1.1/24
- Failover (Debian 2) - Internal Network: 192.168.1.2/24
- Relay (Debian 3) - 2 Interfaces (Internal Network):
- IP in the Client Network: 192.168.1.3/24
- IP in the Server Network: 192.168.2.1/24
- Client (Debian 4) - Internal Network: 192.168.2.10/24
We will assign the IPs to the machines through the file /etc/network/interfaces :
- Server :
- Failover :
- Relay :
- Client:
2- Installing Necessary Packages :
- Server :
apt update
apt install isc-dhcp-server
- Failover :
apt update
apt install isc-dhcp-server
- Relay :
apt update
apt install isc-dhcp-relay
- Client :
No packages need to be installed on the client, but it is advisable to update the repository.
apt update
3-Connectivity Check :
- To check connectivity between the client and server, we usually ping from the client to the server or vice versa.
- Now, edit the network configuration file on the client, located at /etc/network/interfaces, and configure the enp0s3 interface in DHCP mode.
3- Server Machine Configuration :
a- /etc/default/isc-dhcp-server :
- Edit the file /etc/default/isc-dhcp-server to configure the interface that will listen for client requests, which in this case will be enp0s3.
b- /etc/dhcp/dhcpd.conf :
- Now, configure the DHCP service on the server:
Now we need to restart the DHCP service:
systemctl restart isc-dhcp-server
systemctl status isc-dhcp-server
The service should now be active.
4-Failover Machine Configuration :
a- /etc/default/isc-dhcp-server
- Just like on the server, we need to edit the file /etc/default/isc-dhcp-server to configure the interface that will listen for client requests, which in this case will be enp0s3.
b- /etc/dhcp/dhcpd.conf
- Now, configure the DHCP service on the Failover:
- Now we need to restart the DHCP service:
systemctl restart isc-dhcp-server
systemctl status isc-dhcp-server
The service should now be active.
5-Relay Machine Configuration :
*a- Enable Forwarding: *
Edit the file /proc/sys/net/ipv4/ip_forward to allow packet forwarding between network interfaces:
echo '1' > /proc/sys/net/ipv4/ip_forward
b- Client Network:
To make this change persistent after a reboot, edit the file /etc/sysctl.conf and add the following line:
echo "net.ipv4.ip_forward=1" > /etc/sysctl.conf
c- /etc/default/isc-dhcp-relay
In this file, we need to add the IP of the server and the Failover, and set the two interfaces that connect to the client and the server. By default, these are usually “enp0s3” and “enp0s8” in VirtualBox.
6- DHCP Verification:
Part 1: Server Check
We have finished configuring all machines (Server, RELAY, FAILOVER). Now it's time to check if the DHCP works correctly and if the client can obtain a dynamic IP from the server.
Part 2: Failover Check
After verifying that the client can obtain a dynamic IP from the server and everything works correctly, we can turn off the server or stop the isc-dhcp-server service to check if the client can obtain a dynamic IP from the Failover machine.
systemctl stop isc-dhcp-server # On the Server Machine
Top comments (0)