Using Configuration Mode to Create VLANs
At this point, the two new VLANs (21 and 22) have been created on Switch3, and the two
interfaces are now in the correct VLANs. However, Cisco IOS switches support a different way to
create VLANs, using configuration mode, as shown in Example 2-3.
Example 2-3 Creating VLANs in Configuration Mode–Switch3
! First, VLAN 31 did not exist when the switchport access vlan 31 command was
! issued. As a result, the switch both created the VLAN and put interface fa0/8
! into that VLAN. Then, the vlan 32 global command was used to create a
! VLAN from configuration mode, and the name subcommand was used to assign a
! non-default name.
Switch3# conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch3(config)# int fa 0/8
Switch3(config-if)# switchport access vlan 31
% Access VLAN does not exist. Creating vlan 31
Switch3(config-if)# exit
Switch3(config)# vlan 32
Switch3(config-vlan)# name ccie-vlan-32
Switch3(config-vlan)# ^Z
Switch3# show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/4, Fa0/5
Fa0/6, Fa0/9, Fa0/10, Fa0/11
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23
21 VLAN0021 active Fa0/7
22 ccie-vlan-22 active Fa0/3
31 VLAN0031 active Fa0/8
32 ccie-vlan-32 active
! Portions omitted for brevity
Example 2-3 shows how the switchport access vlan subcommand creates the VLAN, as needed,
and assigns the interface to that VLAN. Note that in Example 2-3, the show vlan brief output lists
fa0/8 as being in VLAN 31. Because no ports have been assigned to VLAN 32 as of yet, the final
line in Example 2-3 simply does not list any interfaces.
The VLAN creation process is simple but laborious in a large network. If many VLANs exist, and
they exist on multiple switches, instead of manually configuring the VLANs on each switch, you
can use VTP to distribute the VLAN configuration of a VLAN to the rest of the switches. VTP will
be discussed after a brief discussion of private VLANs.