What is DHCP and How It Works?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/what-is-dhcp-and-how-it-works/
PINTEREST
PINTEREST
INSTAGRAM

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.

Phases

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.

Phases

Phases

Lab Environment

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.

Lab Environment

Lab Environment

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 10.0.0.128 and 10.0.0.254

To start DHCP service with specified configuration click Save button on the bottom of the page.

DHCP Discovery

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.

Discovery

Discovery

DHCP Offer

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.

Dhcp Offer

Dhcp Offer

DHCP Request

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 .

DHCP Request

DHCP Request

DHCP Acknowledge

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.

DHCP Acknowledge

DHCP Acknowledge

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/what-is-dhcp-and-how-it-works/
PINTEREST
PINTEREST
INSTAGRAM

LEARN MORE  Linux uniq Command Tutorial With Examples

You may also like...

2 Responses

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)