If you are using a legacy Inter-VLAN routing, ensure that switch ports connect to the router interface should be configured in the correct VLAN. This is a very common issue with a switch port. If a switch port is not configured to correct VLAN, the devices on that VLAN cannot communicate outside its VLAN.
The figures below illustrate the switch port miss configurations. The figure 1 shows that host 1 is connected to switch0 port F0/1 which is the part of VLAN 100, and switch port F0/2 is connected to Router interface F0/0, and the switch F0/2 is not the part of VLAN-100. The host 2 is connected to F0/6, and the Router0 interface F0/1 is connected to F0/10, both F0/6 and F0/10 is the part of VLAN 200. So host0 can send data up to the router, but the router cannot forward the data to host-1, because VLAN 100 is not physically connected to Router0. To resolve this problem do the following on switch0.
Switch(config)#interface FastEthernet 0/2
Switch(config-if)#switchport access vlan 100
Figure 2 also illustrates the problem with the switch port, where the switch ports are properly configured. But we just connect the wrong switch port with the wrong interface of the router. The figures show that F0/2 is the part of VLAN 200, and interface F0/1 is configured for VLAN 200, but instead, we connect switch port F0/2 with router interface F0/1. So we also wrongly connect the Switch port F0/2 instead of switch port F0/10. So both are unable to send their data to the Router0. To correct this problem, just connect F0/10 with router interface F0/1 and F0/2 with Router interface F0/0.
The topology in Figure 3 shows the router-on-a-stick routing model. But, the port connected to the router is not configured as a trunk. The port connected to the router for the traffic of multiple VLAN must be configured as a trunk. But G0/1 on switch0 is not configured as a trunk and it is in the default VLAN. So the router cannot route between VLANs because each of its configured subinterfaces is unable to send or receive VLAN-tagged traffic. To resolve this problem configure G0/1 as a trunk.
Switch(config-if)#switchport mode trunk
When the trunk is effectively established, devices connected to each of the VLANs are able to communicate with the subinterface assigned to their VLAN, therefore enabling inter-VLAN routing.
The topology in Figure 3 shows the trunk link between Switch is configured but is going down may due to a cable or may be due to Router interface is shut down. So there are no redundant connection or path between these devices, So all VLANs are unable to communicate with each other.
Verify Switch Configuration
We can verify the switch configuration when a problem occurs. To verify the configuration we can use various verification commands to examine the configuration and identify the problem. These verification commands I have already explained in article Common Show Command – Cisco IOs, so follow these command for verification. We can use the show interfaces interface-id switchport to check the port VLAN membership. We can also use show running-config command to check the switch port mode.