ARP Mapping: in A Frame With The MAC Address of The Local Host, or Next-Hop Router
ARP Mapping: in A Frame With The MAC Address of The Local Host, or Next-Hop Router
ARP Mapping: in A Frame With The MAC Address of The Local Host, or Next-Hop Router
Layer 3
addresses are used for indirectly connected devices in an internetwork environment
In order for devices to be able to communicate with each when they are not part of the same network, the
48-bit MAC address must be mapped to an IP address. Some of the Layer 3 protocols used to perform the
mapping are:
• Address Resolution Protocol (ARP)
• Reverse ARP (RARP)
• Serial Line ARP (SLARP)
• Inverse ARP
ARP Mapping
Even though the ip packets are addressed using ip address haredware addresses must be
actually transport data from one host to another. Address Resolution Protocol is used to map
OSI level 3 IP address to OSI level 2 MAC address. A Router has a table of currently used ARP
entries. Normally the table is built dynamically, but to increase network security it can be built
statically by means of adding static entries.
Address Resolution Protocol (ARP) is a network layer protocol used in IP to convert
IP addresses into MAC addresses. A network device looking to learn a MAC
address broadcasts an ARP request onto the network. The host on the network that
has the IP address in the request replies with its MAC (hardware) address. This is
called ARP mapping, the mapping of a Layer 3 (network) address to a Layer 2(data link)
address.
Because the network layer address structure in IP does not provide for a simple
mapping to data-link addresses, IP addresses use 32 bits, and data-link addresses
use 48 bits. It is not possible to determine the 48-bit data-link address for a host
from the host portion of the IP address. For packets destined for a host not on a
locally attached network, the router performs a lookup for the next-hop router’s
MAC address. For packets destined for hosts on a locally attached network, the
router performs a second lookup operation to find the destination address to use in
the data-link header of the forwarded packet’s frame, as illustrated in Figure 6-18.
After determining for which directly attached network the packet is destined, the
router looks up the destination MAC address in its ARP cache. Recall that ARP
enables the router to determine the corresponding MAC address when it knows
the network (IP) address. The router then forwards the packet across the local network
in a frame with the MAC address of the local host, or next-hop router.
The result of this final lookup falls into one of the three following categories:
■ The packet is destined for the router itself—The IP destination address
(network and station portion combined) corresponds to one of the IP addresses
of the router. In this case, the packet must be passed to the appropriate
higher-layer entity within the router and not forwarded to any external port.
■ The packet is destined for a known host on the directly attached network—
This is the most common situation encountered by a network router.
The router determines the mapping from the ARP table and forwards the
packet out the appropriate interface port to the local network.
■ The ARP mapping for the specified host is unknown—The router initiates
a discovery procedure by sending an ARP request determining the mapping
of network to hardware address. Because this discovery procedure takes
time, albeit measured in milliseconds, the router might drop the packet that
resulted in the discovery procedure in the first place. Under steady-state conditions,
the router already has ARP mappings available for all communicating
hosts. The address discovery procedure is necessary when a previously
unheard-from host establishes a new communication session.
ARP Processing
q ARP responses are cached.
q Entry replaced when
q Cache table fills up (oldest removed)
q After some time, e.g., 20 minutes
q Sender’s address binding is stored in
the cache of the
target
Reverse ARP (RARP)
q What is the IP address of a given
hardware address?
q Used by diskless systems to find their
own IP address.
q Need RARP server to respond.
Inverse ARP
q Used on point to point links
q Find IP address of the host on the other
end
q Used in frame relay and ATM
When the destination device lies on a remote network, one beyond another Layer 3 device, the process is
the same except that the sending device sends an ARP request for the MAC address of the default gateway.
After the address is resolved and the default gateway receives the packet, the default gateway broadcasts
the destination IP address over the networks connected to it. The Layer 3 device on the destination device
network uses ARP to obtain the MAC address of the destination device and delivers the packet.
ARP Caching
Because the mapping of IP addresses to media access control (MAC) addresses occurs at each hop (Layer 3
device) on the network for every datagram sent over an internetwork, performance of the network could be
compromised. To minimize broadcasts and limit wasteful use of network resources, Address Resolution
Protocol (ARP) caching was implemented.
ARP caching is the method of storing network addresses and the associated data-link addresses in memory
for a period of time as the addresses are learned. This minimizes the use of valuable network resources to
broadcast for the same address each time a datagram is sent. The cache entries must be maintained because
the information could become outdated, so it is critical that the cache entries are set to expire periodically.
Every device on a network updates its tables as addresses are broadcast.
There are static ARP cache entries and dynamic ARP cache entries. Static entries are manually configured
and kept in the cache table on a permanent basis. Static entries are best for devices that have to
communicate with other devices usually in the same network on a regular basis. Dynamic entries are added
by Cisco software, kept for a period of time, and then removed.
Static and Dynamic Entries in the ARP Cache
Static routing requires an administrator to manually enter into a table IP addresses, subnet masks, gateways,
and corresponding Media Access Control (MAC) addresses for each interface of each device. Static routing
enables more control but requires more work to maintain the table. The table must be updated each time
routes are added or changed.
Dynamic routing uses protocols that enable the devices in a network to exchange routing table information
with each other. The table is built and changed automatically. No administrative tasks are needed unless a
time limit is added, so dynamic routing is more efficient than static routing. The default time limit is 4
hours. If the network has many routes that are added and deleted from the cache, the time limit should be
adjusted.
The routing protocols that dynamic routing uses to learn routes, such as distance-vector and link-state
routing protocols, are beyond the scope of this document
Devices That Do Not Use ARP
When a network is divided into two segments, a bridge joins the segments and filters traffic to each
segment based on Media Access Control (MAC) addresses. The bridge builds its own address table, which
uses MAC addresses only, as opposed to a router, which has an Address Resolution Protocol (ARP) cache
that contains both IP addresses and the corresponding MAC addresses.
Passive hubs are central-connection devices that physically connect other devices in a network. They send
messages out all ports to the devices and operate at Layer 1, but they do not maintain an address table.
Layer 2 switches determine which port is connected to a device to which the message is addressed and send
the message only to that port, unlike a hub, which sends the message out all its ports. However, Layer 3
switches are routers that build an ARP cache (table).
Reverse ARP
Reverse ARP (RARP) as defined by RFC 903 works the same way as the Address Resolution Protocol
(ARP), except that the RARP request packet requests an IP address instead of a media access control
(MAC) address. RARP often is used by diskless workstations because this type of device has no way to
store IP addresses to use when they boot. The only address that is known is the MAC address because it is
burned in to the hardware.
RARP requires a RARP server on the same network segment as the device interface.
Because of the limitations with RARP, most businesses use Dynamic Host Configuration Protocol (DHCP)
to assign IP addresses dynamically. DHCP is cost-effective and requires less maintenance than RARP. The
most important limitations with RARP are as follows:
• Because RARP uses hardware addresses, if the internetwork is large with many physical networks, a
RARP server must be on every segment with an additional server for redundancy. Maintaining two
servers for every segment is costly.
• Each server must be configured with a table of static mappings between the hardware addresses and
the IP addresses. Maintenance of the IP addresses is difficult.
• RARP only provides IP addresses of the hosts but not subnet masks or default gateways.
ARP Protocol
Machine A wants to send a packet to B, but A only knows B’s IP address
Machine A broadcasts ARP request with B’s IP address
All machines on the local network receive the broadcast
Machine B replies with its physical address
Machine A adds B’s address information to its table
Machine A delivers packet directly to B
ARP Caching
To reduce communication cost, computers that use ARP maintain a cache of recently
acquired IP-to-physical address bindings.
Each entry has a timer (usual timeout period is 20 minutes)
The sender’s IP-to-address binding is included in every ARP broadcast; receivers update
the IP-to-physical address binding information in their cache before processing an ARP
packet.
ARP is stateless, and most of operating systems update their cache when receiving an ARP
reply, regardless of whether they have actually sent out a request or not.
Gratuitous message (src IP = dest IP, operation code = 2:reply)
The same IP address is used for both source IP and dest IP. This is used during the
initialization of IP stack to find out whether the IP address is used by other host.
Whoever has the same IP replies (this message is a broadcast). Otherwise, every host
updates its cache.
4-2
Cisco Content Services Switch Routing and Bridging Configuration Guide
OL-4580-01
Address Mappings
Each host keeps a mapping table:
When a machine on a physical network
wants to
reach another host on the same physical
network (either first-hop router, or another
host),
it consults this table
How is this table maintained?
ARP
When the table doesn’t have the required
mapping, the host broadcasts a message
(to the
physical net) asking: who has this IP
address?
The appropriate host responds with its
physical
address (and inserts the requester in its
table)
All others listening who have either host
in their
table refresh their entries
Mao F04 4
Assumptions in ARP
Assumes that physical network can
broadcast
Not always true: e.g., ATM
Must find methods for these networks
- (e.g., ATMARP)
TargetMAC = MACA
TargetIP = IPA
ARP Cache
• Wish to avoid sending an ARP Request for every
data packet
• Solution: cache address mapping for reuse
– A caches the ARP Reply (MACB, IPB) mapping
– All hosts on LAN cache ARP Request (MACA, IPA) mapping
ARP Operation
Applications use a logical address (IP address) to identify
the destination host. The IP packets are encapsulated
into frames. The delivery of frames across links (source –
source, or source – router, router – router, …, router –
destination) is based on local addresses called physical or
MAC addresses. The mapping of IP addresses into
physical addresses is done through the Address
Resolution Protocol (ARP).