6

If I sent an ARP request to the target machine, which is in over Internet and has 2 routers between, what will the target IP address on my request (0001) packet be? Will it be the Router IP address, which is my gateway, or will it be the target machine address?

Example: Lets say I want to do an ARP request from Computer A to Computer C, and the scheme is below.

Router1 => Internet => Router2 => Computer C 

What would be the target IP address, Router1 or Computer C?

Please help me with this. I am kind of confused.

Thank you.

Ryan Foley
  • 5,539
  • 4
  • 25
  • 44
ebyrock
  • 151
  • 2
  • 2
  • 5

3 Answers3

10

Using your original diagram:

OP's original diagram

When Computer A tries to communicate with Computer C, the following steps resolve Router 1's software-assigned address to its hardware-assigned media access control address: Based on the contents of the routing table on Computer A, IP determines that the forwarding IP address to be used to reach Computer C is through Router 1, the IP address of its default gateway. Host A then checks its own local ARP cache for a matching hardware address for Router 1.

If Computer A finds no mapping in the cache, it broadcasts an ARP request frame to all hosts on the local network with the question "What is the hardware address for Router 1?" Both hardware and software addresses for the source, Host A, are included in the ARP request.

Each host on the local network receives the ARP request and checks for a match to its own IP address. If a host does not find a match, it discards the ARP request.

Router 1 determines that the IP address in the ARP request matches its own IP address and adds a hardware/software address mapping for Host A to its local ARP cache.

Router 1 then sends an ARP reply message containing its hardware address directly back to Host A.

When Host A receives the ARP reply message from the router, it updates its ARP cache with a hardware/software address mapping for Router 1.

Once the media access control address for Router interface 1 has been determined, Host A can send IP traffic to Router 1 by addressing it to the Router interface 1 media access control address. The router then forwards the traffic to Host C through the same ARP process as discussed in this section.

This was updated from a Microsoft Technet article to match your example. Another reference with a good example is Juniper networks description.

In a nutshell Host A when communicating with external IP addresses/hosts will look to its default gateway for external IP resolution and assume traffic to Host C will be forwarded by this gateway.

Mike Pennington
  • 30,049
  • 12
  • 82
  • 153
Mike Naylor
  • 421
  • 1
  • 4
  • 14
4

It all depends on how the subnet masks of A and R1-1 are set, and if the configuration of R1 include the proxy-arp.

In a canonical configuration A and R1-1 must share a same subnet mask and their address must both match the same subnet. When this happens, C in known to A as "not belonging to the same (sub)network", so a router must be found in A routing table matching the C address. In the most common case R1-1 is know as the default gateway, so if the MAC of R1-1 is not yet known and ARP is sent to discover it. The details are in this answer.

But It is also possible a different scenario: If A's subnet-mask is so short that even C's IP matches it (and R1 interfaces are properly configured with mask that properly partition the networks), then A believes C is on the same LAN, and tries to send an ARP to it.

R1 see the ARP and knows that such a frame will never reach C that he knows (because of its more proper subnet masks) to be behind him, and hence he will reply as C, but giving R1-1 MAC address. This reply (known as "proxy ARP") in fact fools A, that now believes C is on his own network having R1-1 MAC address. So it will talk to C by sending packet with C IP and R1-1 MAC just like it will result from normal routing process.

-2

In the above topo A --- R1 ---- R2 ---- C

Once R2 receives the packet from R1 -- it will be sending out an ARP request to find out C's MAC address and only after C's reply will it be able to forward the packet to C.

Is that correct?