1

I'm trying to understand how the use of switches and routers in the same network work. This is related to this other question of mine.

Suppose we have this network (I know this may not be a realistic scenario, but I think it's useful for didactic purposes):

enter image description here

'Subred' states for 'Subnet' in Spanish. r1 and r2 are routers. sw1 and sw2 are switches.

Suppose that from pc1 we want to send a ping to pc5. I don't know if Sw2 will take part in this process or not. If there were no switches, the procedure would be the usual: ARP request from pc1 looking for its default gateway, ARP response the other way around, Echo request with destination 12.0.0.2, r1 performs ARP request looking for r2, etc., etc., etc.

But with the switch Sw2 there, I get confused big time. My questions are:

  • Would pc1 and pc5 be able to communicate directly, as they are in the same layer-2 network (but different layer-3)?
  • Would it be possible for the hosts to communicate if all routers were replaced by switches? There would be full layer-2 connection, but none layer-3 connection. I don't know how would the network be in that case.
  • In this case, if the switches were all replaced by routers, wouldn't the network stay the same? I mean, no connection between hosts would be lost... So, could we just use all routers and expect the network to behave the same way?
3

Your diagram is a little confusing because it uses the symbols for routers, not switches.

Would pc1 and pc5 be able to communicate directly, as they are in the same layer-2 network (but different layer-3)?

PC1 will have R1 as its default gateway. When PC1 sends data to PC5, PC1 determines that PC5 is not on its local network. PC1 will ARP for the default gateway and forward the packet to it. R1 will forward the packet to R2, which in turn will forward the packet to PC5.

Would it be possible for the hosts to communicate if all routers were replaced by switches? There would be full layer-2 connection, but none layer-3 connection. I don't know how would the network be in that case.

If all routers were switches, there would be no default gateway. Since there is no default gateway to forward it to, R1 will simply return a destination unreachable error to the application program. No ARP requests will be sent.

In this case, if the switches were all replaced by routers, wouldn't the network stay the same? I mean, no connection between hosts would be lost... So, could we just use all routers and expect the network to behave the same way?

Assuming the routers all have full routing information, then yes.

1
  • Sorry if the diagram was confusing. r1 and r2 are routers, and sw1 and sw2 are switches. I'll add that information to the question. Does this information change the content of your answer? – Tendero Feb 19 '18 at 3:00
2

There are several problems in your diagram:

  1. You use straight lines for segments - these indicate electrical bus/coax segments that are long obsolete. Today, each device is directly connected to a switch port (or router port). Alternatively, you can document your L3 structure by using straight lines for each segment/subnet (one or more switches), but then you wouldn't show switches at all.
  2. You can't (reasonably) connect segments by switches and routers at the same time. A switch connects devices in the same segment while a router connects devices from different segments.
  3. You connect devices from different subnets, using different colors, to the same horizontal lines - this might indicate a use of VLANs but you don't explain it anywhere.

As it is, all devices can communicate with each other both directly (through the switches) and through the routers (which will have a hard time with their routing tables).

Would pc1 and pc5 be able to communicate directly, as they are in the same layer-2 network (but different layer-3)?

No. Since they are part of different subnets they require a router.

Would it be possible for the hosts to communicate if all routers were replaced by switches? There would be full layer-2 connection, but none layer-3 connection. I don't know how would the network be in that case.

No - for the same reason. Devices on different subnets require a router, even if they are in the very same L2 segment (which they actually are by Sw2).

In this case, if the switches were all replaced by routers, wouldn't the network stay the same? I mean, no connection between hosts would be lost... So, could we just use all routers and expect the network to behave the same way?

If you replace the routers by switches you get multiple connections between any two points. This results in a bridge loop, drowning the network with broadcasts.

In a nutshell, you structure your network with L3 subnets, each located within its own L2 segment. Devices within an L2 segment your connect to switches. Between two switches from different segments you put a router to enable communication between them.

-1

A packet within same Vlan don't reach gateway

Let see example

When traffic is initiated from source to destination with in same Vlan that mean within same networks

Host will initiate Anding process and finds souce and destination belongs to same networks ..

Source IP address will be PC ip address

Destination IP address = destination IP

Souce mac -address = PC NIC card mac -address

Destination mac addresses = ?

For destination mac address ARP broadcast will intiàte asking switch which switch connected with destination ip PC . Specific pc will respond back to ARP request to mac -address and this traffic will be unicast ..

Now destination mac -address = destination pc mac -address

Now traffic reachs to switch in switch it checks for mac -address table and forwards traffic accordinglly with reference to mac -address table in layer2 switch .

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.