Home > Articles > Cisco Certification > CCNA Routing and Switching > CCNA Self-Study (ICND Exam): Extending Switched Networks with Virtual LANs

CCNA Self-Study (ICND Exam): Extending Switched Networks with Virtual LANs

Chapter Description

Steve McQuerry discusses how VLANs operate to provide more effective networks by controlling broadcasts in your network.

VLAN Configuration

This section discusses the guidelines for configuring VLANs on the Catalyst switch. You will learn the steps to configure VLANs, how to enable VTP domains, how to define a trunk, how to create a VLAN, and how to verify proper VLAN operation.

You should remember several facts before you begin VLAN configuration:

  • The maximum number of VLANs that can operate on a switch is switch-dependent.

  • VLAN1 is one of the factory default VLANs.

  • Cisco Discovery Protocol (CDP) and VTP advertisements are sent on VLAN1.

  • The switch must be in VTP server mode or transparent mode to create, add, or delete VLANs.

VLAN Configuration Guidelines

The Catalyst switches have a factory default configuration in which various default VLANs are preconfigured. One of the default VLANs is VLAN1, which is used for CDP and VTP advertisements. The VLAN1 interface on a switch is also in the default VLAN1. As you'll recall, the switch requires an IP address for management purposes—for example, to allow Telnet connections into the switch, or to use the Visual Switch Manager (VSM) via an HTTP browser to configure the switch.

Before you can create a VLAN, the switch must be in VTP server mode or VTP transparent mode. If you want to propagate the VLAN to other switches in the domain, use server mode.

VLAN Configuration Steps

Before you create VLANs, you must decide whether to use VTP to maintain global VLAN configuration information for your network.

To allow VLANs to span multiple Catalyst switches on a single link, you must configure trunks to interconnect the switches.

By default, a switch is in VTP server mode so that VLANs can be added, changed, or deleted. If the switch is set to VTP client mode, VLANs cannot be added, changed, or deleted from that switch.

VLAN membership on the switch ports is assigned manually on a port-by-port basis. When you assign switch ports to VLANs using this method, it is known as port-based, or static, VLAN membership.

The following sections elaborate on the details of the steps to configure VLANs.

VTP Configuration Guidelines

The default VTP configuration parameters for the Catalyst switch are as follows:

  • VTP domain name: None

  • VTP mode: Server

  • VTP password: None

  • VTP pruning: Disabled

  • VTP trap: Disabled

The VTP domain name can be specified by the administrator or learned across a configured trunk line from a server with a domain name configured. By default, the domain name is not set.

By default, the switch is set to the VTP server mode.

A password can be set for the VTP management domain. The password entered must be the same for all switches in the domain. If you configure a VTP password, VTP does not function properly unless you assign the same password to each switch in the domain.

VTP pruning eligibility is one VLAN parameter advertised by the VTP protocol. Enabling or disabling VTP pruning on a VTP server propagates the change throughout the management domain. Enabling or disabling VTP pruning on a VTP server affects the entire management domain.

VTP trap is disabled by default. If you enable this feature, it causes an SNMP message to be generated every time a new VTP message is sent.

CAUTION

When adding a new switch to an existing domain, you should verify that the configuration revision number for the switch is 0 to prevent the new switch from propagating incorrect VLAN information. Example 3-1, in the "How VTP Works" section, demonstrated one method for resetting the VTP configuration revision number on the new switch.

Configuring VTP

Use the vtp global configuration command to specify the operating mode, domain name, password, generation of traps, and pruning capabilities of VTP. The syntax for this command is as follows:

switch(config)# vtp { [mode {server | transparent | client}] [domain domain-name]
 [password password] [pruning {enable | disable}]}

To verify a recent configuration change, or to just view the VTP configuration information, use the show vtp status privileged EXEC command, as demonstrated in Example 3-2. Also displayed is the IP address of the device that last modified the configuration and a time stamp showing when the modification was made. VTP has two versions:

  • VTP version 1 only supports Ethernet.

  • VTP version 2 supports Ethernet and Token Ring.

Example 3-2 show vtp status Output

Switch#show vtp status
VTP Version           : 2
Configuration Revision     : 5
Maximum VLANs supported locally : 250
Number of existing VLANs    : 10
VTP Operating Mode       : Server
VTP Domain Name         : switch_domain_1
VTP Pruning Mode        : Disabled
VTP V2 Mode           : Disabled
VTP Traps Generation      : Disabled
MD5 digest           : 0x1E 0xED 0x19 0x49 0x0F 0x37 0x65 0x64 
Configuration last modified by 192.168.255.21 at 3-1-93 00:02:39
Local updater ID is 192.168.255.21 on interface Vl1 (lowest numbered 
 VLAN interface found)

Trunk Line Configuration

Use the command switchport mode trunk at the interface configuration mode to set a port to trunk. On the Catalyst 2950, this enables 802.1Q trunking. On other Cisco IOS Software-based switches, such as the 3550, 4500, or 6500, you will need to choose an encapsulation method before you can enable trunking. The command switchport trunk encapsulation [isl | dot1q] chooses an encapsulation mode.

The Catalyst IOS switches also support Dynamic Trunking Protocol (DTP), which manages automatic trunk negotiation. The switchport mode command specifies a Layer 2 ports operation:

switch(config-if)# switchport mode [trunk | access | dynamic 
 [desirable | auto | nonegotiate]]

The options for the switchport mode command are as follows:

  • trunk—Configures the port to permanent trunk mode and negotiates with the connected device on the other side to convert the link to trunk mode. If multiple trunk encapsulations are available, the encapsulation must be chosen before this command will work.

  • access—Disables port trunk mode and negotiates with the connected device to convert the link to nontrunk. This port will belong to only the configured access VLAN.

  • dynamic desirable—Triggers the port to negotiate the link from nontrunk to trunk mode. The port negotiates to a trunk port if the connected device is in the trunk, dynamic desirable, or dynamic auto state. Otherwise, the port becomes a nontrunk port. This is the default for IOS switch ports

  • dynamic auto—Enables the port to become a trunk only if the connected device has the state set to trunk or dynamic desirable.

  • nonnegotiate—Configures the port to permanent trunk mode. No negotiation takes place with the partner. The other side must be trunk or nonegotiate for the trunk to work. You must also specify the encapsulation before choosing this mode.

Verifying Trunk Line Configuration

To verify a trunk configuration, use the command show interface switchport or show interface trunk privileged EXEC command. The syntax for the show interface switchport and privileged EXEC command is as follows:

switch(config)# show interface [type module/port] switchport

The syntax for the show interface trunk and privileged EXEC command is as follows:

switch(config)# show interface [type module/port] trunk

These commands display the trunk parameters, as demonstrated in Example 3-3.

Example 3-3show interface trunk and show interface switchport Output

Switch#show interface trunk

Port   Mode     Encapsulation Status    Native vlan
Fa0/1   on      802.1q     trunking   1
Gi0/1   on      802.1q     trunking   1

Port   Vlans allowed on trunk
Fa0/1   1-4094
Gi0/1   1-4094

Port   Vlans allowed and active in management domain
Fa0/1   1,101,202,303,404,505
Gi0/1   1,101,202,303,404,505

Port   Vlans in spanning tree forwarding state and not pruned
Fa0/1   1,101,202,303,404,505
Gi0/1   1,101,202,303,404,505

Switch#show interfaces fastEthernet 0/1 switchport 
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
Administrative private-vlan host-association: none 
Administrative private-vlan mapping: none 
Operational private-vlan: none 
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001

Protected: false

Voice VLAN: none (Inactive)
Appliance trust: none

Adding a VLAN

Use the vlan global configuration command to configure a VLAN. The syntax for the vlan global configuration command is as follows:

Switch(config)#vlan number
Switch(config-vlan)#[name | mtu | shutdown | exit]

Each VLAN has a unique four-digit ID that can be a number from 0001 to 4096. To add a VLAN to the VLAN database, assign a number and name to the VLAN. After creating the VLAN, you will be in VLAN configuration mode. In this mode, use the name command to give the VLAN a name. VLAN1, VLAN1002, VLAN1003, VLAN1004, and VLAN1005 are the factory default VLANs. These VLANs exist on all Catalyst switches and are used as default VLANs for other topologies, such as Token Ring and FDDI. None of the default VLANs can be modified or deleted.

To add an Ethernet VLAN, you must specify at least a VLAN number. If no VLAN name is entered for the VLAN, the default is to append the VLAN number to the word VLAN. For example, VLAN0404 could be a default name for VLAN404 if no name is assigned.

Remember that to add, change, or delete VLANs, the switch must be in VTP server or transparent mode.

Verifying a VLAN/Modifying VLAN Parameters

When the VLAN is configured, the parameters for that VLAN should be confirmed to ensure validity. To verify the VLAN's parameters, use the show vlan id vlan# privileged EXEC command to display information about a particular VLAN. Use show vlan to show all configured VLANs.

The show vlan command output in Example 3-4 also shows which switch ports are assigned to the VLAN.

Example 3-4 show vlan Output

Switch#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1  default                            active    Fa0/2, Fa0/3, Fa0/4, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Gi0/2
101 VLAN0101                          active  
202 VLAN0202                          active  
303 VLAN0303                          active  
404 VLAN0404                          active  
505 VLAN0505                          active  
986 VLAN0986                          active  
1002 fddi-default                     active  
1003 token-ring-default               active  
1004 fddinet-default                  active  
1005 trnet-default                    active  

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet 100001   1500     -      -      -        -    -        0      0  
101  enet 100101   1500     -      -      -        -    -        0      0  
202  enet 100202   1500     -      -      -        -    -        0      0  
303  enet 100303   1500     -      -      -        -    -        0      0  
     
VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
404  enet  100404     1500  -      -      -        -    -        0      0  
505  enet  100505     1500  -      -      -        -    -        0      0  
986  enet  100986     1500  -      -      -        -    -        0      0  
1002 fddi  101002     1500  -      -      -        -    -        0      0  
1003 tr    101003     1500  -      -      -        -    -        0      0  
1004 fdnet 101004     1500  -      -      -        ieee -        0      0  
1005 trnet 101005     1500  -      -      -        ibm  -        0      0  

Remote SPAN VLANs
------------------------------------------------------------------------------


Primary Secondary Type       Ports
------- --------- ----------------- ------------------------------------------

Other VLAN parameters shown in Example 3-4 include the following:

  • Type (default is Ethernet)

  • Security Association ID (SAID), which is used for the FDDI trunk

  • Maximum transmission unit (MTU, where the default is 1500 for Ethernet VLAN)

  • Other parameters used for Token Ring or FDDI VLANs

To modify an existing VLAN parameter (such as the VLAN name), use the same command syntax used to add a VLAN.

In Example 3-5, the VLAN name for VLAN986 is changed to CSR_VLAN.

Example 3-5 Change VLAN Name

Switch# config t
Enter configuration commands, one per line. End with CNTL/Z
Switch(config)#vlan 986
Switch(config-vlan)#name CSR_VLAN

Use the show vlan id 986 command, as demonstrated in Example 3-6, to verify the change.

Example 3-6 Verify VLAN Change

Switch# show vlan id 986

VLAN Name               Status  Ports
---- -------------------------------- --------- -------------------------------
986 CSR_VLAN             active  Fa0/1, Gi0/1

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
986  enet  100986     1500  -      -      -        -    -        0      0  

Remote SPAN VLAN
----------------
Disabled

Primary Secondary Type       Ports
------- --------- ----------------- ------------------------------------------ 

Assigning Ports to a VLAN

After creating a VLAN, you can statically assign a port or a number of ports to that VLAN. A port can belong to only one VLAN at a time.

Configure the VLAN port assignment from the interface configuration mode using the interface command switchport access vlan number, as shown in the following syntax:

Switch(config-if)#switchport access vlan [1-4096 | dynamic]

dynamic means that the Catalyst switch queries a VMPS for VLAN information based on a MAC address. A number in the range of 1 to 4096 would represent the VLAN assignment for the port.

By default, all ports are members of the default VLAN—VLAN1.

Use the show vlan brief privileged EXEC command to display the VLAN assignment for all switch ports, as demonstrated in Example 3-7.

Example 3-7 Displaying VLAN Assignments and Membership for All Switch Ports

Switch#show vlan brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1  default                            active    Fa0/2, Fa0/3, Fa0/4, Fa0/6
                                                Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Gi0/2
101 VLAN0101                          active  
202 VLAN0202                          active  
303 VLAN0303                          active  
404 VLAN0404                          active  
505 VLAN0505                          active  
986 CSR_VLAN                          active  
1002 fddi-default                     active  
1003 token-ring-default               active  
1004 fddinet-default                  active  
1005 trnet-default                    active  

Displaying Spanning Tree Protocol Configuration Status

Use the show spanning-tree privileged EXEC command to display the switch's Spanning Tree Protocol configuration status, as demonstrated in Example 3-8. The basic syntax for the show spanning-tree privileged EXEC command is as follows:

Switch# show spanning-tree [vlan number]

Example 3-8 show spanning-tree Output

Switch# show spanning-tree vlan 1
VLAN0001
 Spanning tree enabled protocol ieee
 Root ID  Priority  0
       Address   0005.00a9.2401
       Cost    8
       Port    13 (GigabitEthernet0/1)
       Hello Time  2 sec Max Age 20 sec Forward Delay 15 sec

 Bridge ID Priority  32769 (priority 32768 sys-id-ext 1)
       Address   000b.5f2a.5a40
       Hello Time  2 sec Max Age 20 sec Forward Delay 15 sec
       Aging Time 300

Interface    Port ID           Designated        Port ID
Name       Prio.Nbr   Cost Sts   Cost Bridge ID      Prio.Nbr
---------------- -------- --------- --- --------- -------------------- --------
Fa0/1      128.1     100 FWD     8 32769 000b.5f2a.5a40 128.1  
Gi0/1      128.13      4 FWD     4 32768 0005.3104.c000 32.65 

Example 3-8 displays various spanning tree information for VLAN1, including the following:

  • Port Fa0/1 and G0/1 are in the forwarding state for VLAN1.

  • The root bridge for VLAN1 has a bridge priority of 0 with a MAC address of 0005.00a9.2401.

  • The switch is running the IEEE 802.1D Spanning Tree Protocol.

Recall that a Catalyst switch can support a separate Spanning Tree instance per VLAN. This allows for load balancing between switches. For example, one switch can be the root for VLAN1, and another switch can be the root for VLAN2.

7. VLAN Command Summary | Next Section Previous Section