Layer 3 switching enables inter-VLAN routing directly on a capable switch using Switch Virtual Interfaces (SVIs), eliminating the need for an external router. This topic covers how Layer 3 switching works and how to configure it on a Cisco 3750.
Layer 3 Switching
In this module so far we've talked about legacy routing and how to set up legacy routing. We talked about router on a stick and how to set that up. Now let's get into a layer 3 switch. This is the more common setup out there when you get to a larger organization.
A layer 3 switch is a switch that has the capability of doing routing. In this case right here, I have 2960s sitting out here and I have a 3750, and this 3750 is a layer 3 switch, which means it has the capability of routing between networks. My 2960s do not. So with the 3750 we're able to set up layer 3 switching.
A layer 3 switch is that you have switch virtual interfaces within your switch. I'm going to use the red to symbolize that there's virtual interfaces inside of this switch, and you have a virtual interface for VLAN 10, one for 20, one for 30, one for 40 — one for each of your VLANs. What will happen then is that it will establish a routing table. So when a frame comes into the switch and the packet needs to go to another VLAN, then it will move it from one VLAN to the next using these SVIs, the switch virtual interfaces. That's essentially how it works: you have a routed interface in the form of an SVI on the back end, and it is routing between those.
The advantage of this over other situations that we've had is, number one, we don't have the complexity in the wiring. We don't have to have multiple lines going up to the router. We also don't have to configure the router to be able to have a trunk line.
But perhaps one of the biggest advantages to this is that between your VLANs you have the speed of the backplane. What I mean by that is this ethernet connection between these two devices has a certain speed — that's maybe a hundred Meg, maybe a gig, but there's a limitation to that, and that limitation is most likely quite a bit less than the backplane of this switch right here. Typically on a switch you've got this much faster speed between your connections, so maybe it's a 10 gig backplane, maybe it's a 40 gig backplane. And with these nicer switches the backplane is a true backplane, where from one switch port to another you get the full 10 gigs; it's not split amongst all of your different switch ports. So you can get much faster speeds with this, which is one of the reasons why it is the preference.
The other thing too with this is it's fairly simple to implement this and to get this set up and running, so it takes away some of the complexity from that and just makes things more scalable. So this really is a more common way of setting it up when you start getting into the larger enterprise and campus area networks.
Now, how is this set up on your switch? It's actually really easy. I am on my demo laptop right here. I have now consoled into my switch 1, and I'm using my console cable to get into there because we may break connectivity — we're going to change the IP address of the management interface. So I'm consoled into it and we're going to configure it.
I'm pinging down here. I'm pinging demo Pi 1 and I can see that I have access to it, because it's on the same VLAN. I'm also pinging demo Pi 2 and I don't have access to it right now, because I don't have any kind of routing setup on here.
So I'm on my switch. You've actually already configured one of these before, so let's take a look at the SVI that we've already configured on our switch. I'm going to scroll here. It first of all goes through all the VLAN configurations, then all the interfaces. There's quite a few interfaces on here — 52 interfaces. Those are physical interfaces. And then I get down to my management interface. This is interface VLAN 10, and it has an IP address of 10.1.10.11 and a subnet mask of 255.255.255.0. So that is configured on this device.
What we want to do is configure a default gateway. We want to configure this as being a default gateway, so I'm going to configure it to be 10.1.10.1. And then we also want to configure it for VLAN 20, because we want to route between those two networks. So let's go ahead and do that. I'm going to get into the global configuration mode. I want to get into VLAN 10, so I'll get into VLAN 10. I want pretty much this IP address right here, so I'm going to do that right there, and I'll do 10.1.10.1.
I am connected into this switch virtually — I'm SSHed into it right here — so we'll see what happens to that connectivity when we change this. I'm going to hit enter on this to make it happen. And then we also want to change VLAN 20, and it's a similar default gateway for that one, so I'm going to just copy this right here, and then 10.1.20.1, and we'll configure that right there.
So I've got those two. I can see, if I pull this up, that when I did that I lost connectivity. So I don't have connectivity — in fact, it'll pop up with an error message here in a second.
There is one more step. As you can see, it's not routing between these devices yet. In fact, I can do show ip route, which shows my routing table, and I can see that it really hasn't anything in there; the routing table is not set up. And there was my notification that I lost connectivity.
So I'm going to exit out of here, and the last command I need to do is ip routing. So I'm going to do ip routing, and this tells the machine that it's going to be a layer 3 switch. And look — instantly, or almost instantly, we now can ping demo laptop 2. So the setup of this is really quite easy.
Now let's take a look at the do show ip route. Let's take a look at the routing table, and we can see that it is populated now. So we have connectivity of our different devices out there. We did it: everything is functioning and we can communicate across. So layer 3 switches can actually be pretty simplistic to set up. And if we wanted all of our VLANs to communicate, then we could do that as well.
One other thing that I'll show you that we can do as well on here: I'm going to get back into the interface. I'm going to get into interface VLAN, and the other thing I can do is set an IP address on here. So I'm going to do show run interface VLAN 10, and I'm going to change this back to .11. And I'm going to show you that there's this secondary right here. So what I can actually do on this interface is I can do a secondary, hit enter, and now take a look at my running config. Now I have this entered in as a secondary, so I still can remote into this machine. I can come in here and restart this interface using that original IP address that I set for it, but then also have the 10.1.10.1 be the default gateway for this. So I've got both now, and it's set up to do both, so I can have two IP addresses on there.
That's just a side note, but anyways, that's how you set up these switch virtual interfaces on the layer 3 switch. Then you type in ip routing, and now your device is set up and it is routing.
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 →