Router on a stick is a network design that enables inter-VLAN routing through a single physical link between a router and a switch, using 802.1Q-tagged subinterfaces to handle traffic for multiple VLANs. This content covers the concept and a full configuration walkthrough on Cisco hardware, including real-world troubleshooting.
Router on a Stick
Router on a stick is the idea that we have a router, and then we have a single Ethernet cable going into that router, plugged into the switch, for all the VLANs that are connected to it. We do this by using sub-interfaces.
What I've already done is I've set up an Ethernet cable between our router and our switch. On the switch I've plugged it into fa1/0/47, so that is the port that I'm plugged into there. On this router I plugged it into fa0/1. Those are the interfaces that we are going to be configuring on each of those devices.
Then we're going to set up this line to be 802.1Q, which means it adds the tag for the VLAN information. So this switch right here, when it sends a packet across this line, it's going to add the tag with the VLAN information, so then this router knows how to handle it. Then we'll set up IP addresses on this router using what we call sub-interfaces. We have the interface fa0/1, and then we're going to have sub-interfaces to it and we'll give them IDs. So VLAN 10 will probably have a sub-interface of 10, and then we'll give it an IP address — that'll be 10.1.10.1 will be the address for it. That's how we're going to set this up and configure it.
I have my notes here on the top right, and I have my network diagram. I've got a connection to S1, S2 and S3, even though we're just going to be configuring S1 and the router in this demo. I'm also pinging 10.1.10.21, which is my demo Pi 1 — it's on the same network, same VLAN, so I've got connectivity there. Then I'm pinging 10.1.20.22, and you can see it's timing out because I don't have any routing between these networks at this point in time.
In our last module we set up trunk lines on our switches, so let's take a look at how we configured that. I'm going to do a show run interface fa1/0/47 — this is the interface that I said I've got connected into the router — and I'm going to hit enter on that. I've got the correct description in there. The trunk native is VLAN 2; that's important, we will see that when we go to configure the router. Then the VLANs that are allowed are 2, 10, 20, 30, 40, 50 and 150. Those are going to be the VLANs we would want to configure on the switch. For the purpose of this demo we're just going to do VLAN 10 and 20, but we could go through and configure all of the VLANs this way, so that all of the VLANs are routed through this same trunk line right here.
Since switch 1 is already configured the way we want it, now it's time to go to the router and configure the router the way we want it. I've consoled into the router, because at this point in time I don't have connectivity into it, so I'm going to have to jump in here and enter my passwords in from my password manager.
Now I'm into this router, and I'm going to do a show run interface fa0/1 — that is the interface that we want to configure. So it's the IP address of something we've done quite a while ago, in one of our past modules, so we're going to need to change this.
Let's get into the global configuration mode and get into interface fa0/1. The description, "headquarters network linked to HQ S1", is still valid, so that's still good. Then we have an IP address, and we're going to take that IP address out of here, so let's remove that right there. We're also going to remove this one right here — we don't want these messing up our configuration — so we'll take both of those out of there.
Now what I'm going to do is get into what we had talked about, the sub-interface. The first sub-interface I'm going to do is VLAN 10, so I'll do up arrow to quickly get in here, and I'm going to create a sub-interface. I'm configuring it for VLAN 10. I could do the sub-interface .1 — it's just the first sub-interface — or I could do a sub-interface of 23. I can specify whatever sub-interface that I want; it's just a designator to keep it separate from every other sub-interface on this interface. So it really doesn't matter what the ID is, what number I'm going to give this sub-interface, but for consistency purposes I always like it to match up with my VLAN. So in this case right here I'm going to actually do sub-interface 10, so fa0/1.10 is going to be the sub-interface. I'm going to hit enter on that, and now I'm into the sub-interface. You can see that it actually shows me that I'm in the sub-interface right here, and I'm in the sub-interface of fa0/1.10.
Next I'm going to configure it to be able to accept the 802.1Q tagging. The first thing that I'll do is put a description into this, so I'm going to do a description and we'll just put "VLAN sub interface", and we'll hit enter. Then next, dot1Q — that is the protocol, the definition of the protocol of that tagging and what the tagging looks like. So I'm going to do dot1Q and then the VLAN ID, and this is VLAN ID of 10. That number right there is important: it does need to line up with the VLAN tagging, so that is very specific, we need VLAN 10 there. We hit enter, and now it can interpret that coming across there. Then we'll give this an IP address, 10.1.10.1.
Of course we will also want to set up VLAN 20 for this communication to happen. So I can get into the next sub-interface, and once again I always like the ID to match the VLAN, so .20 is what I'm going to choose. I'm going to put in a description here, but instead of 10 we're going to have a description of 20, so I'll put in 20 here and hit enter. I want this dot1Q statement right here, but instead of 10 we're going to say VLAN 20, so there's that. Then we're going to get an IP address in here as well, and we will want to change the IP address to match that of something in VLAN 20. So now I have an IP address associated with VLAN 20 and it is tagged with 20, and I have the same thing for 10 and this is tagged with VLAN 10.
The one other thing that I will mention is that we do have that VLAN 2, which is the native VLAN, so I'll show you how to get into that interface. We're going to create another sub-interface, but this sub-interface is just going to be 2, so it's going to be 0/1.2 so it matches up with that VLAN ID. We want the encapsulation — well, let's do a description here first, so description, and we'll hit enter. Then the dot1Q: we will specify that, but what we'll do is we'll include that it's going to be VLAN 2, and we'll include this word "native" in here. So native right there, and remember that's going to be the untagged traffic. I'm going to hit native and hit enter, and now VLAN 2 is the untagged traffic because I just specified it right there.
I'm going to exit out of here, and just in case, I'm going to do a no shutdown on the interface. I do need to be in the interface of fa0/1, so let's do zero one, and no shut on it.
I waited quite a while and it never came up, so I had to do some troubleshooting, which is just part of the process. Quite often you'll find that things don't go quite as planned and you'll have to do some troubleshooting. So I used the show ip interface brief to take a look at my interfaces and make sure that they were up. I did the show run to take a look at those interfaces. I took a look at the IP route, which we haven't gone over really in this course yet, to take a look and see if the routing table looked correct. All in all, most everything looked fine, but something did catch my eye.
I went to switch 1 and looked at our interface, and here where it said operational mode — most of this was fine, but where it said operational mode, it said that it was an access port, and so that is what flagged that something is off. So I did this command, show interface fa1/0/47 switchport, took a look at it, and once again I saw operational mode said access. Then I took a look at the running config — I'll do a show run interface fa1/0/47 — and when I took a look at this interface, I didn't have this switchport mode trunk in there. So I entered the switchport mode trunk in, which gave me an error. I did some Googling and figured out that on the 3750 I actually needed to type in switchport trunk encapsulation dot1q. So because of the type of switch I had, I had a couple of extra commands that I had to enter in.
This command should have been on there — I went over this in one of the prior videos — it's just that it didn't take on the 3750. It was still able to communicate out to the other switches, because DTP kicked in and everything worked out okay with communicating to the other switches. But because this router probably doesn't have DTP set up on it and turned on and configured, or maybe it's not even possible on that, it didn't automatically create this trunk line between those two devices, and so I had to go and enter in a couple of manual commands in here. That was not standard for this; if I had one of my 2960s we wouldn't have necessarily had this issue.
So just keep that in mind: you have to do a little bit of troubleshooting to figure out some of these commands, and every switch is a little different in some of the ways that you can configure them. But you can see down here I'm pinging both demo Pi 1 and demo Pi 2, so we are good to go.
TechKnowSurge builds IT and cybersecurity professionals through hands-on, concept-first training built around real understanding — not memorization. Free interactive tools, structured programs, and 25+ years of real-world experience, all in one place.
Explore free tools and programs →