TechKnowSurge
Cisco CCNA 2.1
VideoNetworkFree

DEMO: Creating and Assigning VLAN

Covers the process of creating and assigning VLANs on a Cisco switch, including verification commands and VLAN removal procedures.

Complete this video to capture a CTF flag worth 1 point.

About this video

VLAN configuration on a Cisco switch begins with selecting an available VLAN ID and assigning it a name, then entering global configuration mode to create the VLAN. Once the VLAN exists, an individual switch port is configured as an access port and assigned to that VLAN, logically isolating it from the rest of the network. The distinction between access ports, which carry a single VLAN, and trunk ports, which carry multiple VLANs across one interface, is an important part of understanding how traffic is segmented at the switch level. Verifying the configuration relies on several show commands. The show vlan and show vlan brief commands display VLAN membership across all ports, while show vlan summary provides a quick count of active VLANs. Targeting a specific VLAN by ID or name and using show interfaces switchport on a specific port both confirm the access mode assignment and VLAN association, which is useful for troubleshooting. Removing a VLAN involves first disassociating it from any assigned interfaces using the no switchport access vlan and no switchport mode access commands, then deleting the VLAN itself with no vlan followed by the VLAN ID. When wiping a switch entirely, deleting the startup configuration alone is not sufficient to remove VLANs, as they are stored separately in the vlan.dat file on flash memory. Deleting that file ensures all VLAN data is cleared when the switch is reset.

What you'll learn

What's covered

Configuring VLANs on Cisco Switch

Aligned to

Cisco CCNA
2.1 Configure and verify VLANs (normal range) spanning multiple switches

Key terms

Virtual LAN
VLAN
A logical grouping of network devices that behave as if they are on the same network regardless of physical location.
Switch
A network device that connects devices within a LAN and forwards traffic based on MAC addresses.
Access Port
A switch port that belongs to a single data VLAN and sends and receives untagged frames, used for connecting end devices such as PCs and printers. An access port may additionally carry a tagged voice VLAN for an IP phone without becoming a trunk.
Trunk Port
A switch port that carries traffic for multiple VLANs over a single link by tagging frames with their VLAN ID, used between switches or between a switch and a router. All VLANs are tagged except the native VLAN.
VLAN ID
A numerical identifier assigned to a VLAN that distinguishes it from other VLANs on the network.
vlan.dat
A file stored in a Cisco switch's flash memory that contains VLAN configuration data and must be deleted to fully reset the switch to factory defaults.

Topics

Vlan Cisco Ios Network Switching Cisco Cli Network Configuration Networking

Transcript

Choosing a VLAN ID and Name

First of all, I have to choose a VLAN ID and a name. What I'm going to do is choose the first available VLAN ID. VLAN ID 1 is already taken because it's the default VLAN, and that is VLAN 1, so I'm going to go to the next one, which is VLAN 2. I've got a notepad right up here, which I'm actually going to be taking VLAN 2, and I have to give it a name, and we'll just call this demo. So now I've got my documentation taken care of and I can jump over onto the switch and start programming it.

Configuring the VLAN

To configure a VLAN it's really simple. Really, what you need to do is configure a name and then configure an interface to be part of that VLAN. So let's jump in there and do that.

First, what I need to do is go into the global configuration mode. Then I need to get into configuring the VLAN that I want to configure, so in this case right here it's VLAN 2. So it's vlan and then the VLAN ID — the VLAN ID is two. I'm going to hit enter, and then I have to give it a name, so I'm going to call this demo. There you have it.

Assigning an Interface to the VLAN

Next, what we want to do is get into an interface and configure this VLAN on that interface. I'm just going to choose a random interface — I'm going to say port 8. So let's get into port 8 here. I'm going to say interface fa, and then on this switch it's 1 0 8, and jump into there.

Then I need to do two things on this interface. Number one, I need to say that this is an access port, and then number two, assign it to one of the VLANs. To say this is an access port versus a trunk port — a trunk port would have multiple VLANs going across one interface, this is just going to have one VLAN going across it — to do that I'm going to type in switchport and hit enter. Then the next command is switchport access vlan and then the VLAN number. So once again, I'm setting this as an access port, which means it's just going to have one VLAN tied to it, and then it's going to be VLAN 2. I'm going to enter that in. Once I've done that, now this VLAN is set up on the switch.

Show Commands

Let's cover a few show commands that are going to actually show that it is in fact set up on the switch. By the way, what this is is fa108 is on a different network than the rest of the interfaces, and we'll actually see this.

I'm going to do a show vlan — that's the first one. We see VLAN one, and it's the default, and we see all of the interfaces that are associated with it, which is pretty much all of them except for fa108, because that's the default VLAN. VLAN 2 is the demo, and that's the one we assigned to fa108. So yes, we do in fact have two VLANs now. At this point, in fact, we have a few more — these are set up on the Cisco switches by default, so these you'll see on those switches as well.

So we have our VLAN, we have it assigned, and fa108 is part of a different network. It's like it's a whole different switch, whatever's plugged into fa108.

There are a couple other show commands that we'll cover that can help you do some troubleshooting. One of them is show vlan brief. It's pretty much the same thing as the last one, except it just shows you that first table in it, so that can be handy to narrow things down.

I can do a show vlan summary if I just want a quick little synopsis of how many VLANs I have, which is six. If I were to count them up — one, two, three, four, five, six — yes, in fact I do have six, so that all adds up.

I can do a show vlan and either specify the ID of two to just take a look at the information associated with VLAN 2, or I could also do that same command but instead of using the ID I can use the name, and the name is demo, and it gives us the same information.

The last show command that we'll take a look at is show interface and the interface number, which is fa1 0 8, and we want to see the switchport information. This is going to show us a lot of information about the switch port, and a lot of it has to do with the VLAN that it's on and some VLAN information — in fact, a lot of information that we have not covered nor will we cover in CCNA. It's a more advanced topic, like the private VLAN. But we do see that trunking is often, this is an access mode, and it's assigned to port or X VLAN 2 and it's the demo VLAN, so that all adds up there.

Removing the VLAN

Now the next question is, how do we remove this? What we can do is first of all get onto the interface and remove that association with the VLAN. So interface fa108 is what we want, and we say no switchport access vlan 2. So now it's not associated with that VLAN 2. Then we do a no switchport mode access.

Once I remove the configuration from the switch port, I can remove the VLAN altogether. It's a simple little no vlan 2, and then it's gone. If I want to show that it's gone, what I can do is say show vlan, and we can see it no longer exists in the table here — VLAN 2 does not exist anymore. I can also do a show vlan summary and we can see that we only have five VLANs at this point. So I've removed that.

Wiping All VLANs from a Switch

Now let's give the scenario where I'm wiping this switch, where I want to just remove all of the VLANs. If I just delete the startup config file and then restart the switch, those VLANs will actually pop up again. So in that case right there, where I'm wiping the switch altogether and I want to wipe all the VLANs out, then I would use the command delete. I want to delete a file in the flash drive, and that file is vlan.dat. I would hit that and then confirm, and there we have it, it deletes that file altogether, and then all my VLANs would be gone. So when I'm clearing a switch, that's what I would want to do.

About TechKnowSurge

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 →