Inter-VLAN routing operation
    1. 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:
      1. Enter command : “sdm prefer lanbase-routing”
      2. Reload the router
    2. Legacy inter-VLAN routing: Use one router interface for each VLAN, because of limited router interface, not good because of scalability.
    3. 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.

Inter-VLAN routing

  1. Configure S1 interface F0/5 trunk: s1(config-if)#switchport mode trunk Note that, we can’t use “switchport mode dynamic desirable”, because router doesn’t support the DTP, which is only used by switches.
  2. Configure subinterface:
    r1(config)#interface interface_id.subinterface_id The 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)#interface g0/0.10
    R1(config-subinf)#encapsulation dot1q 10
    R1(config-subinf)#ip add
    R1(config-subinf)#int g0/0.30
    R1(config-subinf)#ip add
    R1(config)int g0/0
    R1(config-if)#no shutdown

    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.