cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
690
Views
5
Helpful
9
Replies

How switch identify L3 network

nitinquiet
Level 1
Level 1

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)

9 Replies 9

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


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

Seb Rupik
VIP Alumni
VIP Alumni

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.

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.

"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.

 

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?

 

 

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.

"It is worth noting that in your topology the only traffic which the PCs will receive from each other will be broadcast traffic."

Multicast too.

Also, if host doesn't have a gateway, it will ARP for the destination IP, and other host will "see it" ARP broadcast and respond. I.e. depending on host configurations, unicast is still possible between hosts on "same wire" although in different network.

@Joseph W. Doherty

:) 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?

"PC1 will know PC2 is in a different subnet so will only be ARP'ing for the local gateway."

Correct, which is why I wrote "Also, if host doesn't have a gateway, . . . "

As to PC2 replying, the ARP request provides the IP and MAC of PC1, with that, I believe it will bypass using a gateway to respond to PC1.

As to spoofing, I didn't have that in mind for unicast between the two hosts.
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco