cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Cisco announces new innovations in SD-WAN, ISRs, SD-WAN Services, and Catalyst 9000 Series switches


156
Views
5
Helpful
9
Replies
Beginner

How switch identify L3 network

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
VIP Advisor

Re: How switch identify L3 network

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



kind regards
Paul

Please don't forget to rate any posts that have been helpful.
Highlighted
VIP Advocate

Re: How switch identify L3 network

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.

Beginner

Re: How switch identify L3 network

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.

VIP Advocate

Re: How switch identify L3 network

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

 

Beginner

Re: How switch identify L3 network

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?

 

 

VIP Advocate

Re: How switch identify L3 network

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.

VIP Expert

Re: How switch identify L3 network

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

Re: How switch identify L3 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?

VIP Expert

Re: How switch identify L3 network

"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.
CreatePlease to create content
Content for Community-Ad
Blog-New Labels