Address Resolution Protocol (ARP)
When the DHCP server running in the local router assigned the PC its IP address, it also let the PC know what the default gateway’s IP address is. So the PC knows the IP address of its default gateway, but it doesn’t know the MAC address of the default gateway. This is where ARP steps in to save the day.
The default gateway for a local network is the host that connects the local network to another network. In this example, the default gateway is the local router.
ARP Request
The Address Resolution Protocol (ARP) enables a local host to discover another local host’s MAC address corresponding to its IP address.
ARP creates a message that says, “if this is your IP address, send me your MAC address”.
The Link layer creates the frame header by adding its MAC address as the source and the broadcast MAC address as the destination. The frame is then sent to every host on the local network.
ARP Response
When the router and every other host on the local network receives the frame, they will look at the destination MAC address to determine if they should pay attention to the frame. They will all see the broadcast MAC address as the destination so all will open the message and read it. Once the other hosts see the message is an ARP request for an IP address other than their own, they will discard the frame and do nothing. The router will read the message, compare the IP address (the default gateway) to its own, and discover someone has sent it an ARP request. It is now required to send an ARP response.
It creates an ARP response message that includes its MAC address. The router’s Link layer then creates a frame header with the source and destination MAC addresses, adds it to the message, then sends it to its physical layer to transmit the frame bits.
ARP Table
When the requesting host receives the ARP response, it adds the MAC and IP address to its ARP table. The next time the host needs the MAC address for this IP address, it will find it in its ARP table and won’t need to generate another ARP request.
- Each node on a network maintains its own ARP table.
- ARP is a layer 2 protocol that references but does not use layer 3 IP addresses.