VLAN Configuration

Configuring VLANs in a network of Cisco switches requires just a few simple steps:

Step 1 Create the VLAN itself.

Step 2 Associate the correct ports with that VLAN.

The challenge relates to how some background tasks differ depending on how the Cisco VLAN Trunking Protocol (VTP) is configured, and whether normal-range or extended-range VLANs are being used.

Using VLAN Database Mode to Create VLANs

To begin, consider Example 2-1, which shows some of the basic mechanics of VLAN creation in VLAN database configuration mode. VLAN database configuration mode allows the creation of VLANs, basic administrative settings for each VLAN, and verification of VTP configuration information. Only normal-range (VLANs 1-1005) VLANs can be configured in this mode, and the VLAN configuration is stored in a Flash file called vlan.dat.

Example 2-1 demonstrates VLAN database configuration mode, showing the configuration on Switch3 from Figure 2-1. The example shows VLANs 21 and 22 being created.

Figure 2-1 Simple Access and Distribution

VLAN 21 VLAN 22

Subnet 10.1.21.X/24 Subnet 10.1.22.X/24

Figure 2-1 Simple Access and Distribution

VLAN 21 VLAN 22

Subnet 10.1.21.X/24 Subnet 10.1.22.X/24

Create Vlan

Example 2-1 VLAN Creation in VLAN Database Mode-Switch3

! Below, note

that FA 0/12 and FA0/24 missing

from the

list, because they have

! dynamically

become trunks, supporting multiple VLANs

Switch3# 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

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

Example 2-1 VLAN Creation in VLANDatabase Mode-Switch3 (Continued)

! Below, "unsup" means that this 2950 switch does not support FDDI and TR

! Below, vlan database moves user to VLAN database configuration mode.

! The vlan 21 command defines the VLAN, as seen in the next command output

! (show current), VLAN 21 is not in the "current" VLAN list.

Switch3# vlan database

Switch3(vlan)# vlan 21

VLAN 21 added:

Name: VLAN0021

! The show current command lists the VLANs available to the IOS when the switch ! is in VTP Server mode. The command lists the VLANs in numeric order, with ! VLAN 21 missing. Switch3(vlan)# show current VLAN ISL Id: 1 Name: default Media Type: Ethernet VLAN 802.10 Id: 100001 State: Operational MTU: 1500

Backup CRF Mode: Disabled Remote SPAN VLAN: No

VLAN ISL Id: 1002 Name: fddi-default Media Type: FDDI VLAN 802.10 Id: 101002 State: Operational MTU: 1500

Backup CRF Mode: Disabled Remote SPAN VLAN: No ! Lines omitted for brevity

! Next, note that show proposed lists VLAN 21. The vlan 21 command ! creates the definition, but it must be "applied" before it is "current". Switch3(vlan)# show proposed VLAN ISL Id: 1 Name: default Media Type: Ethernet VLAN 802.10 Id: 100001 State: Operational MTU: 1500

Backup CRF Mode: Disabled Remote SPAN VLAN: No

1002 fddi-default

1003 token-ring-default

1004 fddinet-default

1005 trnet-default act/unsup act/unsup act/unsup act/unsup

Example 2-1 VLAN Creation in VLAN Database Mode-Switch3 (Continued)

VLAN ISL Id: 21 Name: VLAN0021 Media Type: Ethernet VLAN 802.10 Id: 100021 State: Operational MTU: 1500

Backup CRF Mode: Disabled Remote SPAN VLAN: No ! Lines omitted for brevity

! Next, you could apply to complete the addition of VLAN 21, ! abort to not make the changes and exit VLAN database mode, or ! reset to not make the changes but stay in VLAN database mode. Switch3(vlan)# ?

VLAN database editing buffer manipulation commands: abort Exit mode without applying the changes apply Apply current changes and bump revision number exit Apply changes, bump revision number, and exit mode no Negate a command or set its defaults reset Abandon current changes and reread current database show Show database information vlan Add, delete, or modify values associated with a single VLAN vtp Perform VTP administrative functions. ! The apply command was used, making the addition of VLAN 21 complete. Switch3(vlan)# apply APPLY completed.

! A show current now would list VLAN 21. Switch3(vlan)# vlan 22 name ccie-vlan-22

VLAN 22 added:

Name: ccie-vlan-22

! Above and below, some variations on commands are shown, along with the ! creation of VLAN 22, with name ccie-vlan-22.

! Below, the vlan 22 option is used on show current and show proposed

! detailing the fact that the apply has not been done yet. Switch3(vlan)# show current 22 VLAN 22 does not exist in current database Switch3(vlan)# show proposed 22

VLAN ISL Id: 22 ! Lines omitted for brevity

! Finally, the user exits VLAN database mode using CTRL-Z, which does ! not inherently apply the change. CTRL-Z actually executes an abort. Switch3(vlan)# "Z

Using Configuration Mode to Put Interfaces into VLANs

To make a VLAN operational, the VLAN must be created, and then switch ports must be assigned to the VLAN. Example 2-2 shows how to associate the interfaces with the correct VLANs, once again on Switch3.

NOTE At the end of Example 2-1, VLAN 22 had not been successfully created. The assumption for Example 2-2 is that VLAN 22 has been successfully created.

Example 2-2 Assigning Interfaces to VLANs-Switch3

! First, the switchport access command assigns

the VLAN numbers to the

! respective interfaces.

Switch3# config t

Enter configuration commands, one per line. End with

CNTL/Z.

Switch3(config)# int fa 0/3

Switch3(config-if)# switchport access vlan 22

Switch3(config-if)# int fa 0/7

Switch3(config-if)# switchport access vlan 21

Switch3(config-if)# *Z

! Below, show vlan brief lists these same two

interfaces as now being in

! VLANs 21 and 22, respectively.

Switch3# show vlan brief

VLAN Name Status

Ports

1 default active

Fa0/1,

Fa0/2, Fa0/4, Fa0/5

Fa0/6,

Fa0/8, 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

! Lines omitted for brevity

! While the VLAN configuration is not shown in

the running-config at this point,

! the switchport access command that assigns the VLAN

for the interface is in the

! configuration, as seen with the show run int

fa 0/3

command.

Switch3# show run int fa 0/3

interface FastEthernet0/3

switchport access vlan 22

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

Example 2-3 Creating VLANs in Configuration Mode-Switch3 (Continued)

! 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.

Continue reading here: VTP Process and Revision Numbers

Was this article helpful?

0 0

Readers' Questions

  • iggi semhar
    What cisco ios command is used to create a vlan and enter into vlan configuration mode?
    8 months ago
  • The command is "vlan <vlan_id>" to create a VLAN and "configure terminal" to enter into VLAN configuration mode.
    • quinto
      Which cisco command lists configured vlans on a switch?
      8 months ago
    • show vlan brief