Skip to main content

Question about switch operation..

More
15 years 6 months ago #30370 by LooseEnd
Why cant 2 PC's in 2 different networks connected to a single switch communicate(Ping) each other?
More
15 years 6 months ago #30373 by S0lo
Because when the PC finds out that the other PC's IP is on a different network it will send the Ethernet frame to the default gateway.

So to let this work, the default gateway (router) will have to forward the packet to the same interface it came from. You might be able to do this if you define the router interface to be a supernet (aggregation) of both of the PCs networks (For example 192.168.1.0/24 is a supernet of 192.168.1.0/25 and 192.168.1.128/25). However, this is not the normal behavior nor the best practice to do.

Studying CCNP...

Ammar Muqaddas
Forum Moderator
www.firewall.cx
More
15 years 6 months ago #30375 by LooseEnd
Ok then imagine this scenario.

PC1 - 192.168.1.1 /24
PC2 - 192.168.2.1/24

PC1 default gateway - 192.168.2.1
PC2 default gateway - 192.168.1.1

Why cant they communicate in this case? Also please note that in this scenario no router is involved..
More
15 years 6 months ago #30376 by S0lo

So to let this work, the default gateway (router) will have to forward the packet to the same interface it came from. You might be able to do this if you define the router interface to be a supernet (aggregation) of both of the PCs networks.


First I have to correct my self :oops:. In order for the above to work the router has to be able to have 2 IPs on the same interface. This is not typical on Cisco routers. So I might be wrong.

Ok then imagine this scenario.

PC1 - 192.168.1.1 /24
PC2 - 192.168.2.1/24

PC1 default gateway - 192.168.2.1
PC2 default gateway - 192.168.1.1

Why cant they communicate in this case? Also please note that in this scenario no router is involved..


If there is no router involved then there is no device to forward the packets between the two networks. Second, when PC1 ARPs for the MAC address of 192.168.2.1 it will not get a response, and same thing goes for PC2.

I know this a little brief but I'm in a little hurry now, gota go. I hope some one else can help.

Studying CCNP...

Ammar Muqaddas
Forum Moderator
www.firewall.cx
More
15 years 6 months ago #30380 by LooseEnd

Second, when PC1 ARPs for the MAC address of 192.168.2.1 it will not get a response, and same thing goes for PC2.


This is just the case, why wont PC2 respond to a arp sent for him?

Consider PC1 pinging to PC2.

Isnt this what is supposed to happen?

(1)PC1 checks destination network.
(2)Since destination is not in the same network, sends an arp to default gateway IP, (In this case PC2's IP)
(3)Switch will flood this in all its interfaces except the one it came.
(4)So PC2 will get the arp packet.
(5)Since the arp is for him PC2 will respond.
(6)Switch will forward the response to PC1 port.
(7)PC1 will get the mac of PC2.
(8)By this time logically switch's MAC table is updated with both PC1 and PC2's ports.

So logically they should be able to communicate. But I know that they can't.

So what's the error in the above procedure?
More
15 years 6 months ago #30382 by KiLLaBeE
Hope this helps:
Basically, a computer can only directly communicate DIRECTLY with a node that's on the same network as its on. If the two nodes are on different networks, then a router MUST be involved because a router CAN identify multiple different networks (and route packets between them), whereas a computer can't identify two separate networks, unless the computer has routing software and separate NICs. I haven't tried "workarounds," such as assigning two IPs of two different networks to a single interface on a computer.

I believe that the computer determines that a node is on a different network by performing some ANDing operation involving its own subnet mask and IP address with the destination IP address to get the two separate network IDs (and to actually see that they are on separate networks). I'm not 100% sure on this, though. I'll verify this later, but for now, just keep in mind that the two nodes must be in the same network to communicate with each other.

So in your case, PC1 and PC2 are in different networks (identified by their subnetmask /24), so PC1 can't communicate with PC2 because they're on different networks. They can't communicate with their default gateway as well because the default gateways are also on separate networks.

Although OSI layer 2 seems to work, layer 3 operation isn't so the communication (ping) will not work. I'd still wait for S0lo to replies as he knows networking better than I do.
Time to create page: 0.137 seconds