02-11-2019 01:48 AM - edited 03-08-2019 05:18 PM
Hi,
I am trying to understand how switch will identify network is on different subnet,
Like
PC1 (10.10.13.10/24)-------Switch1-----------PC2 (10.11.13.10/16)
02-11-2019 02:04 AM
Hello
If the switch is L3 compatible then that switch will have two L3 interfaces (usually Switched Virtual Interfaces) for those two subnets and each end host will be attached to a port on that switch in a vlan related to those SVI's
example switch:
interface vlan 10
ip address 10.10.13.254 255.255.255.0
interface vlan 11
ip address 10.11.13.254 255.255.0.0
vlan 10,11
exit
ip routing
int x/x
description vlan10 host
switchport access vlan 10
int x/x
description vlan11 host
switchport access vlan 11
02-11-2019 02:10 AM
HI there,
If you are just thinking about forwarding, providing the the two PCs are connected to the same VLAN the switch will happily forward packets to both PCs.
It is worth noting that in your topology the only traffic which the PCs will receive from each other will be broadcast traffic.
It is the role of the PC to determine if the other PC is in a different subnet. It does this by comparing the destination IP with its own subnet ID and netmask. If it discovers that the other PC is in a different subnet then it will send its traffic to its local gateway to be routed.
Occasionally each PC would send out a Gratuitous ARP, this would reach the other PC, however the IP information contained in the ARP payload would be for a non-local subnet so the receiving PC would drop the packet and not update its internal ARP table.
The only way you could get this topology to work would be to to configure an SVI on the switch which would have a primary and secondary IP address in both subnets.
cheers,
Seb.
02-11-2019 03:30 AM
Thanks for your explanation. My intention is to know when both switches are powered on what kind of packets they will received from both PC and on receiving those packets how switch will decide whether to forward or reject packet.
02-11-2019 03:45 AM
"both switches"? You only have one in your diagram.
On the assumption that you have a 'flat' network, ie a single VLAN...
Given the PCs IP addresses, they will never attempt to communicate directly. They will always address frames with the MAC address of their local gateway.
The switch will need a SVI with two IP addresses, which will allow it to route packets between the subnets on the same VLAN.
If you are looking for a production solution, then @paul driver answer is what you should implement.
cheers,
Seb.
02-11-2019 08:16 AM
I am considering switch as pure layer2 switch.So as per my understanding it doesnot understand ARP and any IP related things.So when PC1 will find destination ip is on different subnet, so PC1 will send ARP . So what content ARP request has and does PC2 will do ARP reply without any router?
02-12-2019 02:09 AM
Yes a layer2 switch will just learn the MAC addresses from the frame headers and forward them accordingly. It is up the network stack on the PCs to decide what to do with the packets it receives. It is receives unicast packets which are not addressed to it then they will be silently discarded.
If PC1 knows PC2 is in a different subnet then it will send an ARP request for the gateway IP that has been configured on PC1. If it receives a response from the gateway then it sends its IP packets addressed to PC2 but the Ethernet header will be addressed to the gateway MAC address. If you have no gateway, then there is no way for the PCs to communicate.
cheers,
Seb.
02-12-2019 07:30 AM
02-12-2019 07:41 AM
:) I had overlooked multicast.
Are you sure a about PC2 responding to an ARP request from PC1?
PC1 will know PC2 is in a different subnet so will only be ARP'ing for the local gateway. Agreed that PC2 will see the broadcast, but its network stack will discard it once it sees the ARP payload.
I had thought about adding the notion of ARP spoofing to this thread, ie PC2 sending an ARP reply for the PC1 ARP request for its local gateway. Is this ARP cache poisoning (done by both PCs) the basis of the unicast communication you mention?
02-12-2019 08:07 AM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide