Friday 27 April 2012

Router on Stick or Inter Vlan Routing

 



 Router-on-a-stick or (inter vlan routing) is used to describe a setup that consists of a router and switch connected using one Ethernet link configured as an 802.1q trunk link.

In this configuration, a switch is configured with multiple VLANs and trunk port from switch is connected to router or any Layer 3 device Fast Ethernet interface and that router performs all routing between
the different networks or VLANs or subnets.

we already know each vlan = to Subnets = Networks.

There are a lot of practical implementations but it has some drawbacks like all inter-vlan traffic will pass through only on Fast etherenet interface which may lead to congestion on the network.

In the example below we will see how to configure a Cisco router and
switch in order to create a trunk link between them and have the
router route packets between your VLANs



SW1# configure terminal
SW1(config)# interface vlan1
SW1(config-if)# description Accounts
SW1(config-if)# ip address 192.168.0.2 255.255.255.0
SW1(config-if)# exit
SW1(config)# interface vlan2
SW1(config-if)# description HR
SW1(config-if)# ip address 192.168.2.2 255.255.255.0


SW1# configure terminal
SW1(config)# interface Fa0/24
SW1(config-if)# description Trunk-to-Router
SW1(config-if)# switchport trunk encapsulation dot1q
SW1(config-if)# switchport mode trunk

R1# configure terminal
R1(config)# interface Fa0/1
R1(config-if)# no ip address
R1(config-if)# duplex auto
R1(config-if)# speed auto
R1(config-if)# interface fa0/1.1
R1(config-subif)# description Accounts
R1(config-subif)# encapsulation dot1q 1
R1(config-subif)# ip address 192.168.0.1 255.255.255.0

R1(config-subif)# interface Fa0/1.2
R1(config-subif)# description HR
R1(config-subif)# encapsulation dot1q 2
R1(config-subif)# ip address 192.168.2.1 255.255.255.0
 
Encapsulation dot1q 2 command defines 802.1q encapsulation and sets
the subinterface to VLAN 2



No comments:

Post a Comment