Router-On-a-stick
Enter a caption for this image (optional)

To connect several vlans together, there is a model which is called “Router-on-a-stick“. This model has some advantages:

  • Cost effective

  • Easy to Implement

On the other hand, there are some drawbacks in this model:

  • Congestion on link(bottleneck on trunk port)

  • If router becomes down, network will down

switch(config)# int gi0/1
switch(config-if)# switchport mode trunk
router(config)# int gi0/0.10
router(config-subif)# encapsulation dot1Q 10
router(config-subif)# ip address 192.168.10.1 255.255.255.0
router(config)# int gi0/0.20
router(config-subif)# encapsulation dot1Q 20
router(config-subif)# ip address 192.168.20.1 255.255.255.0
router(config)# int gi0/0.30
router(config-subif)# encapsulation dot1Q 30
router(config-subif)# ip address 192.168.30.1 255.255.255.0

In Switch layer2, we use router-on-a-stick to connect vlans together based on access-list we define.

Layer 3 switches

Multilayer Switch
Enter a caption for this image (optional)

As it is shown, first set an IP address for the PC0 and PC1. PC0 is on Vlan 10, while PC1 is on Vlan 20. Default Gateway of both PCs are set with the IP address of Vlan in Switch. For routing between to Vlan, Just we use “ip routing” command as it is shown in below code:

switch(config)# vlan 10
switch(config-if)# ip address 192.168.10.254 255.255.255.0
switch(config-if)# exit
switch(config)# vlan 20
switch(config-if)# ip address 192.168.20.254 255.255.255.0
switch(config-if)# exit
switch(config)# ip routing