enter image description here

I have a problem that Vlans won't communicate with each other. PC in the same Vlan can communicate with each other perfectly fine. I have the following configuration. Connections to Switch0:
- PC0 and PC1 are in VlanA
- PC2 and PC3 are in VlanB

PC0 ip: subnet: Gateway:
PC1 ip: subnet: Gateway:
PC2 ip: subnet: Gateway:
PC3 ip: subnet: Gateway:

Connections to Switch1:
- PC4 and PC5 are in VlanC
- PC6 and PC7 are in VlanD

PC4 ip: subnet: Gateway:
PC5 ip: subnet: Gateway:
PC6 ip: subnet: Gateway:
PC7 ip: subnet: Gateway:

Switch0 and Switch1 are connected to switch2 by a normal crossover connection. SWitch2 and router are in a Router on stick configuration. So fa0/3 of Switch2 is trunk with fa0/0 of router.
Router Configuration:

Router_A(config)#interface fastethernet 0/0  
Router_A(config-if)#no shutdown  
Router_A(config-if)#interface fastethernet 0/0.1 
Router_A(config-subif)#encapsulation dot1q 10  
Router_A(config-subif)#ip address  
Router_A(config-if)#interface fastethernet 0/0.2  
Router_A(config-subif)#encapsulation dot1q 20  
Router_A(config-subif)#ip address
Router_A(config-if)#interface fastethernet 0/0.3  
Router_A(config-subif)#encapsulation dot1q 30  
Router_A(config-subif)#ip address  
Router_A(config-if)#interface fastethernet 0/0.4  
Router_A(config-subif)#encapsulation dot1q 40  
Router_A(config-subif)#ip address
  • Your gateway ip should be the subinterfaces of the router corresponding to each vlan...but right now in your existing config,i see that the gateway ip is the subnet number
    – fsociety
    Apr 2, 2017 at 13:00
  • @fsociety I corrected the mistake but it still fails to communicate. Apr 2, 2017 at 15:45
  • Can any PC ping its gateway address? Can you include the config of sw2?
    – Ron Trunk
    Apr 2, 2017 at 15:51
  • @Frank wiene Pls avoid using the network number as the gateway address(does the ios even allow you to configure?). So, for instance, for PC 0 and PC1 use as the gateway address; similarly for PC2 and PC3 use as the gateway address; correspondingly these will be the ip addresses of subinterfaces on the Router; once you are done with this-ping from PC0 to it's gateway and see if it is OK, then ping from PC2 to it's gateway and see if it is OK; finally ping from PC0 to PC2, this should work now
    – fsociety
    Apr 2, 2017 at 16:01
  • You need to provide the router ans switch configurations.
    – Ron Maupin
    Apr 2, 2017 at 16:31

2 Answers 2


2 VLANS are different broadcast domains They are meant not be able to communicate with each other at layer 2. To make devices in different VLANS communicate you need a layer 3 device.

Now, to achieve this, you can use your switch 2 - as labelled in the figure attached. you need to create 2 virtual interfaces. Assign IPs to those virtual interfaces. Add routes on your device - either static or through some routing protocol. And finally set the virtual inteface as the default gateway for the devices (PC's in the diagram). Also the used VLANs should be allowed on the link. That is either set a native VLAN or make the links as trunk.

Alternatively you can skip the switch all together and use the router.

These steps are not comprehensive, But a general idea of what has to be done. Basic principle is you need layer 3 forwarding for inter vlan communication


Please try to put gateway IP in PCs, and also amend IPs in router subinterfaces they will act like default gateway for PCs in particular VLAN, and also configure trunk between all three Switches and Router.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.