Configure and verify VLANs

Creating a VLAN, putting ports in it, and reading back what the switch actually did, including the case where a port names a VLAN nobody created.

In Daveth Pro (Network)11 min video · lab: VLANs

Watch this lesson

11 min · Video walkthrough

Preview

Upcoming practical lab

VLANs

Opens after this topic · First lab on the topic · One switch and three PCs

Free sample lab
View topology, objectives and expected results

One switch, three desks. PC1 and PC2 belong to sales, PC3 to engineering, and the two teams must not see each other's traffic. Buying a second switch would do it. A VLAN does the same thing inside the one you have.

What you will do

  1. Name the switch and address the three PCs on one network
  2. Read which VLAN every port starts in
  3. Create two VLANs and put each port in its VLAN
  4. Test the wall from PC1, then read the switch back
  5. Move PC3 to sales without touching either PC
  6. Give desk 1 a voice VLAN for an IP phone, then save

What it looks like when it works

PC1 still reaches PC2 and no longer reaches PC3, although nothing about PC3's address changed. Then PC3 joins sales and is reachable again, and port 1 carries data in VLAN 10 and calls in VLAN 30.

Open the free labNo account needed. The bench opens on this lab. It needs a computer: phones and tablets are not supported.

Monday, after lunch

Monday, 2:00. Maya is back from lunch, a long one, as usual. Sam, the new starter, has been thinking about this morning's VLANs and asks the question out loud, as Sam does: "Who actually put the kiosk's port in VLAN 20?"

Maya did, a while back. Somebody typed each VLAN, and each port's VLAN, and that somebody was her. She could show Sam on LAB-SW1, but people are working on it, and one slip there would cut somebody off. So she fetches the spare switch from the cupboard, the one that would replace LAB-SW1 if it ever died. It has never had a VLAN configured, and nobody has given it a name, so its prompt is a plain Switch#.

The plan: give the spare LAB-SW1's VLANs, port for port, so it's ready to swap in. Here's LAB-SW1's layout from Maya's notebook. VLAN 10 is named OFFICE, and VLAN 20 GUEST.

PortOn LAB-SW1VLAN
Fa0/1Maya's desk10 OFFICE
Fa0/2Noor's desk10 OFFICE
Fa0/3the printer10 OFFICE
Fa0/4the guest kiosk20 GUEST
Fa0/5Sam's desk, by the window10 OFFICE
Fa0/6a spare desk10 OFFICE
Fa0/7a spare desk10 OFFICE
Fa0/8R1, guest side20 GUEST
Gi0/1SW2, down the hallway10 OFFICE
Gi0/2R1, office side10 OFFICE

The same layout, drawn. R1 has two cables into LAB-SW1: Fa0/8 in VLAN 20 and Gi0/2 in VLAN 10. The spare, bottom right, has no cables: every terminal on this page is the spare's, prompt Switch#.

Nobody practises on the switch the whole office is using. Not twice, anyway.

One idea runs through the whole afternoon. A command you type is a claim about what you want. A show command is the switch's evidence of what it's actually doing. Maya checks one against the other.

A switch with no VLAN configuration

A switch needs no configuration at all to work. Cable it, switch it on, and it forwards frames, even when it's joined to other switches. That lasts until you need more than one VLAN. Most company networks do, and that's when configuration comes in.

Until someone configures it, every port's access VLAN is VLAN 1. That's what the default VLAN means. The command that picks a port's VLAN, switchport access vlan, has a default setting, and it's 1. Nobody creates VLAN 1; every port simply starts in it.

It's basically like a new open-plan office: everyone in one room, hearing everyone else, until somebody puts up partitions. (Where it stops: a VLAN's partitions are configuration. No cable, desk or wall moves.)

show vlan brief lists the VLANs a switch knows. Here's the spare's, before anyone has touched it:

Switch# show vlan brief
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Gi0/1, Gi0/2
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup
Switch#

Read it one column at a time. VLAN and Name identify each VLAN; VLAN 1's name is default. Status gives the VLAN's state: active. Ports lists the access ports in each VLAN, and all ten of the spare's are in VLAN 1.

Then there are four VLANs nobody created, 1002 to 1005. They came with the switch, as VLAN 1 did, and none of those five can be deleted. VLAN 1 can be used. VLANs 1002 to 1005 can't be used as access VLANs today. Their status reads act/unsup, where unsup means unsupported.

Ten ports, one VLAN, and four VLANs nobody asked for.

One thing the output doesn't tell you: whether anything is plugged in. The spare isn't cabled to anything, and it still lists all ten ports. show interfaces status (02.8) is the one that says connected or notconnect.