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.

Address Resolution Protocol 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_request.png

Address Resolution Protocol (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 frames bits.

arp_response.png

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.

arp_table.png
  • 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.
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.