Router on a stick - intervlan routing
Â
Assumptions:
- vlans on the switch are already created
Â
- interfaces are assing to vlans
Â
- all vlans has to communicate with each other
Â
- we use dot1q encapsulation protocol
Â
Â
- 1.Switch
(config)#int fa0/1
Interface to which router is connected
(config-if)#speed 100
(config-if)#duplex full
(config-if)#switchport trunk encapsulation dot1q
In lower model of catalyst switches the only possible protocol we can use is dot1q so this command does not exist and dot1q is enabled by default on all trunk connections,e.g.Catalyst 2960.
(config-if)#switchport mode trunk
Set interface fa0/1 in trunk mode
(config-if)#end
#wr
- 2.Router
(config)#int fa0/1
Interface which is connected to switch
(config-if)#description "intervlan routing"
(config-if)#speed 100
(config-if)#duplex full
(config-if)#no shutdown
(config-if)#exit
(config)#int fa0/1.20
(config-if)#description "Vlan 20"
Subinterface number should be equal to vlan number however it is not mandatory, just best practise.
(config-if)#encapsulation dot1q 20
Assigning vlan to subinterface(tagging).
(config-if)#ip address 10.0.20.1 255.255.255.0
Assigning ip to subinterface
(config-if)#exit
In the same way we are creating other subinterfaces.
(config)#int fa0/1.30
(config-if)#description "Vlan 30"
(config-if)#encapsulation dot1q 30
(config-if)#ip address 10.0.30.1 255.255.255.0
(config-if)#exit
(config)#int fa0/1.40
(config-if)#description "Vlan 40"
(config-if)#encapsulation dot1q 40
(config-if)#ip address 10.0.40.1 255.255.255.0
(config-if)#exit
(config)#int fa0/1.50
(config-if)#description "Vlan 50"
(config-if)#encapsulation dot1q 50
(config-if)#ip address 10.0.50.1 255.255.255.0
(config-if)#end
#wr
- 3.Save configuration and check if routing is working properly.
Â
dzbanek 2007-06-24