ARP – Address Resolution Protocol – IP to MAC Binding, ARP is used to get the mac address of a host based on its IP Address or vice versa.
MAC – MAC address in a unique identifier assigned to network interfaces by manufacturing vendors
Please see the below example shows how the ARP & MAC play a role in host-to-host communication
Scenario – PC1 need to ping PC2, What will be SRC-DST IP as SRC-DST Mac in the IP packet at different hops (PC1, R1, R2, PC2)
Solution –
PC1 & PC2 are in a different IP Network so PC1 will need to send the packet to the subnet gateway which is configured as 30.1.1.1, PC1 will need the MAC address for the gateway IP(30.1.1.1) to send the packet, PC1 will send ARP request to get the MAC address & Router R1 will respond to PC1 with its MAC address for the interface connected to PC1. Once PC1 gets the mac address for the gateway, it will send a ping packet to PC2 via R1, please see below how will be the IP-MAC info be placed in the IP packet.
Note- PC2 will perform the same ARP to get the Router R2 mac configured as PC2 gateway.
When PC1 sends a ping packet to PC2, the packet at PC1 will have the below specified src-dst IP/MAC
PC1 – src-ip-30.1.1.11 // dst-ip-40.1.1.1 // src-mac – AAAA.AAAA.AA11//dst-mac-AAAA.AAAA.AAA1
When the packet reaches the router R1, R1 will send the packet to R2, Packet sent from R1 will have details as below.
R1 – src-ip-30.1.1.11 // dst-ip-40.1.1.1 // src-mac – CCCC.CCCC.CCC1//dst-mac-CCCC.CCCC.CCC2
When the packet reaches the router R2, R2 will send the packet to PC2, Packet sent from R2 will have details as below.
R2 – src-ip-30.1.1.11 // dst-ip-40.1.1.1 // src-mac – BBBB.BBBB.BBB1//dst-mac-BBBB.BBBB.BB11
When the packet reaches PC2, PC2 will respond back to the ping request to R1, Packet sent from PC2 will have details as below.
PC2 – src-ip-40.1.1.1 // dst-ip-30.1.1.11 // src-mac – BBBB.BBBB.BB11//dst-mac-BBBB.BBBB.BBB1
When the packet reaches the router R2, R2 will send the packet to R1, Packet sent from R2 will have details as below.
R1 – src-ip-40.1.1.1 // dst-ip-30.1.1.11 // src-mac – CCCC.CCCC.CCC2//dst-mac-CCCC.CCCC.CCC1
When the packet reaches the router R1, R1 will send the packet to PC1, the packet at R1 will have the below specified src-dst IP/MAC
PC1 – src-ip-40.1.1.1 // dst-ip-30.1.1.11 // src-mac – AAAA.AAAA.AAA1//dst-mac-AAAA.AAAA.AA11
Finally, the ping response will be returned to PC1 with a successful ping response.
Note- We have considered R1 & R2 static routes in place in the article so we can see the info only from the ARP-MAC perspective.
I hope this article is helpful in understanding the usage of ARP-MAC in traffic flow. Please add comments if any additional information should be added.