cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
17077
Views
0
Helpful
26
Replies
Highlighted
Beginner

Can two Vlans on the same subnet

I thought I saw this somewhere but can't seem to find it again...

If two switches are configured with different vlans but on the same subnet:

1) Traffic will pass between the switches untagged

2) Layer 3 communication will work because the two vlans share the same subnet

Am I correct here?

                  

Also, what would happen if two switches on diffrent vlans but on the same subnet are connected to each other?

26 REPLIES 26
Highlighted
Cisco Employee

Hi

If the link between the switches is access link it will work

PC1---------SW1--------Accesslink-----------------SW2--------------PC2

Think both the ports on SW1 are in Vlan 10 and all the ports on SW2 are i nVLAN 10, and PC1 and PC2 are in same subnet, they can communicate each other

Thanks

Raju

Highlighted

There was a Typo in my previous message. Correcting that

If the link between the switches is access link it will work

PC1--------(Vlan 10)-SW1-(Vlan 10)-------Accesslink---------------(Vlan 100)--SW2--(Vlan 100)------------PC2

Think both  the ports on SW1 are in Vlan 10 and all the ports on SW2 are in VLAN  100, and PC1 and PC2 are in same subnet, they can communicate each other

Thanks

Raju

Highlighted

Can two Vlans on the same subnet comminucate  if we are using different vlans.

ie we use vlan 10 on SW1 and 20 on SW2

PC1---------SW1--------Accesslink-----------------SW2--------------PC2

 

waiting for your reply

Regards
Narinder
Highlighted

Yes they can, as was also answered in Pulikkal's 2nd response (although he used VLANs 10 and 100 rather than 10 and 20).
Highlighted
Beginner

Hi,

We should always use the terminology of network and subnet properly. When we talk about networks we should always remember it is a classful either /8, /16, or /24 ex: 192.168.10.0 ; 172.16.0.0 ; 10.0.0.0

And for the subnets it means a major network is divided into smaller networks.

Example: Network: 192.168.10.0/24

                 Subnet: 192.168.10.32/27

                               192.168.10.64/27

                               192.168.10.96/27 and so on...

So to answer your question, I think you cannot configure two switches with different vlan within same subnet because it will overlap other vlan or the ip address that was already configured.

I made and example for this situation, you can create different vlans in both switches and still communicate if they are in the same vlans. For example in switch1 have vlan 10, 20 and 30 same as in the switch2  and pc1(192.168.10.40) can ping with pc2 in switch2 (192.168.10.41) because both are in the same vlan. In switch1 there are 2 pc in vlan 30 and they ping each other together with the laptop in switch2 (192.168.11.12).

I hope this will help you understand.

Thanks.

Highlighted

Hi,
is there trunk between your 2 switches?
If yes, your trunk transport which VLAN ID?

Highlighted

no there is access port only . now im able ping vise-versa. refer attached file

 

 

Regards
Narinder
Highlighted

It's normal you ping the PC, because the two PC are in the same VLAN and same Subnet.
But it is impossible to have differents VLAN in the Same Subnet, because VLAN is virtuel network, so network
Highlighted

r u sure u r using different vlans?cause as far as i know, if u use vlan 10 on sw a and vlan 20 on sw b, theres no way that traffic of vlan 20 pass to vlan 10 on layer 2 switchs.

vlan tag is on data link layer and sw will look at that before forwarding the pdu to another switch. ip address is not checked at l2 switchs.
Highlighted

Exactly, if your two computer are in different VLAN, you can't ping one to another even if your two computer are on the same subnet.

Verify if Your two PC are on the same VLAN.

Highlighted

True only if frames are tagged. If you use untagged frames (e.g. access ports), you can jump across VLANs because the switches cannot tell the frames belong to different VLANs. (NB: on Cisco devices, though, if CDP is active, it will note, but not block, access ports that are on different VLANs.)

Also BTW, this can also be done on the same switch, if you cross connect two ports, each on different VLANs, again using untagged frames.
Highlighted

Joseph makes an important point about whether frames are transmitted with tags or without tags. If two switches are connected on an interface which is configured as trunk then the frames will be tagged and if they are tagged then the PCs will NOT be able to communicate. But most of the questions in this discussion have specified that the link connecting the switches is an access port. In this case there are no tags on the frame, each switch believes that the peer switch is in the same vlan (does not know the configured vlan of the peer) and the PCs can communicate successfully.

 

HTH

 

Rick 

HTH

Rick
Highlighted

"If two switches are connected on an interface which is configured as trunk then the frames will be tagged and if they are tagged then the PCs will NOT be able to communicate."

NB: except for Cisco's "native VLAN" on a trunk. Those frames, too, are untagged.
Highlighted

Joseph makes an appropriate technical correction. And frankly it is not important whether an individual frame is tagged or is untagged. What is important is that on the trunk connection the switch is tag aware and that the switch does know what vlan the frame is associated with on the neighbor and therefore knows to what vlan it can forward the frame.

 

On an access ort there is no knowledge of what is on the neighbor switch and on a trunk there is knowledge of what is on the neighbor switch. And that is what determines whether the PCs can communicate.

 

HTH

 

Rick

HTH

Rick
Content for Community-Ad