Understanding ARP: Your Guide to Efficient Network

Understanding ARP: Your Guide to Efficient Network

Ehsan Ghasisin Ehsan Ghasisin
11 minute read

At the heart of efficient network communication lies the Address Resolution Protocol (ARP). It works in conjunction with Media Access Control (MAC) addresses, which are unique identifiers assigned to network interface cards. While MAC addresses manage local communication on the hardware layer, ARP bridges the gap between these MAC addresses and the logical IP addresses used by devices to communicate across networks. This article dives into the inner workings of ARP and explains how it ensures seamless data flow within your network.

While MAC addresses handle communication on a hardware level, there’s a need for a system to link these physical addresses with the virtual IP addresses used at the Network Layer (Layer 3). Enter the Address Resolution Protocol, a key player in translating IP addresses into MAC addresses, ensuring your data finds its way to the correct destination within IPv4 networks.

Understanding MAC Addresses

In this article, we will discuss the Address Resolution Protocol. But before doing so, we need to know what Physical addresses are and the difference between physical and virtual addresses.

 When we talk about virtual addresses, we mean IP addresses. IP addresses work on Layer 3 of the OSI model (Network Layer). When we talk about physical addresses, we mean Hardware addresses or Media Access Control (MAC) that work on Layer 2 of the OSI model (Data Link).

MAC, a sublayer of the Data Link Layer within the OSI model, is essential for controlling access to physical networks like Ethernet or Wi-Fi. It controls access to the network medium, such as Ethernet or Wi-Fi, to ensure that multiple devices can communicate on the same network (same IP subnet) without causing collisions or interference.

What is an MAC Address

MAC address is a unique identifier assigned to a network interface controller (NIC) for use as a network address in communications within a network segment. It is a hardware address typically assigned by the manufacturer of the network interface card or device.

MAC addresses are essential for the functioning of the OSI model's Data Link Layer, especially in Ethernet and Wi-Fi networks. Each MAC address is a 48-bit (6-byte) number, usually represented in hexadecimal format. The address is divided into two parts: the first half (24 bits) is the Organizationally Unique Identifier (OUI), which identifies the manufacturer or vendor of the network interface, and the second half (24 bits) is the unique identifier assigned by the manufacturer to the specific device.

MAC addresses are used to address and deliver data frames within a local network segment. They provide a way for devices to uniquely identify each other on the network, facilitating communication and data transfer. MAC addresses are often used in network administration, security, and troubleshooting tasks.

Types of MAC Addresses

MAC addresses can be classified into several types based on their characteristics and usage. Common types include:

MAC Address Types

1. Unicast MAC Address: This is the most common type of MAC address. It uniquely identifies a specific network interface card (NIC) on a network. Unicast addresses are used for one-to-one communication between two devices.

2. Multicast MAC Address: Multicast MAC addresses are used for one-to-many communication. Frames sent to a multicast MAC address are delivered to multiple devices on the network that are subscribed to the multicast group associated with that address.

3. Broadcast MAC Address: The broadcast MAC address is a particular type of MAC address that is used for one-to-all communication. Frames sent to the broadcast MAC address are delivered to all devices on the same network segment.

4. Virtual MAC Address: Virtual MAC addresses are used in technologies such as virtualization and clustering to provide a unique MAC address to each virtual machine or cluster node. These addresses are typically managed by software and may not correspond to a physical network interface card.

How ARP Works and Its Purpose

In IPv4, there is no inherent correlation between physical MAC and virtual IP addresses. If a device knows one type of address but needs to communicate with another device, it must resolve the other address. This is precisely what the Address Resolution Protocol accomplishes. 

What is The Purpose of The Address Resolution Protocol?

It is a communication protocol that maps an IP address to a physical MAC address on a local area network (LAN). When a device wants to communicate with another device on the same network (same IP subnet), it typically knows the IP address of the target device. Still, the corresponding MAC address must be determined before sending data packets. The ARP process effectively resolves this, ensuring devices can communicate seamlessly within the same IP subnet.

The ARP Process Explained

The requesting device sends an ARP request message to the network's broadcast address containing the unique IP address it seeks to map to a MAC address. In this step, the sender defines its IP address, MAC address, and the IP address of the destination, but it sets the MAC address of the destination to the broadcast address.

Every device on the network receives this request, but only the device with the matching IP address responds.

The device with the matching IP address replies with an ARP packet containing its MAC address. This reply is a unicast frame.

Upon receiving the ARP response, the device updates its ARP cache table with the new MAC address, facilitating future communications over the Ethernet network.

After this process, the requesting device can use the MAC address to directly address data packets to the local network's target device.

Address Resolution Protocol is a fundamental TCP/IP protocol suite used extensively in Ethernet networks. It helps ensure data packets are delivered to the correct destination device within the same network segment.

Types of Address Resolution Protocol

In network communications, Address Resolution Protocol (ARP) exists in several forms, each serving different functions within a network. Proxy ARP facilitates communication across different network segments without direct routing, while Gratuitous ARP is used to update ARP tables or detect IP conflicts without prior requests.

Though Reverse (RARP) and Inverse (InARP) versions are largely obsolete, understanding these protocols is invaluable for troubleshooting legacy systems that do not employ modern DHCP services. These ARP variations ensure robust and flexible network interactions, adapting to both current and legacy networking environments.

Proxy ARP is commonly used when devices in one network segment need to communicate with devices in another without routing or when routing is not directly possible due to network configuration or limitations.

However, instead of providing the MAC address of the target host, the router responds by pretending to be the destination and delivers its own MAC address instead. When the source device sends the packets to the destination, they are sent to the destination router, which forwards them to the destination device (within the local network).

