Where is ARP used?
We checked whats ARP on my previous blog ARP, now lets check where do we use ARP.First of all we need to understand, where do we use MAC/Layer 2 address and where do we use IP/Layer 3 address.
MAC address is used for communication with in a broadcast domain and IP address is used when communication happens between different broadcast domains
In below topology we have 3 broadcast domains 192.168.1.0/24 ,10.10.10.0/30 and 192.168.2.0/24
Lets consider below examples
A1 wants to ping A2 (Communication within a broadcast domains)
By looking at A2s IP address A1 can identify that A2 falls on same broadcast domain and to learn the MAC address it sends an ARP. This ARP will be broadcasted by Switch A and A2 can reply with its MAC address.
Same is the case when B1 wants to ping B2 or Router A wants to Ping Router B
Lets check how the ARP packet will looks like in these 2 cases.
ARP Request
Ethernet Header:
Source MAC : A1:A1:A1:A1:A1:A1
Destination MAC : FF: FF: FF: FF: FF: FF
ARP Packet:
Sender MAC Address: A1:A1:A1:A1:A1:A1
Sender IP Address: 192.168.1.1
Target MAC Address: 00:00:00:00:00:00
Target IP Address: 192.168.1.2
ARP Reply
Ethernet Header:
Source MAC : A2:A2:A2:A2:A2:A2
Destination MAC : A1:A1:A1:A1:A1:A1
ARP Packet:
Sender MAC Address: A2:A2:A2:A2:A2:A2
Sender IP Address: 192.168.1.2
Target MAC Address: A1:A1:A1:A1:A1:A1
Target IP Address: 192.168.1.1
A1 wants to ping B1 (Communication between different broadcast domains)
By
looking at B1s IP address A1 can identify that B1 falls on a different broadcast domain and to reach B1 it has to go via its default gateway. In this case A1 will not do an ARP for B1 but ARP for the default gateways -Router A MAC . This ARP
will be broadcasted by Switch A and Router A can reply with its MAC address.
ARP Request Ethernet Header:
Source MAC : A1:A1:A1:A1:A1:A1
Destination MAC : FF: FF: FF: FF: FF: FF
ARP Packet:
Sender MAC Address: A1:A1:A1:A1:A1:A1
Sender IP Address: 192.168.1.1
Target MAC Address: 00:00:00:00:00:00
Target IP Address: 192.168.1.254
ARP Reply
Ethernet Header:
Source MAC : R1:R1:R1:R1:R1:R1
Destination MAC : A1:A1:A1:A1:A1:A1
ARP Packet:
Sender MAC Address: R1:R1:R1:R1:R1:R1
Sender IP Address: 192.168.1.254
Target MAC Address: A1:A1:A1:A1:A1:A1
Target IP Address: 192.168.1.1
Now you may check how the ARP Packets for communication from Router A to B1
Hint: There will 2 ARP request/reply
Please leave your suggestions and questions as comments.
