Cisco Router on a Stick
Router on a stick (also known as Stub router or One-armed router), allows for communication between hosts in different VLANs. By default ALL traffic destined for hosts in a different VLAN requires a layer 3 device for successful communication.
The switch has port Fa0/4 in VLAN 4 and port Fa0/2 in VLAN 2
The following was used to configure this scenario:
S0(config)#int fa0/4 S0(config-if)#switchport mode access S0(config-if)#switchport access vlan 4 % Access VLAN does not exist. Creating vlan 4 S0(config)#int fa0/2 S0(config-if)#switchport mode access S0(config-if)#switchport access vlan 2 % Access VLAN does not exist. Creating vlan 2
Now we need to configure trunking on port Fa0/1 of the switch.
S0(config)#int fa 0/1 S0(config-if)#switchport mode trunk
The 2960 switch uses only dot1Q for trunking. To see which interfaces are configured for trunking on the switch use the following command.
S0#show interface trunk
To enable communication between hosts in different VLANs you must use a router or a layer 3 switch. The router must be configured with subinterfaces using the same encapsulation used on the switches trunk port i.e ISL or dot1Q. The encapsulation must be configured on the router subinterfaces first before any IP addresses are assigned using the following syntax.
R1(config-subif)#encapsulation dot1Q 4 R1(config-subif)#ip address 172.12.4.1 255.255.255.0
Note that the VLAN number or ID is added after the encapsulation dot1Q command (in this case 4). The interface on the router must also be enabled using the no shutdown command and the host PCs must be configured with the correct default gateway!

