Thursday, August 6, 2009

DHCP - DORA Process Explained

When you connect a computer in a network , automatically you will get an ip address for your computer or when you try with ipconfig/release and Ipconfig/renew from your DOS prompt in your system you will get a new ip address.But what exactly happens at the packet level ..here is an attempt to explain this in detail with the Help of Wireshark packet capture .


1) Discover:
Client makes a UDP Broadcast to the server about the DHCP discovery. Asit doesn't know where the DHCP server is reachable in the network it sends UDP broadcast with the source ip address as 0.0.0.0 and destination ip address as 255.255.255.255 with its own MAC address .Unless, we have a DHCP Relay agent in the same subnet, IP helper address, etc. configured on your router. Then the broadcast is forwarded to a specific destination.
2)Offer:

DHCP Server offers to the client with available ip address,lease time sunbnetmask,gateway and DNS information .communication will be established based on the mac-address of client.
3) Request:





In response to the offer Client requests the server . Note that still client is not having the ip address. Now client makes request to the server for the IP information being offerd by the DHCP server .
A client can receive DHCP offers from multiple servers, but it will accept only one DHCP offer and broadcast a DHCP request message. Based on Transaction ID field in the request, servers are informed whose offer the client has accepted. When other DHCP servers receive this message, they withdraw any offers that they might have made to the client and return the offered address to the pool of available addresses.
4)Acknowledge:
Server responds all the Ip Add/mask/gateway/dns/wins info along with the acknowledgement packet.
Last but not least, if none of the DHCP server is availble in your network or the connection is broken to your DHCP server APIPA would automatically assign a unique class B IP address to each machine in the range of 169.254.x.x range.
For more information on DHCP please reffer RFC 2131 .

No comments: