DHCP stands for Dynamic Host Configuration Protocol. As its name suggests DHCP is used to provide configuration like Ip Address, Network Mask, Dns, Proxy, Bootp, Default Gateway etc. to the host. But the most know and popular usage is distributing IP address. There are broad range of DHCP usage scenarios. In this tutorial we will look IP address distribution of DHCP with an example.
DHCP IP address assignment is done in 4 steps where all steps will be examined below. DHCP uses UDP packets which means connection less architecture. DHCP works as client-server architecture. Client initiate the process. Some times client may be reside in different network so to transmit DHCP packet a DHCP Helper or DHCP Relay needed in the client network.
We will use Gns3 as lab environment. There will be also a DHCP server which is Pfsense and a DHCP client Windows Server 2012. We will enable DHCP service of Pfsense and than capture the DHCP traffic with Wireshark.
Enable DHCP Service
DHCP service configuration screen can be accessed like below.
Services -> DHCP Server
Click to the
Enable DHCP server on LAN interface
And then set IP address range. In this example we will use
To start DHCP service with specified configuration click
Save button on the bottom of the page.
Following screenshot shows everything about discovery packet sent from client. Client simply send broadcast packet to get an offer from DHCP server currently serves for this network.
DHCP server listening the network of the currently requested client and provides an offer to this client. Offered IP address is 10.0.0.128 and lease time is 2 hours. Lease time is to set expire time for given IP address. After the lease time is timed out client will re-request the same IP address automatically.
The client will get the offer and in most situations client will accept offered ip address and network configuration. As we see that client also sends its host name with host name Option 12 .
After the server gets the reponse from client it will assign the offered IP address to this client and allocate this IP. This IP will not offered to new clients if it is not freed.