Pages

Sunday, May 12, 2013

Router On A Stick Tutorial


Router on a stick is used when for inter-VLAN routing when you have an L2 switch and a router. Here’s the topology:


Here we have an L2 switch with three VLANs connected to a router. Here’s the config:
Switch
Switch(config)#vlan 5
Switch(config-vlan)#exit
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 15
Switch(config-vlan)#exit
Switch(config)#interface FastEthernet0/1
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
The switch config is pretty basic, we create VLANs 5, 10 and 15, then we make a trunk port to the router.
Router
Router(config)#interface FastEthernet0/0
Router(config-if)#no ip address
Router(config-if)#interface FastEthernet0/0.5
Router(config-subif)#encapsulation dot1Q 5
Router(config-subif)#ip add 192.168.5.1 255.255.255.0
Router(config-subif)#interface FastEthernet0/0.10
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip add 192.168.10.1 255.255.255.0
Router(config-subif)#interface FastEthernet0/0.15
Router(config-subif)#encapsulation dot1Q 15
Router(config-subif)#ip add 192.168.15.1 255.255.255.0
On the router, we go to the interface connected to the switch and make sure there is no IP address. Then we configure our subinterfaces with 802.1q and the appropriate VLAN. Then we give each subinterface an IP address. Now we can see all the subinterfaces are up:
Router#sh ip int b
Interface              IP-Address      OK? Method Status  Protocol
FastEthernet0/0        unassigned      YES NVRAM  up      up
FastEthernet0/0.5      192.168.5.1     YES manual up      up
FastEthernet0/0.10     192.168.10.1    YES manual up      up
FastEthernet0/0.15     192.168.15.1    YES manual up      up
Now we’ll verify connectivity by pinging the subinterfaces from the switch:
Switch#ping 192.168.5.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.5.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/8 ms

Switch#ping 192.168.10.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/8 ms

Switch#ping 192.168.15.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.15.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/8 ms

No comments:

Post a Comment