5

I am a quite a beginner in network engineering so please be nice. I am not sure I understand how ARP protocol works in some situation. For example, if we have following problem:

ARP cache is empty

  1. host1 (source) --> router1 (default)
  2. router1 (decision) -- > router2
  3. router2 (decision) --> host2 (destination)

Is ARP used in 1. , 2. or 3. or in all? Is ARP used between routers or only host and routers? And what if some router (like router1) is default for some host, is then ARP used?

5

Address Resolution Protocol (ARP) is used to resolve an IPv4 address (32 bit Logical Address) to the physical address (48 bit MAC Address). Network Applications at the Application Layer use IPv4 Address to communicate with another device. But at the Datalink layer, the addressing is MAC address (48 bit Physical Address).

How it works
Step 1: If a source device want to communicate with another device, source device checks its Address Resolution Protocol (ARP) cache to find if it already has a resolved MAC Address of the destination device. If it is there, it will use that MAC Address for communication.

Step 2: If ARP resolution is not there in local cache, the source machine will generate an Address Resolution Protocol (ARP) request message, it puts its own data link layer address as the Sender Hardware Address and its own IPv4 Address as the Sender Protocol Address. It fills the destination IPv4 Address as the Target Protocol Address. The Target Hardware Address will be left blank, since the machine is trying to find that.

Step 3: The source broadcast the Address Resolution Protocol (ARP) request message to the local network.

Step 4: The message is received by each device on the LAN since it is a broadcast. Each device compare the Target Protocol Address (IPv4 Address of the machine to which the source is trying to communicate) with its own Protocol Address (IPv4 Address). Those who do not match will drop the packet without any action.

Step 5: When the targeted device checks the Target Protocol Address, it will find a match and will generate an Address Resolution Protocol (ARP) reply message. It takes the Sender Hardware Address and the Sender Protocol Address fields from the Address Resolution Protocol (ARP) request message and uses these values for the Targeted Hardware Address and Targeted Protocol Address of the reply message.

Step 6: The destination device will update its Address Resolution Protocol (ARP) cache, since it need to contact the sender machine soon.

Step 7: Destination device send the Address Resolution Protocol (ARP) reply message and it will NOT be a broadcast, but a unicast in order to save network resources.

Step 8: The source machine will process the Address Resolution Protocol (ARP) reply from destination, it stores the Sender Hardware Address as the layer 2 address of the destination.

Step 9: The source machine will update its Address Resolution Protocol (ARP) cache with the Sender Hardware Address and Sender Protocol Address it received from the Address Resolution Protocol (ARP) reply message.

Machines at local network can't communicate if they don't know the MAC Address of each other. Neither Internal IP Address can be used for that. If a router wants to communicate with its client or with the other router then it must know the MAC Address of its client and the other router as well.

  • If the two routers are connected via ethernet, or some other layer-2 protocol that uses ARP, then, yes, the routers will use ARP to originally populate their ARP caches for those interfaces. – Ron Maupin Nov 18 '16 at 3:51
  • @RonMaupin Thanks for correcting. I was doubting my knowledge about connecting routers as I've never tried it. – defalt Nov 18 '16 at 4:04
  • To ethernet, routers are just another host. Routing is layer-3, but ethernet is a layer-1/2 protocol, which knows nothing about routing. – Ron Maupin Nov 18 '16 at 4:33
0

You really don't supply enough information to be able to answer the questions.

ARP is use by some layer-2 protocols to resolve the layer-2 address from the layer-3 address. Not all layer-2 protocols use ARP. For example, a host that needs to contact another host (a router is just another host to layer-2) on ethernet will use ARP, but a host that needs to connect to another host using PPP will not use ARP.

If, for instance, your two routers are connected via PPP (this is not uncommon), ARP will not be used for the second case, but if the two routers are connected via ethernet, then ARP will be used.

0

Lets assume all arp tables are initially empty (not very realistic but meh) and that all the links use Ethernet-like protocols.

  • Host1 looks up host2's IP address in it's routing table to determine the interface and next hop IP address. It doesn't find any better matches so it uses the default gateway.
  • Host1 looks up the next hop IP address (router1) in it's ARP table for the interface. It doesn't find a match.
  • Host1 queues the packet and sends out an ARP request looking for Router1.
  • Router1 replies to the ARP request.
  • Host1 updates it's ARP table dequeues the packet and sends it to router1
  • Router1 looks up host2's IP address in it's routing table to determine the interface and next hop IP address. It finds a match which says it should send the packet to router2.
  • Router1 looks up the next hop IP address (router2) in it's ARP table for the interface facing router2. It doesn't find a match.
  • Router1 queues the packet and sends out an ARP request looking for router2
  • Router2 replies to the ARP request.
  • Router1 updates it's ARP table, dequeues the packet and sends it to router2.
  • Router2 looks up host2's IP address in it's routing table to determine the interface and next hop IP address. It finds a match which says that host2 is on a local subnet. So the next hop IP address is the same as the destination address.
  • Router2 looks up the next hop IP address (host2) in it's ARP table for the interface facing host2. It doesn't find a match.
  • Router2 queues the packet and sends out an ARP request looking for host2
  • host2 replies to the ARP request.
  • Router2 updates it's ARP tables, deques the packet and sends it to host2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.