Gratuitous ARP is a special type of ARP message in IPv4 networks where a device sends out an ARP request packet for its IP address. In contrast, a gratuitous ARP response message announces the sender's hardware address and associated IP.

This preemptively updates Address Resolution Protocol tables without a prior request. Instead, it is a broadcast message containing the sender's IP and MAC to update the tables on other devices in the network. Gratuitous ARP serves several purposes in network management and troubleshooting:

1. Address Conflict Detection: It can detect IP address conflicts. If a device receives a gratuitous ARP announcing an IP address already in its table but with a different MAC address, it indicates an IP address conflict.

2. Address Resolution Cache Update: It helps to update Address Resolution Protocol caches on other devices in the network with the correct MAC address associated with the sender's IP address.

3. Network Failover: Another common use is in high availability configurations, such as when a network interface fails over to a standby device. The standby device can send a gratuitous ARP with the IP address of the failed device to inform other devices on the network that it is now responsible for handling traffic to that IP address.

4. Reverse ARP(RARP): It is an obsolete protocol used by computers to request an IPv4 address for the RARP server, which is then replaced by new protocols such as DHCP and BOOTP.

5. Inverse ARP(InARP): InARP uses a MAC address to find an IP address as a name. It is just the inverse. BOOTP and DHCP replaced InARP, but InARP is used in ATM and Frame Relay networks.

Security: Understanding ARP Poisoning

Address Resolution Protocol poisoning, also known as ARP spoofing, involves attackers sending fake ARP messages to link their MAC address with a known IP address, typically of an ARP gateway router, to intercept data. In poisoning attacks, the attacker sends forged or spoofed messages to associate their own MAC address with the IP address of another device on the network, typically the default gateway or another legitimate host.

ARP Poisoning

Once the ARP tables of the targeted devices are poisoned, they will send network traffic intended for the legitimate IP address (default gateway) to the attacker's MAC address instead because both are in the same IP subnet. This allows the attacker to intercept, modify, or redirect the traffic as desired. ARP poisoning can be used for malicious purposes, such as eavesdropping sensitive information, performing man-in-the-middle attacks, or launching denial-of-service attacks.

To prevent ARP poisoning attacks, network administrators can implement measures such as ARP spoofing detection tools, static ARP entries, or cryptographic protocols like ARPSEC. Additionally, using secure network protocols and regularly monitoring network activity can help mitigate the risk of ARP poisoning.

Managing Network Communication: The ARP Table

The Address Resolution Protocol table (or ARP cache) is a structure on network devices (computers, routers, switches) that temporarily stores mappings between IP addresses and MAC addresses on the local network.

When a device wants to communicate with another device on the same network (same IP subnet), it checks its ARP table to see if it already has the MAC address corresponding to the destination IP address. If the MAC address is not found in the table, the device typically sends out an ARP request packet, asking, "Who has this IP address?" The device with the corresponding IP address then responds with its MAC address, and this information is stored in the ARP table for future reference.

The table entries are temporary. They expire after a set time or if the device's network configuration changes (such as after a reboot).

For example, we can check the ARP table in the FortiGate firewall via the command  get system arp  via CLI:

Check the table in the FortiGate firewall

On Cisco devices, we can use the command show arp.

Cisco device using the command show arp

On a Windows and Linux system, we can use the ARP command in the terminal.

Windows and Linux system ARP command

ARP tables are essential for efficient communication on local networks, as they allow devices to quickly and accurately determine other devices' MAC addresses without repeatedly broadcasting ARP requests for the same IP addresses.

Neighbor Discovery Protocol: The IPv6 Solution

Neighbor Discovery Protocol

NDP stands for Neighbor Discovery Protocol. It's a core protocol in the IPv6 and provides several essential functions in IPv6 networks:

1. Neighbor Discovery: NDP is responsible for determining the link-layer addresses (equivalent to MAC addresses in Ethernet) of neighboring nodes on the same network segment. It replaces the Address Resolution Protocol used in IPv4.

2. Router Discovery: NDP allows hosts to discover routers on the local link. Routers periodically send out Router Advertisement (RA) messages, which hosts use to configure their IPv6 addresses and default gateways.

3. Neighbor Unreachability Detection (NUD): NDP includes mechanisms for detecting when a neighboring node becomes unreachable. This ensures more reliable communication by promptly detecting and reacting to changes in network topology.

4. Duplicate Address Detection (DAD): Before assigning an IPv6 address to itself, a node performs Duplicate Address Detection to ensure that the address is not already in use on the local link. This helps prevent address conflicts.

5. Prefix Discovery: NDP facilitates the discovery of network prefixes. Hosts use Router Advertisement messages to determine the valid prefixes for autoconfiguration.

6. Parameter Discovery: NDP allows hosts to discover various network parameters, such as the Maximum Transmission Unit (MTU), hop limit, and hop-by-hop options.

Conclusion

NDP performs the essential functions of Address Resolution Protocol in IPv4 networks, ensuring seamless communication within IPv6 environments. Like ARP, it provides the means for address resolution, router discovery, and more, forming a critical foundation for IPv6 networking. NDP demonstrates how the core principles behind ARP – address resolution, device discovery, and network awareness – have evolved to support the more complex address structure of IPv6.

This contrast between ARP and NDP highlights the continuous evolution of networking protocols. As technology advances, understanding these foundational protocols remains crucial for troubleshooting and optimizing both current and future networks. Are your networks ready to leverage the full capabilities of NDP?

« Back to Blog

Just added to your wishlist:
My Wishlist
You've just added this product to the cart:
Checkout