Monday 20 March 2017

Router On a Stick - Inter-Vlan Routing


Router On a Stick is the method of inter-Vlan routing through external router. Router's subinterfaces for each Vlan are created in order to form the routing. The ip of this interfaces are assigned to host as default gateway. The link between router and Switch is configured as Trunk link.

Switch>en
Switch#conf
Configuring from terminal, memory, or network [terminal]? t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int fa0/1
Switch(config-if)#sw mo acc
Switch(config-if)#sw acc vlan 10
Switch(config-if)#exit
Switch(config)#int fa0/2
Switch(config-if)#sw mo acc
Switch(config-if)#sw acc vlan 20
Switch(config-if)#end
Switch#
%SYS-5-CONFIG_I: Configured from console by console

Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int fa0/3
Switch(config-if)#sw mo trunk

All the host interfaces are set to access mode and configured trunk link on the interface connected to Router

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#int fa0/0
Router(config-if)#no shut
Router(config)#int fa0/0.10
Router(config-subif)#enc do 10
Router(config-subif)#ip add 192.168.1.254 255.255.255.0
Router(config-subif)#no shut
Router(config-subif)#int fa0/0.20
Router(config-subif)#enc do 20
Router(config-subif)#ip add 192.168.2.254 255.255.255.0
Router(config-subif)#no shut
Router(config-subif)#end
Router#
%SYS-5-CONFIG_I: Configured from console by console

Ip address is given to router interface. to assign the ip addresses we first need to issue 'encapsulation dot1q 10' where 10 is the vlan number. These Ips are configured as default gateway on PC1 and PC2.

All set to check the connectivity ? Lets try to ping PC2 from PC1


PC>ping 192.168.2.1

Pinging 192.168.2.1 with 32 bytes of data:

Reply from 192.168.2.1: bytes=32 time=9ms TTL=127
Reply from 192.168.2.1: bytes=32 time=0ms TTL=127
Reply from 192.168.2.1: bytes=32 time=0ms TTL=127
Reply from 192.168.2.1: bytes=32 time=0ms TTL=127

Ping statistics for 192.168.2.1:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 9ms, Average = 2ms

No comments:

Post a Comment