Data Networking/Fall 2014/Shalini/DHCP

Dynamic Host Configuration Protocol (DHCP)

edit

Dynamic Host Configuration Protocol is a client/server protocol that automatically provides an internet protocol (IP) host with its IP address and other related configuration such as subnet mask, gateway etc in the other way we can say that dhcp is a communication protocol that lets network administrator centrally manage and automate the assignment of the Internet protocol addresses in an organization network.

Behaviour of the Protocol:

edit

DHCP is a client – server application layer protocol which uses the services of UDP (Transport layer Protocol) at port number 67(RFC 2131).the server dynamically allocates the IP address, subnet mask and default gate way for the client.

Signalling:

edit
 

1.The main task of the host that has entered a network newly is to find the DHCP server this can be done by using the DHCP server

2.The DHCP server receiving the DHCP discover message sends the client the DHCP offer message in response

3.Newly arrived client will choose from among one or more serever offers and respond to the selected offer by sending request to the dhcp server

4.The sever responds to the requested message by sending the acknowledgement to the client

Steps to Configure DHCP Server:

edit

Static IP Configuration: Initially assign the static IP address of the DHCP server

• Go to network connections>edit connections > select the network you are connected to >IPv4 address> assign static address to the server.

• Updating all available packages:

 sudo apt-get update

Before installing DHCP server install all the packages by using the above command

• Install DHCP package in Ubuntu using,

 sudo apt-get install isc-dhcp-server

• Configuring DHCP File:

Dhcpd.conf file can be configured from the path /etc/dhcp/

Edit the configuration of dhcpd.conf file

 sudo nano /etc/dhcp/dhcpd.conf

Changes that are to be done in the dhcp file are:

(i) Initially we need to change the network address and subnet mask

(ii) Network address and subnet mask of the range

(iii) Domain Name Server IP address

(iv) IP address of the router interface

(v) Networks broadcast address

(vi) Default and max lease time

  1. a slightly different configuration for an internal subnet
 subnet  192.168.3.0 netmask 255.255.255.0{
 range 192.168.3.30 192.168.3.80;
 range 192.168.3.100 192.168.3.150;
 option domain-name-servers 192.168.3.52;
 option domain-name “fabfour.com”;
 option routers  192.168.3.1;
 option broadcast-address 192.168.3.255;
 default-lease-time 600;
 max-lease-time  7200;
 }
 

Now the dhcpd.conf file is saved

  • To assign permanent IP addresses to the client, web server and dans server, the MAC addresses of each are used to allocate fixed IPs.

enter the conf file using the command:

 sudo nano /etc/dhcp/dhcpd.conf
 

• DHCP file restart:

After configuring and saving the dhcp file we need to restart the dhcp server

 sudo service isc-dhcp-server restart      /or/
 sudo etc/init.d/isc-dhcp-server start
 

Testing:

edit

1.DHCP leasing: the leases on the DHCP server and the IP addresses that has been leased on the client can be verified by using the command

 Sudo tail/var/lib/dhcp/dhcpd.leases

2.DHCP log: the log output of dhcp can be verified by using the command’

 Sudo tail –f/var/log/syslog