Skip to content

Latest commit

 

History

History
253 lines (180 loc) · 6.23 KB

README.md

File metadata and controls

253 lines (180 loc) · 6.23 KB

Logo

Project 1

Dynamic Host Configuration Protocol

Table of Contents
  1. Network architecture
  2. Part I : Installing the DHCP server
  3. Part II : DHCP configuration
  4. Part III : Relay agent configuration
  5. Part IV : Demonstration

Network architecture

Part-I

Setup ISC DHCP server First we install the DHCP server.

Installing the DHCP server

sudo apt-get install isc-dhcp-server

Part-II

Network architecture DHCP

Configuring the 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=""

Subnets declaration

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;
}

Interfaces

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

firewall_disabled

sudo nano /etc/selinux/config

Routing

sudo nano route -n

Then the DHCP server has to be started.

sudo systemctl start isc-dhcp-server

If the command prompt returns without a message, then it worked.

Server status

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.

(back to top)

Part-III

Network architecture RELAY-AGENT

Setup ISC DHCP RELAY

First we install the DHCP relay agent.

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.

Configuring ther DHCP Relay

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=""

Configuring the interfaces

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

Activating packet forwarding

etc/sysctl.conf

net.ipv4.ip_forward=1

firewall_disabled

sudo nano /etc/selinux/config

Routing

sudo nano route -n

Then the DHCP relay has to be started

sudo systemctl start isc-dhcp-relay

If the command prompt returns without a message, then it worked.

DHCP relay status

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

(back to top)

Part-IV

  • Demonstrate the DHCP operating with a client and a server in the same network.
Client1 DHCP_config Routing
Image client1 Image routing_dhcp Image routing_dhcp
  • Demonstrate the DHCP operating with a client and a server in different networks.
Client2 RELAY_config Routing
Image client2 Image routing_dhcp Image routing_dhcp

(back to top)

Our Team - AIT EL KADI Ilyas - AZIZ Oussama - DARBAL nour-elhouda -MZOUDI Khaoula

Project Link: DHCP-Relay-Agent

Encadré par : Mme.TADIST Khawla

(back to top)