Trunk link configuration on Cisco switches controls which VLANs can pass traffic between network segments. This content covers how to enable trunking and manage allowed VLANs on inter-switch connections.
Configuring Trunk Lines
We're going to configure trunk lines on two of our switches so that they can start communicating.
What we have right now is a demo laptop, and that's what we're on right now, and we're plugged into this switch, and we're plugged into VLAN 10, so we're on VLAN 10. All of the management of these different switches is VLAN 10; all the management interfaces are on VLAN 10. However, right now all we can do is connect and ping to the management interface on switch 2, which is this switch right here, because we're plugged into it. We cannot ping the interfaces on switch 1 and switch 3, and the reason being is because these are not set up as a trunk line properly to be able to pass the VLAN traffic across it.
So what we're going to do in here is set this trunk line up to pass VLAN 10 across it, and therefore we should be able to get to the management interface of this switch. As we're doing our configurations on here, I've actually got a ping up down here below, so I'm pinging 10.1.10.11, which is the management interface of this switch right here. So let's go ahead and see if we can configure it and see what happens when we set up the trunk lines to pass VLAN 10 traffic.
What I'm going to do is start out on switch 1. I'm on switch 1, and I'm actually consoled into this because I can't remote into it right now. What I'm going to do is first of all get into the global configuration mode, and we're going to get into the interface fa1/0/43, and that is the interface that's connected into switch 2.
So when we're in there, then we're going to say switchport mode. Remember, before we did switchport mode access to specify an access port. Well, now we're specifying a trunk port, so we're going to type in trunk to specify a trunk port.
Next what we're going to do is switchport trunk allowed vlan 10. We're going to say that VLAN 10 is allowed, and so now this should be showing VLAN 10.
Now, before we jump off, one thing we can do is a show interface fa1/0/43, and I want to look at the switchport settings on there and see what the switchport settings say. As we scroll through here, we see trunking VLANs enabled, trunking for VLAN 10. All right, so that's promising.
So now let's jump over to switch 2 and configure switch 2 and see if we can see any difference with our pings and see if we can get some pings through.
Now on S2 I'm going to type in configure terminal to get into configure terminal, and we are going to configure interface fa1/0/47, because that's the one that's going back to switch 1. All right, so that's the interface we want to configure. So I'm in 0/47, and I'm going to type in switchport mode trunk, and switchport trunk allowed vlan 10.
All right, and so now both interfaces on each side are set up to do trunking of this VLAN 10 across between the two switches. It took a little bit to take effect, but we are now pinging .11. So now we have this trunk line set up between these two switches.
So really it's quite simple. All we need to do is say that it's a trunk line and then list out what VLANs we want to go across that trunk line.
If we wanted to add more than just one VLAN, what we could do is say switchport trunk allowed vlan and then a list of the VLANs that we want to allow. So VLAN 10, let's say we want to do 20, let's say we want to do 30, so it's going to allow VLAN 10, 20 and 30. We hit enter, and now we can do a do show run interface fa1/0/47, and we can actually see how that has added 10, 20 and 30 now to this interface.
If we wanted to remove one of them, then we could take all of these off and put them all back on minus the one that we want to remove. Or, if we take a look at this, what we can actually do is allowed vlan, and we can use the word add or remove. So let's remove, and remove 20 here, and hit enter. Now we can take a look at that and it is just 10 and 30. So we can actually add or remove or replace this line to whatever VLANs we want to go across that trunk line there.
Or if we want none, then we could type in none, as we see there. So allowed vlans and then we could type in none, and none would be allowed. Of course, this would break our connectivity, so let's see what happens when we do that. We type in none, and we can see that it looks like our ping is now timing out, so that removes all of those. So once again, we can add, we can remove, we can replace.
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 →