I have a Cisco SG300 with 2 VLANs enabled, half the switch ports are on one VLAN, half is on the other. Both VLANs use the same subnet. I want traffic to travel between the 2 VLANs. I thought the 2 VLANs would act as individual switches and if I plugged an ethernet cable from one VLAN to the other traffic would flow. However when I do this I can't ping devices on the other VLAN. Is there something I'm missing? Since I'm in the same subnet and there are no overlapping IP addresses on both VLANs I didn't think a router was needed.
-
1If you connect the two VLANs, you essentially have one VLAN. The problem could be spanning tree or perhaps you need a crossover cable.– Ron TrunkCommented Sep 30, 2019 at 20:41
-
VLANs are layer-2 constructs, and you need to use a layer-3 device (router) to route traffic between the VLANs. Simply connecting the VLANs together means that you have only one VLAN. Having two VLANs on a switch is like having two unconnected switches, If you connect the two switches, you have only one layer-2 broadcast domain (VLAN).– Ron Maupin ♦Commented Sep 30, 2019 at 21:00
2 Answers
If you want to merge two VLANs to become one you can just assign all access ports from the one VLAN to the other.
Your idea with connecting two different VLAN ports with each other could work. Apart from wasting two ports and creating an unnecessary potential bottleneck, a switch with activated spanning tree protocol (STP, RSTP, MSTP) detects the looping connection and blocks forwarding. The link LEDs light up but there's no traffic across.
STP is unaware of different VLAN configurations unless MSTP is used and it's configured appropriately (with multiple instances). In your scenario, you could simply deactivate STP on those two ports to avoid the blocking.
Another possible issue is when Auto MDI-X has been deactivated on both switch ports - the link LEDs won't light up if that's your problem. Using a straight (ie. non-crossover) cable requires one port to be in MDI and the other to be in MDI-X configuration. Usually, halfway modern devices support Auto MDI-X to automatically select a compatible role.
-
Disabling STP on the ports did it! The use is for debugging only, and I have extra ports available. I did not know that spanning tree was unaware of VLANs, so it makes sense now.– Dom GCommented Oct 1, 2019 at 6:18
Two Vlans with same subnet in SG300 switch .. To ensure communication between both Vlans create SVIs for both Vlans with different network subnets and enable "ip routing " inter-Vlan routing "