DHCP

Harchit

6/9/20215 min read

In this scenario, we delve into how a PC obtains an IP address in a simple network through DHCP. To facilitate understanding and efficiency, we will also examine Wireshark examples of the destination MAC address, source MAC address, source IP address, and destination MAC address throughout the process. We will cover basic definitions of the ARP process, DHCP, DHCP RELAY, and ICMP messages up to the CCNA level.

  1. How do PC in the above scenario get a DHCP IP address ?

    PC is sending DHCP Discover packets, trying to look for a DHCP Server that can provide it an IP address

a. The destination MAC address is all F's signifying a broadcast MAC address, source MAC address is MAC address of the PC, the type signifies that the packets is requesting an IPv4 address.

b. Source IP address is 0.0.0.0 a wildcard or an unassigned address since PC does not have an IP address yet, Destination IP address is a broadcast address on the network thus it is being sent to all the nodes within that network.

c. Port numbers specify which service is the being packet sent for and in the selected packet the source port is 68 which means a DHCP client or a host that is supposed to get an IP address through DHCP and destination port is 67 which means it is looking for a DHCP server which can assign it a DHCP address so that it can be routable on a network

2. Now, the Discover packets have reached R1 but it is not acting as a DHCP server, also the routers only forward broadcast packets within a local network segment not route it towards another network Now to send the DHCP DISCOVER MESSAGE, we need to configure DHCP relay on R1's interface connected to the PC so that the Router is aware that if it receives a DHCP DISCOVER message, it is supposed to forward it towards the DHCP server address. Thus, considering we have a static route connecting R1 and R3, we have to configure IP-helper address (DHCP RELAY) so that R1 can route the DHCP DISCOVER MESSAGE towards the DHCP server.

a. Destination MAC address is R2's g0/0 interface and source MAC address is R1's g0/0 interface (LAN segment connection between R1 and R2).

b. The source IP address is g2/0's IP address configured on R1 that is acting as DHCP Relay agent for the PC. The destination IP address in DHCP server's IP address which will be routed through R2 because of static route configuration.

3. This is the DHCP DISCOVER MESSAGE being send from R2 to R3

a. The source MAC address is g2/0's MAC address and destination is R3's g0/0's MAC address (LAN segment connection between R2 and R3)

b. The source IP address and Destination IP address remain the same.

4. DHCP server has got the DHCP DISCOVER message and now it has to decide which IP address it should offer the PC out of its DHCP pool.

a. The decision of which IP address it should OFFER the client PC also involves ARP process. The DHCP server picks out an IP address out of its DHCP pool and then it sends an ICMP message to it for ensuring that the IP address is not being used by some other client in the network. So, if it recieves no response from that chosen address it decides that it is going to offer the PC that address. In the above wireshark capture we can see that the DHCP server chose 192.168.10.2 and then it performed and ARP Request to find the destination.

ARP( Address Resolution Protocol )

ARP Request - The source MAC address is R3's g0/0 interface and the destination MAC address is all F's (Broadcast Destination MAC address)

ARP Reply - R2 knows the destination to 192.168.10.0 network even though it is not directly connected to the network, so it acts a PROXY ARP and replies to PC with it's own MAC address, the next hop mac address of the PC which will be R2's g2/0 interface.

Proxy ARP is a technique by which a proxy device on a given network answers the ARP request for an IP address that is not on that network. The proxy is aware of the location of the traffic's destination and offers its own MAC address as the destination.

I will dive a little more on routing and switching of the packets, after the completion of DHCP process..

5. Now, that it has been confirmed that no device in the network has an ip address of 192.168.10.2, DHCP Server will send a DHCP OFFER packet to the PC which the PC can choose to accept or deny because their might be a case where we have multiple DHCP servers in our network and the PC gets an offer from them as well so if the PC accepts an OFFER, it will send a DHCP REQUEST which is broadcasted to the local segment as well as sent to the DHCP Server to let it know that it has accepted the offer from the DHCP server. If, their are multiple DHCP servers in the network, it will also be sent to them to let them know this specific ip address OFFER has been accepted from a specific DHCP server. Now, a DHCP ACK ( acknowledgment ) will be sent from the DHCP SERVER acknowledging that now one address has been issued from its DHCP pool.

DHCP DORA process is successfully completed, and PC has got an ip address.