VLAN Interfaces are required in network scenarios where you have different VLANs and need Inter-VLAN switching on Layer3 (Routing capable) switches. Every VLAN that needs to be routed should have a VLAN interface.
Let’s say we have VLAN 10 which hosts the subnet 192.168.10.0 subnet, VLAN hosts 192.168.20.0 subnet and VLAN 30 hosts 192.168.30.0 subnet. For Inter-VLAN routing to work, we need to have a VLAN interface setup for each of these VLANs and configured with an IP address from the same subnet which will be the default Gateway for that subnet. Lets say, 192.168.10.254,192.168.20.254.192.168.30.254 are the IP addresses for VLAN Interfaces of VLAn 10,20,30 respectively.
Assuming the VLANs are configured already, let’s proceed to get the VLAN interfaces created.
Enable Routing on the Switch
ciscoswitch# conf t ciscoswitch(config)# ip routing
Add VLAN Interface
ciscoswitch(config)# interface vlan10 ciscoswitch(config-if)# no shut ciscoswitch(config-if)# ip address 192.168.10.0 255.255.255.0
This configures a VLAN interface for VLAN 10.
Default Route on Switch
Add a default route on the Switch. This will forward all traffic from the different VLANs to the default router.
ciscoswitch(config)#ip route 0.0.0.0 0.0.0.0 192.168.100.1
Interface to the Router
If the switch cannot reach the default router through a VLAN then an interface that connects to the router which does these routing needs to configured as a routed interface and assigned with an IP address that is in the same subnet as that of the Default router.
ciscoswitch(config)# interface gi0/1 ciscoswitch(config-if)# no shut ciscoswitch(config-if)# no switchport ciscoswitch(config-if)# ip address 192.168.100.2 255.255.255.0
This makes the interface as a routed interface and assigns an IP address in the same subnet as the default router.
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!
it is very good. 10 Q!
Thank you for hints
Is quite ohk bt wat do u config ip route of an exit interface
Never thought it was possible in cisco’s iOS but I was definitely proven wrong because of this. Though it’s weird upon checking my IP address at IP Elk after this, it didn’t displayed correctly. I need to fix it probably. Thanks for this insightful post!