What is ARP (Address Resolution Protocol)?
ARP (Address
Resolution Protocol) it’s a communication protocol. Networking devices used for
discovering MAC (media access control) addresses, associate with an IPv4 address (internet
layer address), and map the MAC addresses to IPv4 addresses this mapping is done
dynamically and stored in the ARP cache. ARP works between layer 2 and layer 3 of
the OSI because the MAC address exists on the data link layer and the IP address exists
on the network layer.
How does ARP
work?
Whenever a
fresh PC (computer) connects to LAN, it will assign an IP address statically or
dynamically to use for identity and for communication. When an incoming packet destined
for a host machine on a particular LAN arrives at a gateway, the gateway is
going to ask ARP for a MAC address that matches the IP address. There is a table
called ARP cache in this table ARP mapping record. Whenever a host asks for a MAC address in order
to send a packet to another host in the LAN, ARP looks it the cache to see if their IP
to MAC mapping translation is already stored. If it’s already stored then no need
for ARP broadcast but if there is no translation stored then ARP sends a request
for the network address (does anybody knows this IP address)
ARP sends
broadcast a request packet to all the hosts on the LAN network and asks is
there any host using this particular IP address please let me know. When a host
recognizes oh it’s my IP address it will immediately send a unicast reply so
ARP can update and store it in the cache table and now communication can proceed.
What happens
if the host (machine) doesn’t know its own IP address?
In this situation, RARP (Reverse ARP) protocol is used for discovery. next chapter we are going to see proxy ARP and RARP.
What is ARP
cache?
ARP cache is
a table where mapping or translation is stored. The size of the ARP cache is
limited and from time to time cleansed its entire entries to free its space. Mappings
are stored for a few minutes. ARP frequently updates when a host changes their
requested IP address.
ARP Commands
we used arp -a command to display the ARP table. It shows all the entries of the ARP cache or table.
arp -g: This
command works the same as the arp -a command.
we use arp -d command when we want to delete an entry from the ARP table for a
particular interface.
No comments:
Post a Comment