How Arp Works Between 2 Routers on the Same LAN ?

erickafabianaerickafabiana Member Posts: 22 ■□□□□□□□□□
R1 and R2 are directly connected with an ethernet cross over cable in packet tracer with Ip Subnet 172.16.1.1/24 of R1 interface and 172.16.1.2/24 of R2 interface. R2 has a Lan/Broadcast domain that R1 is currently unaware of. The Ip subnet of this Lan is 192.168.1.0/24 with PC 1 connected to R2 via Crossover Cable. Pc1 Is configured with ip address 192.168.1.1 with Default Gateway of R2 interface 192.168.1.2. R1 wants to send a Packet To PC1 with it's source ip interface of 172.16.1.1 Destination Ip 192.168.1.1 of PC1. After R1 has found a match for route 192.168.1.0 with his own Outgoing interface. How does R1 get the destination mac of R2 ? How does arp specifically works in the of getting the destination mac address, i am confused between Proxy arp and arp ?

Comments

  • OctalDumpOctalDump Member Posts: 1,722
    ARP is layer 2, so that ARP works as normal between R1 and R2. For a Packet going R1 -> R2 -> PC1, then ARP happens twice, once between R1 and R2 and again between R2 and PC1. ARP never happens like this across a layer 3 boundary (like router R2), so that R1 will not get the MAC of PC1.

    So ARP will use a layer 2 broadcast to resolve an IP address (eg R1 asking who is 172.16.1.2) to a MAC address. Hopefully, the broadcast will get a response (R2 responds with I am 172.16.1.2, this is my MAC). Once that question is answered, it will remember the answer for next time.

    There's nothing particularly special about this scenario, and proxy arp would not (usually) come into play since the traffic is still routed (ie crosses a layer 3 boundary).
    2017 Goals - Something Cisco, Something Linux, Agile PM
  • WastedHatWastedHat Member Posts: 132 ■■■□□□□□□□
    Hi. Good question, I always thought about ARP requests looking for an address in the same LAN subnet. I just ran it on GNS3 with Wireshark, this is how it would look in your lab:

    R1 sends an ARP broadcast asking who has 192.168.1.1? out its R1-R2 interface. The sender IP is 172.16.1.1.

    R2 sends an ARP reply stating it's source IP is 192.168.1.1 with the MAC address of the R2 interface connected to R1.


    Remember that the scope of ARP is a LAN subnet. R1 knows there is no local 192.168.1.0 subnet so it looks at routing table and finds the outgoing interface like you said, and uses that to send the ARP broadcast. Then R2 pretends to be the 192.168.1.1 address in the reply with its MAC address.

    I created the 192.168.1.1 address on a loop back interface on R2 but I'm sure the result would be the same if it was a physical host, because R2 would have a Local/Connected route in its routing table for that Host/Subnet.
  • WastedHatWastedHat Member Posts: 132 ■■■□□□□□□□
    Just noticed OctalDumps reply, sorry my example is a bit confusing now.

    The ARP broadcast in my example is asking who has 192.168.1.1? in the broadcast because I set up a static route on R1 with only the outgoing interface defined. The other way to do it is to define a next-hop address of 172.16.1.2, then the ARP behaves like OctalDumps example which is less confusing :)
  • rob42rob42 Member Posts: 423
    I've been looking this also, in CPT. I'm wondering if erickafabiana is forgetting that R2 will have two active MAC Addresses, one for 'fa 0/0' and one for 'fa 1/0'

    No longer an active member
  • OctalDumpOctalDump Member Posts: 1,722
    rob42 wrote: »
    I've been looking this also, in CPT. I'm wondering if erickafabiana is forgetting that R2 will have two active MAC Addresses, one for 'fa 0/0' and one for 'fa 1/0'

    That doesn't matter as long as the interfaces are on different segments - and the router can differentiate between its own interfaces someway. The address only needs to be unique on the segment. But now you've got me wondering how Cisco routers differentiates between interfaces internally.
    2017 Goals - Something Cisco, Something Linux, Agile PM
  • rob42rob42 Member Posts: 423
    OctalDump wrote: »
    ... But now you've got me wondering how Cisco routers differentiates between interfaces internally.

    Is that not simply down to the Hardware Address of the ports?
    No longer an active member
  • rob42rob42 Member Posts: 423
    B.t.w, I found this document to be very useful...


    http://www.cs.virginia.edu/%7Ecs458/bookslides/module06-arpV2.ppt
    No longer an active member
  • OctalDumpOctalDump Member Posts: 1,722
    rob42 wrote: »
    Is that not simply down to the Hardware Address of the ports?

    Do you mean like Gigabit Ethernet 0/0/1? Which makes sense since a switch might only have 1 MAC and can still distinguish ports, or you might have sub interfaces on one physical interface, or more generally a physical port can be attached to more than one VLAN (ie more than one segment).

    Although I suspect it isn't Gi 0/1 internally, but just a number, to make it more machine friendly.
    2017 Goals - Something Cisco, Something Linux, Agile PM
  • rob42rob42 Member Posts: 423
    I'm way less experienced with this than you are, but I hope that I'm able to come up to your level. Forgive me if any of this is inaccurate...

    My experience is that every port has a MAC Address, rather than a device, such as a Switch, having 'a MAC Address', so I'm unclear what you mean by "a switch might only have 1 MAC and can still distinguish ports"?

    As for VLANS, again my understanding is that the VLAN ID comes into play when a Switch needs to send traffic arriving on the same port (the same MAC Address), to different VLANs.

    Maybe I misunderstanding what you're driving at...
    No longer an active member
  • erickafabianaerickafabiana Member Posts: 22 ■□□□□□□□□□
    wow thankyou guys for ur responses, as R1 will then ARP Broadcast asking who has the mac address for 192.168.1.1 ? Then R2 will act on behalf of PC1 replying use my Mac-address instead !. R1 then encapsulates the Packet into an Ethernet Frame with his source mac and as R2's Destination Mac, then R1 will forward the frame out of it's own Ethernet Interface To R2 :D !
  • erickafabianaerickafabiana Member Posts: 22 ■□□□□□□□□□
    wow thankyou guys for ur responses, as R1 will then ARP Broadcast asking who has the mac address for 192.168.1.1 ? Then R2 will act on behalf of PC1 replying use my Mac-address instead !. R1 then encapsulates the Packet into an Ethernet Frame with his source mac and as R2's Destination Mac, then R1 will forward the frame out of it's own Ethernet Interface To R2 :D !


    also im wondering if this Is Proxy arp ? Is Proxy and Arp the Same thing ?
  • rob42rob42 Member Posts: 423
    also im wondering if this Is Proxy arp ? Is Proxy and Arp the Same thing ?


    I don't know anything about 'Proxy ARP', but the .ppt file from that link that I posted, does go into it.

    I hope it helps.
    No longer an active member
  • erickafabianaerickafabiana Member Posts: 22 ■□□□□□□□□□
    WastedHat wrote: »
    Hi. Good question, I always thought about ARP requests looking for an address in the same LAN subnet. I just ran it on GNS3 with Wireshark, this is how it would look in your lab:

    R1 sends an ARP broadcast asking who has 192.168.1.1? out its R1-R2 interface. The sender IP is 172.16.1.1.

    R2 sends an ARP reply stating it's source IP is 192.168.1.1 with the MAC address of the R2 interface connected to R1.


    Remember that the scope of ARP is a LAN subnet. R1 knows there is no local 192.168.1.0 subnet so it looks at routing table and finds the outgoing interface like you said, and uses that to send the ARP broadcast. Then R2 pretends to be the 192.168.1.1 address in the reply with its MAC address.

    I created the 192.168.1.1 address on a loop back interface on R2 but I'm sure the result would be the same if it was a physical host, because R2 would have a Local/Connected route in its routing table for that Host/Subnet.

    :D I never understood how this particular scenario exactly until I saw ur post. Not to mention the responses that everyone else has gave me. But now I understand that routers will act on Behalf of each other and say Use my Mac-address instead right ?
  • erickafabianaerickafabiana Member Posts: 22 ■□□□□□□□□□
    rob42 wrote: »
    I don't know anything about 'Proxy ARP', but the .ppt file from that link that I posted, does go into it.

    I hope it helps.


    Thankyou for the .ppt file!
  • OctalDumpOctalDump Member Posts: 1,722
    But now I understand that routers will act on Behalf of each other and say Use my Mac-address instead right ?

    Well, not really. All that Router 1 cares about is the next hop, so it just wants the MAC for the next hop. When it does ARP, it doesn't do it for PC1, but for R2, since R2 is the next hop. The packet is being routed at layer 3, and MACs are at layer 2.

    It's like you want to get a message to Jef, but you don't know Jef personally, so you call Maggie who you know and who knows Jef. You call Maggie's phone number (MAC, layer 2) and give her the message, asking her to give it to Jef (the Layer 3 address), she then calls Jef (or maybe speaks to him in person, it doesn't matter to you) and gives him the message. You never need Jef's phone number (MAC), because you are giving the message to Maggie to handle.

    Once you get your head around all the layers and what does what, a whole lot of networking just "clicks". It's one of the harder parts, but probably the most useful.
    2017 Goals - Something Cisco, Something Linux, Agile PM
Sign In or Register to comment.