Table of Contents
Setup ISC DHCP server First we install the DHCP server.
sudo apt-get install isc-dhcp-server
First we have to define for which network interface the ISC DHCP server should work. To do this, we open the following configuration file.
sudo nano /etc/default/isc-dhcp-server
Here we add the interface name in the line provided. Here we choose “eth1”. Depending on the application, it can also be “wlan0”.
INTERFACESv4="eth1"
INTERFACESv6=""
sudo nano /etc/dhcp/dhcpd.conf
Then the editor opens with an empty file, in which we enter the following configuration.
authoritative;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0
{
range 192.168.1.50 192.168.1.80;
option routers 192.168.1.1;
interface eth1;
}
subnet 192.168.2.0 netmask 255.255.255.0
{
range 192.168.2.50 192.168.2.80;
option routers 192.168.2.1;
interface eth0;
}
sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet static
address 10.1.1.1
gateway 10.1.1.1
network 10.1.1.0
netmask 255.255.255.0
allow-hotplug eth1
iface eth1 inet static
address 192.168.1.1
gateway 192.168.1.1
sudo nano /etc/selinux/config
sudo nano route -n
sudo systemctl start isc-dhcp-server
If the command prompt returns without a message, then it worked.
If the start of the ISC DHCP server was aborted with an error, then you should perform a status query to get to the bottom of the error.
sudo systemctl status isc-dhcp-server
In case of error, the messages are unfortunately not always clear. Unless you have made a configuration error. Very popular are typos or missing semicolons (“;”) at the end of a directive.
Setup ISC DHCP RELAY
apt install isc-dhcp-relay
First we have to define for which network interface the ISC DHCP server should work. To do this, we open the following configuration file.
sudo nano /etc/default/isc-dhcp-relay
Here we add the ADDRESS of dhcp and interfaces names.
# What servers should the DHCP relay forward requests to?
SERVERS="10.1.1.1"
# On what interfaces should the DHCP relay (dhrelay) serve DHCP requests?
INTERFACES="eth0 eth1"
# Additional options that are passed to the DHCP relay daemon?
OPTIONS=""
sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
allow-hotplug eth1
iface eth1 inet static
address 10.1.1.2
gateway 10.1.1.2
network 10.1.1.0
netmask 255.255.255.0
allow-hotplug eth0
iface eth0 inet static
address 192.168.2.1
gateway 192.168.2.1
network 192.168.2.0
netmask 255.255.255.0
etc/sysctl.conf
net.ipv4.ip_forward=1
sudo nano /etc/selinux/config
sudo nano route -n
sudo systemctl start isc-dhcp-relay
If the command prompt returns without a message, then it worked.
If the start of the ISC DHCP relay was aborted with an error, then you should perform a status query to get to the bottom of the error.
sudo systemctl status isc-dhcp-relay
- Demonstrate the DHCP operating with a client and a server in the same network.
Client1 | DHCP_config | Routing |
---|---|---|
- Demonstrate the DHCP operating with a client and a server in different networks.
Client2 | RELAY_config | Routing |
---|---|---|
Our Team - AIT EL KADI Ilyas - AZIZ Oussama - DARBAL nour-elhouda -MZOUDI Khaoula
Project Link: DHCP-Relay-Agent
Encadré par : Mme.TADIST Khawla