Inter-VLAN routing operation
- Multilayer Switch Inter-VLAN routing: The 2960 switch supports up to 16 static routes (including user-configured routes and the default route) and any directly connected routes and default routes for the management interface; the 2960 switch can have an IP address assigned to each switch virtual interface (SVI). To enable the routing functionality on the 2960 switch:
- Enter command : “sdm prefer lanbase-routing”
- Reload the router
- Legacy inter-VLAN routing: Use one router interface for each VLAN, because of limited router interface, not good because of scalability.
- Router-on-a-stick Inter-VLAN routing: Can scale to maximum 50 VLANs, based on subinterfaces.
Subinterfaces are software-based virtual interfaces that are assigned to physical interfaces on router. Each subinterface is configured independently with its own IP address and subnet mask. The switch port which is connected to the router interface much be in trunk mode.
- Configure S1 interface F0/5 trunk:
s1(config-if)#switchport mode trunkNote that, we can’t use “switchport mode dynamic desirable”, because router doesn’t support the DTP, which is only used by switches.
- Configure subinterface:
r1(config)#interface interface_id.subinterface_idThe subinterface_id can be any number, but we usually use the one same as the vlan_id, which can easily reflect the vlan_id.
encapsulation dot1q vlan_id
ip address ip_address subnet_mask
R1(config-subinf)#encapsulation dot1q 10
R1(config-subinf)#ip add 172.17.10.1 255.255.255.0
R1(config-subinf)#ip add 172.17.30.1 255.255.255.0
If you have a native vlan to configure
R1(config-subinf)#encapsulation dot1q 99 Native
Remember to configure the IP address of the sub_interface as the default gateway on the PC. Or else the pc won’t forward packet to the router.