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.

1
  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer.
    – Ron Maupin
    Jan 3, 2021 at 21:59

3 Answers 3

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.

4
  • 1
    Thank you for your reply. If ARP cache is empty, Computer A would do ARP request to Router 1 to find Gateway, so Target IP Address would be the Router 1 IP Address in the first request packet. Am i right?
    – ebyrock
    Mar 17, 2014 at 13:15
  • Yes, if the ARP on computer A is empty it would look for it's default gateway and send an ARP Request for Router 1, then forward traffic for Host C to Router 1. Mar 17, 2014 at 13:16
  • No problem, hope this helps. Mar 17, 2014 at 13:21
  • I'm curious. How does this work with private IP addresses, set by the router, given that the destination's MAC address is unknown? Feb 4, 2018 at 21:34
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
  • Thank you Emilio. Yes, my question was referring to diagram in Mike's answer. IP-A (Computer A) and R1-1 are in the same subnet. And the ARP cache is empty. So IP-A would first make a ARP request to its default gateway because IP-C (Computer C) is in different subnet. This is my understanding from your and Mike's response. So what will happen next? Can you explain? Thank you.
    – ebyrock
    Mar 19, 2014 at 0:59
  • Ip pakect from A to C are formed by wrapping them into an ethernet frame from a to r1-1. (lowercase means MAC address, here). R1 receives the frame, opens it and finds it is to C and -looking its own routing tables, send it to its next hop towards C network. In the last hop, R2 will finally send A to C (at IP level) from r2-2 to c (at MAC level) Mar 19, 2014 at 7:35
-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?

6
  • An ARP request is in a layer-2 broadcast frame, which we all know will not cross a router since frames are stripped off at the router.
    – Ron Maupin
    Feb 12, 2016 at 4:39
  • I understand that. What I meant is .... R2 and C are in the same network. But since C has never sent out a packet before, R2 will not have C's info. so in order to forward A's packet to C, R2 will need to sent out an ARP request for C's MAC address.
    – user22834
    Feb 12, 2016 at 8:27
  • The OP is trying to send an ARP request across the Internet. It will never leave the network where Computer A is to travel to Computer C, so R2 will never see it in order to try to send it to Computer C. In fact, I don't think Computer A will even try to generate an ARP request for an address not on its network. What you describe would be for a regular packet traveling across the Internet, not an ARP request.
    – Ron Maupin
    Feb 12, 2016 at 8:32
  • Nopes, what I said was, A sends an ARP for R1. R1 sends an ARP for R2. R2 in turn sends an ARP for C.
    – user22834
    Feb 12, 2016 at 11:56
  • From your answer: "Once R2 receives the packet from R1..." My point is that in the question, which you should be answering, R1 will not be sending a packet to R2 since the original packet was wrapped in in a broadcast frame. From your comment: "R1 sends an ARP for R2." Again, ARP doesn't work on the Internet, and in the question you are answering, R! and R2 are separated by the Internet. You seem to be answering a completely different question than the one asked. I suggest you reread the question, answer accordingly, and whoever has voted you down, or will in the future, may reverse it.
    – Ron Maupin
    Feb 12, 2016 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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