cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1027
Views
5
Helpful
6
Replies

Q1 - 2 Router and a Switch

JRS
Level 1
Level 1

Hi All, 

 

I am a newbie who has picked Networking just Last Week for career change, mostly reading on my own.

 

I have few very basic questions which I would like your help with. These may seem stupid to learned ones but please bear with me. I am putting my first question in this forum where I am trying to understand how the traffic flow between 2 routers connected via switch. I am not looking for any ready-made answer hence I have put my understanding for you all to correct/amend. Thanks in advance. 

 

Let’s assume, I have two routers connected via switch as - 

 

Router 1  -> Switch 1 -> Router 2  ->Service Provider Network

 

Situation 1 -> Both Routers are on same subnet (say 200.10.1.0/24) and no VLAN defined on switch.

Steps - 

  1. R1 tries to send a packet to R2, put R2 IP as L3 address. 
  2. As it doesn't have the MAC address of R2, it sends an ARP request, switch will forward this to all other host connected including R2. R2 will recognise the IP and send back its MAC to R1 via switch. At this point, S1 has the MAC of R1 and R2, R1 has MAC of R2
  3. R1 includes R2 MAC and IP in packet, send to S1, S1 reads R2 MAC and forward the packet to R2. 

 

Question - If there are multiple switch connected to R1, is there any routing need to be defined in R1 to send the packet for R2 via S1? I believe, there should at least be a routing for R2 IP in R1?

 

Situation 2 -> Both Routers are on different subnet (R1 - 200.10.1.0/24, R2 - 200.10.2.0/24) and no VLAN on switch.

Steps – No difference from Situation1.

 

Situation 3 -> Both Routers are on same/different subnet  and they are on different VLANs (VLAN 10 – R1 and VLAN 20-R2)

Steps – 

  1. This will require SVI for inter-VLAN routing. (R1 and VLAN 10 IP on same subnet, R2 and VLAN 20 on same subnet). Here S1 will behave as L3 switch.
  2. R1 should have VLAN10 ip configured in routing table to route all traffic for R2 IP.
  3. R1 tries to send a packet to R2, put R2 IP as L3 address. R1 does an ARP, receives S1’s MAC. In this case, S1 doesn’t broadcast ARP request to R2 as they are on different broadcast domains.
  4. R1 sends the packet with L3 address as R2 IP and destination MAC of S1.
  5. S1 see the IP destined for R2 (as behaving as L3 switch), does ARP again from VLAN20 interface, get R2 MAC as one subnet, forwards the packet.
  6. I am sure I’ve gotten this wrong.

 

Hopefully this should clear out my understanding of basic routing.

 

Regards,

JRS

1 Accepted Solution

Accepted Solutions

chrihussey
VIP Alumni
VIP Alumni

Hello

Situation 1: Whether or not there are one or more switches between R1 & R2, if they are on the same subnet and a common VLAN they should be able to reach each other without any routing protocol.

 

Situation 2: If the routers are on different subnets on a common VLAN there may be some erroneous communication due to the fact that they'll see each other's broadcasts. However, you won't be able establish routing between the two.

 

Situation 3: The only ARPiing that will occur is the routers will ARP the switch for the respective L3 VLAN IP MACs. Once the routers have this information, any packets that need to go to the other subnet will have the destination IP of the other subnet host with the destination MAC address of the switch's VLAN interface.

 

Hope this helps (happy networking)

View solution in original post

6 Replies 6

chrihussey
VIP Alumni
VIP Alumni

Hello

Situation 1: Whether or not there are one or more switches between R1 & R2, if they are on the same subnet and a common VLAN they should be able to reach each other without any routing protocol.

 

Situation 2: If the routers are on different subnets on a common VLAN there may be some erroneous communication due to the fact that they'll see each other's broadcasts. However, you won't be able establish routing between the two.

 

Situation 3: The only ARPiing that will occur is the routers will ARP the switch for the respective L3 VLAN IP MACs. Once the routers have this information, any packets that need to go to the other subnet will have the destination IP of the other subnet host with the destination MAC address of the switch's VLAN interface.

 

Hope this helps (happy networking)


Thanks Chrihussey, looks like I was almost there and then missed it. Can you help me with some more clarifications around your response. They are inline to your reply. Thanks, in advance. 
@chrihussey wrote:

Hello

Situation 1: Whether or not there are one or more switches between R1 & R2, if they are on the same subnet and a common VLAN they should be able to reach each other without any routing protocol.

<JRS> Was I correct in the steps part? Also, If there are more than one switch directly connected to R1, how will R1 know which switch to send the packet 2 to reach R2. 

 

Situation 2: If the routers are on different subnets on a common VLAN there may be some erroneous communication due to the fact that they'll see each other's broadcasts. However, you won't be able establish routing between the two.

<JRS> Although this is a fictitious scenario, what is the way to overcome this and establish the routing? 

 

Situation 3: The only ARPiing that will occur is the routers will ARP the switch for the respective L3 VLAN IP MACs. Once the routers have this information, any packets that need to go to the other subnet will have the destination IP of the other subnet host with the destination MAC address of the switch's VLAN interface.

<JRS> So do you mean, only R1 will ARP to get S1's MAC? Once the packet reaches S1 using R2 IP and S1 MAC, how will S1 know the MAC of R2 for second leg of packet i.e. to R2, as there could be multiple host connected to switch in R2 subnet? 

 

Hope this helps (happy networking)

<JRS> Many Thanks


 

<JRS> Was I correct in the steps part? Also, If there are more than one switch directly connected to R1, how will R1 know which switch to send the packet 2 to reach R2. 

Yes, you were correct on the steps.

In the simplest terms a router cannot have two interfaces sharing the same network. (It primary function is to "route" packets). So if a router is directly connected to more than one switch, then the interfaces would belong to different networks (or VLANs on the switches). The routing configuration would determine which interface to use.

 

<JRS> Although this is a fictitious scenario, what is the way to overcome this and establish the routing? 

There are probably several ways, but the easiest that comes to mind would be to give both routers a secondary IP so that each of the interfaces would have the IPs in both subnets. This way they could communicate across a single VLAN with both networks. (Technically no routing required)

 

<JRS> So do you mean, only R1 will ARP to get S1's MAC? Once the packet reaches S1 using R2 IP and S1 MAC, how will S1 know the MAC of R2 for second leg of packet i.e. to R2, as there could be multiple host connected to switch in R2 subnet? 

So once the packet gets from R1 to S1, S1 then needs to route the packet to the other VLAN. If S1 does not know the IP/MAC of R2, then S1 will send an ARP request. Once R2 replies, S1 will forward the packet from R1, but change the MAC address in the L2 header to that of R2. In addition, R2 will also learn the IP/MAC combo of the S1 interface through this process to send return packets to R1.

 

Thanks, It clearer now. I am yet to read about Secondary IP for make Situation 2 work.

For Situation 3, does the response change if R1 and R2 are in same subnet? I believe they shouldn't as they would still be in different VLAN.

If R1 and R2 are on he same subnet, yet on different VLANs on the switch they will not communicate. You cannot have the same network in two different places.

Thanks much, I now have the clarity. 

Review Cisco Networking for a $25 gift card