You are on page 1of 8

29/01/2021 Configuration of Router on a stick - GeeksforGeeks

Related Articles

Configuration of Router on a stick


Last Updated : 09 Aug, 2019

Prerequisite – Access and trunk por ts

Switches divide broadcast domain through VL AN (Vir tual L AN). VL AN is a par titioned

broadcast domain from a single broadcast domain. Switch doesn’t for ward packets

across different VL ANs by itself. If we want to make these vir tual L ANs communicate

with each other, a concept of Inter VL AN Routing is used.

Inter VL AN Routing :

Inter VL AN routing is a process in which we make different vir tual L ANs to communicate

with each other irrespective of where the VL ANs are present (on same switch or

different switch). Inter VL AN Routing can be achieved through a layer-3 device i.e.

Router or layer-3 Switch. When the Inter VL AN Routing is done through Router the it is

known as Router on a stick.

Router On a Stick :

The Router ’s inter face is divided into sub-inter faces, which acts as a default gateway to

their respective VL ANs.

Configuration :

https://www.geeksforgeeks.org/configuration-of-router-on-a-stick/ 1/8
29/01/2021 Configuration of Router on a stick - GeeksforGeeks

Here is a topology in which there is a router and a switch and some end hosts. 2

different VL ANs have been created on the switch. The router ’s inter face is divided into 2

sub-inter faces (as there are 2 different VL ANs) which will acts as a default gateway to

their respective VL ANs. Then router will per form Inter VL AN Routing and the VL ANs

will be communicate with each other.

First we will assign IP address to the host PC1 as 192.168.1.10/24, Ser ver

192.168.1.20/24 and the other host PC2 will have IP address 192.168.2.10/24

manually.

Now, we will make sub-inter face of fa0/0 as fa0/0.1 and fa0/0.2 and assign IP

address as 192.168.1.1/24 and 192.168.2.1/24 respectively on router ’s por ts.

r1# int fa0/0.1


r1# encapsulation dot1q 2
r1# ip address 192.168.1.1 255.255.255.0
r1# int fa0/0.2
r1# encapsulation dot1q 3
r1# ip address 192.168.2.1 255.255.255.0

https://www.geeksforgeeks.org/configuration-of-router-on-a-stick/ 2/8
29/01/2021 Configuration of Router on a stick - GeeksforGeeks

NOTE : Here encapsulation type dot1q is used for frame tagging between the 2 different

VL AN. When the switch for wards packet of one VL AN to another, it inser ts a VL AN into

the Ethernet header.

Now, we will make 2 different VL ANs on switch namely VL AN 2 and VL AN 3 giving

names HR_dept and sales_dept.

Switch# vlan 2
Switch# name HR_dept
Switch# vlan 3
Switch# name sales_dept

Switch# int range fa0/1-2


Switch# switchport mode access
Switch# switchport access vlan 2
Switch# int fa0/3
Switch# switchport mode access
Switch# switchport access vlan 3

Here, we have assigned VL AN 2 to the specific switch por ts fa0/1, fa0/2 and vlan 3 to

fa0/3 respectively.

NOTE : int range fa0/1-2 command is used as there are more than one host present in a

single VL AN.

Now to check reachability of PC2 from PC1, we will tr y to PING PC2 from PC1.

https://www.geeksforgeeks.org/configuration-of-router-on-a-stick/ 3/8
29/01/2021 Configuration of Router on a stick - GeeksforGeeks

https://www.geeksforgeeks.org/configuration-of-router-on-a-stick/ 4/8
29/01/2021 Configuration of Router on a stick - GeeksforGeeks

https://www.geeksforgeeks.org/configuration-of-router-on-a-stick/ 5/8
29/01/2021 Configuration of Router on a stick - GeeksforGeeks

From the above figures, we see that the packet is delivered to the router by the switch,

because now the broadcast domain have been divided by the different VL ANs present

on the switch therefore, the packet will be delivered to the default gateway (as PC2 is

present on different network) and then to the destination.

Attention reader! Don’t stop learning now. Get hold of all the impor tant CS Theor y

concepts for SDE inter views with the CS Theor y Course at a student-friendly price and

become industr y ready.

RECOMMENDED ARTICLES Page : 1 2 3

Hot Standby Router Protocol Backing up Cisco IOS Router image


01 05
(HSRP) and Virtual Router 12, Jul 18

Redundancy Protocol (VRRP)


21, Mar 18

Introduction of Virtual Router Cisco Router modes


02 06
Redundancy Protocol (VRRP) and 13, Jul 18

its configuration
27, Mar 18

https://www.geeksforgeeks.org/configuration-of-router-on-a-stick/ 6/8
29/01/2021 Configuration of Router on a stick - GeeksforGeeks

Open shortest path first (OSPF) Cisco Router basic commands


03 07
router roles and configuration 17, Jul 18

30, Apr 18

Hot Standby Router Protocol


04
(HSRP) Introduction of a Router
20, Feb 18
08 12, Nov 18

 Like 0

 Previous Next 

Ar ticle Contributed By :

saurabhsharma56
@saurabhsharma56

Vote for di culty

Easy Normal Medium Hard Expert

Article Tags : Computer Networks-Network Layer , Computer Networks

Practice Tags : Computer Networks

https://www.geeksforgeeks.org/configuration-of-router-on-a-stick/ 7/8
29/01/2021 Configuration of Router on a stick - GeeksforGeeks

Improve Article Report Issue

Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.

Load Comments

5th Floor, A-118,


Sector-136, Noida, Uttar Pradesh - 201305
feedback@geeksforgeeks.org

Company Learn
About Us Algorithms
Careers Data Structures
Privacy Policy Languages
Contact Us CS Subjects
Video Tutorials

Practice Contribute
Courses Write an Article
Company-wise Write Interview Experience
Topic-wise Internships
How to begin? Videos

@geeksforgeeks , Some rights reserved


https://www.geeksforgeeks.org/configuration-of-router-on-a-stick/ 8/8

You might also like