The router on the stick configuration is a powerful and easy way to design your network. This method makes it very easy to add additional equipment to your network without the need to run a direct cable from your user device to the layer3 capable device. It is a networking terminology used to represent a layer3 device and a layer 2 switch where a single physical cable directly connects them. Here switch is a Layer 2 switch with multiple VLANs, and the router has all layer 3 IPs, and it handles all inter-VLAN communication. The port on the switch side is configured with an 802.1q trunk link, and on the Router side, there are multiple sub-interfaces, one sub-interface per VLAN.
Router on the stick configuration Scenarios
This post will discuss two scenarios where we can use this type of configuration: in an Enterprise network and a Service Provider network. I have taken a Cisco router and a Cisco switch here, but if you have any other vendor equipment, the setup logic would be the same, but you should check their documentation for configuration. So without further ado, let’s dive right into the setup and configuration.
Router on Stick Config – Enterprise Example
In this example, I have taken a typical office setup that has multiple departments. Each department has a separate Vlan and separate IP address block assigned. Furthermore, each department has two ports reserved on a Switch, situated on the same floor. Below are the network assignments.
- Port 1 & 2 – Vlan 100 – Sales – 192.168.100.0/24
- Port 3 & 4 – Vlan 200 – HR – 192.168.200.0/24
- Port 5 & 6 – Vlan 300 – IT – 192.168.300.0/24
Now in a normal scenario where a Salesperson wants to connect to another salesperson on the same VLAN and IP address block, they can talk directly without anything or, more specifically, without any router. However, when a person in sales wants to connect to the IT department; then, this communication needs to go through a router or a layer 3 device. This is typically achieved on a user device side by configuring the Default gateway.
(Bonus Tip – If you want to dig deep, you can typically see this in action on your laptop. Go to your windows10 search box and type CMD, and then type ipconfig on the black window. You will see something like this, here 192.168.2.15 is my PC IP address, 255.255.255.0 is my subnet mask. 192.168.2.1 is also an ip address on router interface facing LAN and 192.168.2.1 is the default gateway that helps me connect to anything external type beyond my 192.168.2.0/24 address block. It helps me connect to the internet through my home modem. You can also check out more information on how to use putty for large configuration backup.)
I have also written a neat windows trick on how to turn on the windows10 feature for the blue light filter. It basically helps you to work late at the night without affecting your sleep cycle.
Let’s get back to our main topic. In addition to the default gateway, you also need a layer-3 capable device connected to a Layer 2 switch, as shown in the above picture. A layer 2 switch is typically connected to a layer3 capable device through a fiber/copper running from a floor Switch to the main IT room somewhere on the ground floor or main floor. And that fiber/copper link is configured as 802.1q trunk link.
The physical port connected to the switch is divided into multiple sub-interfaces on the router side, and each has encapsulation type mentioned as 802.1q and an IP address. That IP address on the sub-interface is the default gateway of a user device.
In short, if you want to connect Vlan 100 to Vlan 200 through a layer 2 switch and router, you need a default gateway configured on the user device side and a router on a stick configuration on the layer 3 capable device side.
Now, let’s configure each device.
Also, commands can vary based on the cisco ios version you are using.
We will first configure the switch port connected to the router as an 802.1q trunk link.
STEP 1 – Switch Configuration
Switch Configuration
- Switch-Floor-01#configure terminal
- Switch-Floor-01(config)#int Fa0/10
- Switch-Floor-01(config-if)#switchport mode trunk
- Switch-Floor-01(config-if)#switchport trunk encapsulation dot1q
- Switch-Floor-01(config-if)#spanning-tree portfast trunk
The next step is VLANs configuration so let’s create the required VLANs and configure the access ports for user devices.
Vlan configuration
- Switch-Floor-01#configure terminal
- Switch-Floor-01(config)#vlan 100
- Switch-Floor-01(config-vlan)#vlan 200
- Switch-Floor-01(config-vlan)#vlan 300
- Switch-Floor-01(config)#int Fa0/1
- Switch-Floor-01(config-if)switchport mode access
- Switch-Floor-01(config-if)#switchport access VLAN 100
- Switch-Floor-01(config-if)#exit
- Switch-Floor-01(config)#int Fa0/2
- Switch-Floor-01(config-if)switchport mode access
- Switch-Floor-01(config-if)#switchport access VLAN 200
- Switch-Floor-01(config-if)#exit
- Switch-Floor-01(config)#int Fa0/3
- Switch-Floor-01(config-if)switchport mode access
- Switch-Floor-01(config-if)#switchport access VLAN 300
- Switch-Floor-01(config-if)#exit
STEP 2 – Router Configuration
In this configuration example, we used a single physical interface on the cisco router to support all VLANs—one sub-interface for one VLAN. We further set the encapsulation type as 802.1q to support the trunk configuration on the switch side.
A suggestion is to use a layer3 device with a Gigabit Ethernet port to guarantee you have enough bandwidth to support massive data transfers.
Let’s start to configure the Cisco router.
- R(config)#interface GigabitEthernet0/1.100
- R(config-subif)#encapsulation dot1q 100
- R(config-subif)#ip address 192.168.100.1 255.255.255.0
- R(config-subif)#interface GigabitEthernet0/1.200
- R(config-subif)#encapsulation dot1q 200
- R(config-subif)#ip address 192.168.200.1 255.255.255.0
- R(config-subif)#interface GigabitEthernet0/1.300
- R(config-subif)#encapsulation dot1q 300
- R(config-subif)#ip address 192.168.300.1 255.255.255.0
- R(config-subif)#int Gig0/0
- R(config-if)#no shutdown
Commands to Check if your setup is working properly
Router Show commands
- show IP interface –> To check interface.
- Show interface brief –> To check interface summary.
- Show IP route –> Use the show IP route command to check the routing table.
- sh run int g0/1.100 –> To check the router-on-a-stick configuration of a particular interface
Switch Show commands
- Show VLAN
- Show interface
- show interface fa0/10 – To check trunk port configuration, It also shows bytes of data transferred/utilized by the network
Test the setup to verify inter-VLAN routing services are working – Go to Sales PC in VLAN 100 and ping Laptop in VLAN 300. If everything is set up properly, this should work.
Router on Stick Config – Service Provider Example
Router on Stick configuration is common in the Service provider network as well. This is typically seen on the PE or Provider Edge routers because a single PE router serves multiple clients in most scenarios. So to save physical ports on the PE router, this design is used in conjunction with a layer2 switch.
The setup will look like this. The overall network design logic is the same. We are using layer2 switches with multiple VLANs to segregate customers. We have also divided the physical Interface on the router into multiple sub-interface for Intervlan communication (if needed). Typically inter-VLAN or Inter-customer traffic must not be allowed on PE sub-interfaces. And service provider uses Access-lists on sub-interfaces to achieve this.
Cisco router and Cisco switch Configuration will be the same as we did above.
Service Provide Cisco switch configuration:-
SP switch configuration
- SP-Switch-01(config)#vlan 100
- SP-Switch-01(config-vlan)#vlan 200
- SP-Switch-01(config-vlan)#vlan 300
- SP-Switch-01(config)#int Fa0/1
- SP-Switch-01(config-if)description ” Customer A”
- SP-Switch-01(config-if)switchport mode access
- SP-Switch-01(config-if)#switchport access VLAN 300
- SP-Switch-01(config-if)#exit
- SP-Switch-01(config)#int Fa0/3
- SP-Switch-01(config-if)description ” Customer B”
- SP-Switch-01(config-if)switchport mode access
- SP-Switch-01(config-if)#switchport access VLAN 300
- SP-Switch-01(config-if)#exit
- SP-Switch-01(config)#int Fa0/6
- SP-Switch-01(config-if)description ” Customer C”
- SP-Switch-01(config-if)switchport mode access
- SP-Switch-01(config-if)#switchport access VLAN 300
- SP-Switch-01(config-if)#exit
- SP-Switch-01#configure terminal
- SP-Switch-01(config)#int Fa0/10
- SP-Switch-01(config-if)description ” Connected to SP-Router_G0/0″
- SP-Switch-01(config-if)#switchport mode trunk
- SP-Switch-01(config-if)#switchport trunk encapsulation dot1q
- SP-Switch-01(config-if)#spanning-tree portfast trunk
Service Provide Cisco Router configuration:-
SP Router Configuration
- PE#Configure Terminal
- PE(config-subif)#description ” Connected to SP-Switch-01_Port 10 for Customer A”
- PE(config-subif)#encapsulation dot1q 100
- PE(config-subif)#ip address 192.168.100.1 255.255.255.0
- PE(config-subif)#description ” Connected to SP-Switch-01_Port 10 for Customer B”
- PE(config-subif)#encapsulation dot1q 200
- PE(config-subif)#ip address 192.168.200.1 255.255.255.0
- PE(config)#interface GigabitEthernet0/1.300
- PE(config-subif)#description ” Connected to SP-Switch-01_Port 10 for Customer C”
- PE(config-subif)#encapsulation dot1q 300
- PE(config-subif)#ip address 192.168.300.1 255.255.255.0
- PE(config-subif)#int Gig0/0
- PE(config-if)#no shutdown
Network Device type descriptions
- DTE – Data Terminal Device ( this is typically a user pc, phone, or any user device connected to a switch port)
- DCE – Data Communication Device ( This is a switch or a router)
- Router – Router is a layer 3 device used to connect two different networks or VLAN or IP subnets. Routers work on the Network layer in the OSI reference model.
- Switch – Switch is a layer 2 device used to connect multiple devices. Switches work on the Data link layer in the OSI reference model.
- VLAN – Virtual Local Area Segment is a single broadcast domain that is isolated virtually. One vlan represents one isloated broadcast domain and you need a layer 3 device or a router to connect multiple VLANs.
- PE – Provider Edge Router
- CE – Customer Edge Device
Remember to check more MPLS-related terminologies and MPLS VPN scenarios posts for more information on these topics.
Article Summary
In this post, we covered Router on the stick configuration using a Cisco switch and a router. Further, we demonstrated that we could use a single interface on a router and can provide Inter-VLAN routing services in environments without layer-3 switches. Finally, we have also discussed how efficiently we can use Router on a stick configuration in Service provider networks.
If you found this information valuable, please share it with others using the share buttons at the top left of the post. Sharing our articles takes about a minute and helps afrozahmad.com Blog reach more people.
- NETGEAR Nighthawk (RAX54S) WiFi 6 Router Review - August 24, 2024
- TP-Link AX1800 Archer AX21 WiFi 6 Router Review - August 24, 2024
- How to Connect Nanit to Hotel WiFi? - August 12, 2024