Day one in Computer Network
When a new system joins a network, it first sends out DHCP discover message.
This is because when a system joins a new network it needs the following things to connect to the rest of the world wide web:
1) IP address, Host, and network ID
2) DNS address
3) First Hop Router Address.
The DHCP discover message which is an application layer protocol message is encapsulated in a UDP packet. source port is 68 and the destination port is 67. The default port on which DHCP service listens is port 67.
The UDP packet or segment is encapsulated in an IP packet that has a source IP as 0.0.0.0 and the destination IP address is global IP 255.255.255.255.
Recommended by LinkedIn
UDP packet is further encapsulated in an ethernet frame with source address as MAC address of the computer and destination address as the global MAC address which is ff:ff:ff:ff:ff:ff. In response to DHCP discover message, the DHCP server replies with a DHCP offer.
Remember both the DHCP discover and DHCP offer are optional.
The destination address for the DHCP offer is again global because there could be multiple DHCP servers in the network and the DHCP server may want to let all the other DHCP servers know about the offer.
The client Will now send DHCP Request, Which will again be sent out to all machines. The DHCP request is a compulsory message and it conveys, the client has accepted the offer from one of the DHCP server and every other DHCP server is free to give re-allocate the IP address to other host systems.
Now, the DHCP server will send DHCP ACK to everyone in the network. This is to tell that it is acknowledging that the client can use the IP address.
Apart from the three necessary information mentioned above, The DHCP server also sends further information such as lease time, rebinding time, renewal time, and client fully qualified domain name.