Cisco Support Community
Showing results for 
Search instead for 
Did you mean: 

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

Diffrent Subnet mask

In a layer 2 switch The diffrent networks can't communicate. i think the switch use only MAC address for taking forwarding dicision my qustion is that how will switch identify the diffrent networks. Because it is a layer 2 device it works the basis of MAC address


Re: Diffrent Subnet mask


just think about how ARP works... you will automatically get your answer... even though to make communication between device it need to have MAC address but how one host can have the MAC of the other host for communication...?

how Address resolution will work in ARP...

rate this post if it helps



Re: Diffrent Subnet mask


You are right! A layer 2 switch can't help in the communication between two different networks! It just can't do it, to facilitate that you need either a router or a layer 3 switch. You are again correct when you say that you think it uses MAC address for taking the forwarding decision.

The switch cannot identify different networks!!! If two different networks are connected to the same layer 2 switch, for it there is no difference between the two networks.

Hope this helps!



Please rate all helpful posts!


Re: Diffrent Subnet mask

It's been pretty well said , if you take a layer 2 switch say a 2950 and you define mulltiple vlan (networks) and put the users into all these different vlans they cannot talk to each other because they would have to be routed at this point , so the traffic would have to be sent up a trunk to a layer 3 switch and or router to be able to talk to each other . The gateway for each of these networks would be defined on the router or l3 switch and all user devices within that vlan (subnet) would point their default gateway to that interface...


Re: Diffrent Subnet mask


Switches forward frames based on destination mac-address.

and they build their forwarding database based on the source-mac-address when they recieve frames

When a switch doesnot have the destination mac-address in its forwarding database it broadcast through all its ports out except on port it recieved the frame.

It also uses the mac-address of the router(gateway) to forward frames which belongs to other network.





Re: Diffrent Subnet mask

Minor correction: Unknown destinations MACs cause the switch/bridge to FLOOD, not broadcast.

With a broadcast, the destination is all ones, in a flood, the destination MAC is left intact, hopeing that the intended recipient hears the frame and responds.

Good Luck


New Member

Re: Diffrent Subnet mask

If the device is looking for an address off the local network it will need to go to the default gateway, this is typically the router (L3 device).

The L2 switch doesn't understand any of this, it just learns which interface to use to reach a particular mac address or broadcasts out all interfaces.

Go back to the host and see what its gateway is.

Re: Diffrent Subnet mask


just as an info, two hosts (f.e. PCs) on the same VLAN can communicate with each other without router even if they are not in the same subnet. The trick is to use the PC routing table (route print) and set the host IP also as default gateway IP.

PC1: !IP !Mask !default GW

PC1: !IP !Mask !default GW

Both PCs will arp for any IP (they are default gateway!) thus ping will work from PC1. In a router you get a similar behaviour by configuring f.e.

ip route ethernet0

Hope this helps! Please rate all posts.

Regards, Martin