![router on a stick config example router on a stick config example](https://blog.rottenwifi.com/wp-content/uploads/2021/08/Router-on-a-Stick.png)
Let's first start with defining the VLANs on the switch: Switch1(config)#vlan 10Īnd then configure the clients' ports: Switch1(config)#interface range fastEthernet 0/1-4 Figure 3. Using router-on-a-stick for InterVLAN routing, physical diagram. Compare this topology to the one from the previous lesson, where there was a physical link for every VLAN. Note that there is only one physical link between the switch and the router which will be used for all VLANs. Shown in figure 1 is our physical topology for this example. However, the VLAN-ID under the encapsulation command must match the VLAN number on the switch.įigure 2.
![router on a stick config example router on a stick config example](https://www.beaming.co.uk/wp-content/uploads/router-on-a-stick-2.jpg)
Have in mind that the sub-interface number does not have to match the VLAN-ID and could be any random number between 1-429496729. There we specify the VLAN ID with the command encapsulation dot1Q, which tells the router that when frames come in the physical interface and are tagged with this particular VLAN number, they should be handled by this sub-interface. This creates a virtual interface with the specified number and leads us into the sub-interface configuration mode. We create a sub-interface using the command interface. Router1(config-subif)# encapsulation dot1Q 10 Router1(config-subif)# encapsulation dot1Q ? IEEE 802.1Q VLAN ID Router1(config)# interface GigabitEthernet 0/0.10 Having this logic in mind, we can create a virtual interface on the router that threatens all frames tagged with VLAN 10 as connected to a virtual interface Gi0/0.10 and all frames tagged with VLAN20 as connected to sub-interface Gi0/0.20. Knowing the VLAN number of each frame, the router knows also which subnet it is part of, because of VLAN = Broadcast Domain = Subnet. Therefore, based on this tag the router can differentiate which incoming frames are part of which VLAN. From the switch's perspective, port 9 is an 802.1q trunk that sends all frames towards the router with a VLAN tag.įrom the router's perspective, all frames are coming in tagged. There is a single cable connecting Router1 to Switch1. Let's look more closely at the above physical diagram. It is obviously a better more scalable technique to use a single trunk link between the switch and the router as shown in figure 1.įigure 1. An IP address from each VLAN is then configured on each sub-interface and the router performs IP routing between connected networks.Ĭomparing this approach to the other scenario where we can use a physical interface for each VLAN. From the router's perspective, this physical interface is represented as multiple virtual sub-interfaces, one for each VLAN. From the switch's perspective, this physical link is configured as a trunk port allowing all VLANs that are going to be routed. Router-on-a-stick (ROAS) is a technique to connect a router with a single physical link to a switch and perform IP routing between VLANs. This technique is called router-on-a-stick (ROAS) because there is only one physical link between the router and the switch as you can see in figure 1. An IP address is then configured on each sub-interface from the respective VLAN. Connecting a router with a single link to a switch trunk port and defining sub-interfaces for each vlan.We have already discussed this technique in detail in one of our previous lessons. Then it is just a regular routing between networks. Connecting separate router interface to each VLAN and give each interface an IP address from the respective VLAN subnet.Router - There are two ways to use a router as a device that performs IP routing between VLANs.We are examining this InterVLAN routing technique in our next lesson.
![router on a stick config example router on a stick config example](https://www.networkacademy.io/sites/default/files/2020-11/router-on-a-stick-physical-view.png)
They can switch frames and perform IP routing between VLANs.