2

I've been trying to figure out this for some time, but I'm quite lost.

Assume you would have 3 networks -> A (PC0), B (PC1) and C enter image description here

How would ARP behave, if it already knew all MAC addresses from the first interaction between PC0 and PC1, and then the PC1 with the same MAC address would be moved from network B (in the middle) to network C (on the right side). Would it try to first reach network B, because of the MAC address in the ARP table?

Thanks a lot!

1
  • 1
    Do you really mean to have four routers called R17, R17(1), R17(2) and R17(4)?
    – jonathanjo
    May 2 at 17:58

4 Answers 4

4

The IPv4 address of the moved device would change, so it would be a completely different ARP table entry.

Remember, the ARP table is indexed by the IPv4 address, so trying to communicate would result in a new ARP request for the MAC address of new IPv4 address. If the IPv4 address is on a different network, the source host will use the ARP entry of its configured gateway to that network.

MAC addresses are only relevant or seen on the network to which they are directly connected. The MAC address of a host on a different network is not known by the source host.

2
  • Thanks a lot for your answer! So just to clarify, if the PC0 (A) and PC1 (B) ARP tables would be filled from the previous interaction, how would router on top (which connects A and B) which was not connected to now moved device - only communicated with router on the network of that device - find out about the change of the device location? And also, how would look the initial new ARP requests needed to maintain the connection between those two PCs if the PC1 was moved either to Network C or even A?
    – Adrian P.
    Apr 29 at 1:27
  • The router does not know or care. Traffic on the same network does not pass throgh a router, a routers strip the frame off the packet, losing any MAC addressing, in order to route the packet by IP address. ARP requests are only for devices on the same network; either the destination on the same network, or the router for a device on a different network.
    – Ron Maupin
    Apr 29 at 1:30
3

It seems that you have a conceptual problem, so I'm going to take it back to basics:

Ethernet can be thought of as a bus, which the orginal thickwire Ethernet more or less was. Each node on the network can communicate directly with another by sending a frame to it with the destination MAC address in the packet (source address there too, of course).

The beauty of Internet Protocol (or any network layer protcol) is that allows you communicate with a system that is more than one hop away. I often use the analogy of an airline ticket: you may be able to fly direct, or there may be more than one leg but it's the same process to book the flight either way. When you get to the airport you look at the boarding screen to see what the gate number is for your next leg (which is a rough analogy for ARP lookup).

The point is, in a routed network, the ARP information is only good for one hop. The top router only knows the MAC addresses of the red interfaces out Routers A,B,C.

So, what happens if you move the PC from network B to C? The answer is that you had better (either manually or automatically) assign it an IP address appropriate for that network, otherwise it won't work. The top router then sees an address for network C and knows how to route the packets. In my analogy, fly to the right airport, then worry about the gate numbers.

2

You're mixing up your ethernet layer and your IP layer.

Remember that ARP is a protocol where a host broadcasts "who has IP address x?" on a given ethernet, and (usually) receives an answer from that host in the form "x is on ethernet address X". Additionally, to save time, when they bring up an interface, most hosts will send out "gratuitous ARP" and say "I am here", to refresh the caches of locally connected devices.

Here is your situation with your routers relabelled for clarity.

  • R1 has three interfaces each with an ethernet address A, B, C to which hve been given three IP addresses, a, b, c (perhaps 10.0.1.1, 10.0.2.1, 10.0.3.1)

  • R2 has two interfaces with ethernet address D and E, and IP addresses d and e (10.0.1.2 and 10.1.0.1)

  • R3 has two interfaces with ethernet address F and G, and IP addresses f and g (10.0.2.2 and 10.2.0.1)

  • R4 has two interfaces with ethernet address H and I, and IP addresses h and i (10.0.3.2 and 10.3.0.1)

  • PC1 has ethernet address P and IP address p (10.1.0.99)

  • PC2 has ethernet address Q and IP address q (10.2.0.99)

          R1
      a/ b| c\
      /   |   \
    d/   f|   h\
    R2    R3   R4
    e|   g|
     |    |
    p|   q|
    PC1   PC2
    

When a packet goes from PC1 to PC2, the sequence is:

  1. PC1's routing table says "send all to default gateway" which is configured to be e.
  2. PC1 sends ARP for e; R2 answers with E.
  3. PC1 sends the packet with source IP address p, destination IP address q, wrapped in an ethernet frame with source P and destination E, the ethernet address of R2. Note that while the destination IP address is to the actual recipient, the destination ethernet address is to the nearside of the next hop. This is usually the source of any confusion
  4. Packet is received by R2, whose routing table says q is reached via R1 on a.
  5. R2 sends ARP for a; R1 answers with A.
  6. R2 sends the packet with the same IP addresses as previously, but in an ethernet frame with source B and destination F.
  7. R3 repeats the process, sees that q is on a local network, and sends ARP for q, PC2 answers with Q.
  8. R3 sends packet with the same IP addresses as previously, but in an ethernet frame with source G and destination Q.

That's all the case when everything is connected as described. If you unplug PC2 from that network and put it into the bottom of R3 without changing its IP address, then everything will be the same up to step 7.

Don't ask "will it try" something. Ask instead: What do the rules make each device do?

  1. R3 repeats the process, sees that q is on a local network, and sends ARP for q, but PC2 doesn't answer because it's not there.
  2. R3 will time out and give up on this packet. It might send a ICMP Destination Unreachable back to PC1.

The summary is that nothing will ARP for an IP address it doesn't think is local to one of its networks.


PS. There are obscure "proxy ARP" setups which don't work like this, but I haven't seen one since the last century.

1

Since you have a router, or 3 routers, between PC0 and PC1, PC0 would not learn PC1's mac address at all.

Most likely your PC0 would be configured to send all packets to its default gateway - the router (port) it is connected to. The only MAC address that PC0 needs to know would be MAC address of the router port.

If your routers were actually bridges, then nothing would change for PC0.

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.