A misconfigured 802.1Q encapsulation tag on a router-on-a-stick subinterface blocks inter-VLAN traffic, and a systematic ping-based troubleshooting process leads to identifying and correcting the VLAN ID mismatch.
Troubleshooting Router on a Stick
We're going to actually learn how to troubleshoot some of the issues that can occur with router on a stick. So we're going to jump in and start troubleshooting and figuring out what's going wrong.
I have the same setup, where I'm connected to all of the devices, switch one, two and three, even though we may not access some of those, and router one. I have the IP, or some information about my network here on the right. I've got the network diagram right here. I'm pinging the demo Pi 1, which is on the same network, and I'm being successful with that. And then I am not able to ping demo Pi 2, which is on VLAN 20, so it's a different VLAN. So let's take a look to see what would we do to troubleshoot this issue.
If I were to try to access a resource on demo Pi 2 and not be able to connect, the first thing that would jump into my mind is, okay, well what can I ping, what can I get to? So I'd start out by opening up a command prompt. So I'm going to open up a command prompt, and I always like to ping my default gateway first. So 10.1.10.1, it's part of the local area network and it's pretty key to a lot of communications, and sometimes when things go down, quite often it's my connectivity to the default gateway. So I just like to start there. It's kind of a divide and conquer method, it's a good division line to see if I've got remote connectivity.
So I'm going to hit enter, and yes, sure enough, I do have at least some connectivity on my network, I can ping out. Which is not surprising, because I'm pinging our demo Pi 1, so I'm at least able to get across the network. So it's not completely surprising that I can get to the default gateway, but that is one of the first things that I check on.
So the next thing that I would do is I would ping, let's try to ping the next hop, like what is beyond that. And I'm trying to get to VLAN 20, and the default gateway for VLAN 20 is the same thing except for it's dot 20. So 10.1.20.1. So I'm going to ping that to see if I have connectivity to that, and sure enough I at least have some sort of connectivity to that as well. So there's nothing wrong with that. For some reason I'm not able to get beyond that to that network. I can get to that IP address but I can't get beyond that IP address, so something is different here, something is strange.
Now since I can ping that, I'm going to jump on the router, because something maybe is not routing into that network correctly. So I've got the router up here, and now I'm going to ping through the router, 10.1.20.1, and check that out to see if I can ping. Oh, excuse me, 20 dot, I should be able to ping itself. So let's give it a try. Yeah, it pings itself. That's not a problem right there. So let's try to ping 21, or 22 rather, which is the demo Pi, and it's not able to do that, not able to connect into that. So there's some sort of connectivity issue between the router and devices on this network.
So let's go ahead and do our next step, where we do a ip route and see what's in our routing table. So show ip route is rather what I'd like to do, so I can see the networks that are connected to it. And one of the networks that it's connected into is 10.1.20.0, so I have that network connected. It also shows that it's up. If the link wasn't up, that wouldn't be up. I can do a show ip interface brief to check the links, but if I have the route up, that means the link is up, and sure enough that's up. So there's nothing wrong with that.
I can do a show interface and see what the show interface does. I can read through here and check to see if there's anything that stands out with this, if there's any kind of issue at all. As I look through here, nothing is jumping out at me with this right here. So the interface looks like it's doing pretty good. Oh, this is fast ethernet, so this is actually the one that we're looking at right here, and I don't see anything with that.
Oh, here's the sub interfaces, so we can look at those sub-interfaces. And it's specifically a dot one. We know there's nothing wrong with dot 110, so we're looking at 1.20 and it's up, and VLAN 20 sub interface, that's just the description. So oh, wait a minute here, what's this VLAN ID 30? So we've got a VLAN ID 30 here. So something is off there. This actually should be VLAN 20. So let's finish this off and do a show run interface fa, and aha, encapsulation dot1q 30.
So what's happening, and let me bring over this diagram right here, is the demo laptop is pinging out and we're trying to ping demo Pi 2. It's making it all the way to the router, and then the router sees that sub, which is a valid IP. I mean, that's the default gateway that it's supposed to be, and so it recognizes that network and then sends the response out. But when it responds out to that network, to put it onto the VLAN, it tags it with VLAN 30. And so this switch, switch one, figures oh, this is part of VLAN 30, and sends it out to VLAN 30 and not VLAN 20. So demo Pi 2 never receives that, and so it doesn't even have a chance to respond back.
So that's what's happening, is that most of the communication is fine, except for when it passes it from the router to the switch, it passes it tagged with VLAN 30. The switch thinks it's part of VLAN 30, and then it responds to it as if it's on VLAN 30, and we don't have connectivity.
So let's make that change and then let's see if that affects that. So I'm going to get into that interface, interface fa0/1.20, and this is the command I want to change. So I'm going to change that, I want to do 20, and I'm going to hit enter, and instantly like that it came up. Instantly it is now communicating and things are good to go. I have fixed this issue.
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 →