06-VLAN Configuration Commands PDF
06-VLAN Configuration Commands PDF
Table of Contents
Table of Contents
Chapter 1 VLAN Configuration Commands ....................................................................................... 1
1.1 VLAN Configuration Commands........................................................................................... 1
1.1.1 vlan............................................................................................................................. 1
1.1.2 name .......................................................................................................................... 2
1.1.3 switchport pvid............................................................................................................ 3
1.1.4 switchport mode ......................................................................................................... 3
1.1.5 switchport trunk .......................................................................................................... 4
1.1.6 show vlan ................................................................................................................... 6
-I-
VLAN Configuration Commands
z vlan
z name
z switchport pvid
z switchport mode
z switchport trunk
z show vlan
1.1.1 vlan
To add a VLAN, use the vlan command. Use the no form of this command to delete a
VLAN.
Parameter
Parameter Description
vlan-id ID of the VLAN. Range is from 1 to 4094。
Default
none
Command mode
global
Instruction
Use this command to enter VLAN configuration mode and to modify some attributes of
the VLAN.
-1-
VLAN Configuration Commands
Example
1.1.2 name
To assign a name to a VLAN, use the name command. Use the no form of this
command to remove the name assigned to a VLAN.
Parameter
Parameter Description
str Name of the defined VLAN。The name consists of up to 32
characters.
Default
The default VLAN name is ‘Default’. Other VLAN name is VLANxxxx (xxxx is 4-digit
stack ID)
Command mode
Instruction
This command can modify VLAN name to indicate special VLAN according to special
requirements.
Example
-2-
VLAN Configuration Commands
To configure port VLAN of in the access mode, use the switchport pvid command.
no switchport pvid
Parameter
Parameter Description
vlan-id VLAN ID of the port。 Range is from 1 to 4094。
Default
Command mode
Instruction
Vlan of the pvid must exist before configuring this command. The port can be access
mode or frame relay mode.
Example
The following example configures interface fastethernet 0/1 as the access interface of
VLAN 10:
Switch(config)#interface f0/1
Switch(config)#vlan10
Switch(config-f0/1)#switchport pvid 10
Parameter
Parameter Description
access Sets a nontrunking, nontagged single VLAN Layer 2 interface.
-3-
VLAN Configuration Commands
Default
Access mode
Command mode
Instruction
If you enter access mode, the interface goes into permanent nontrunking mode and
negotiates to convert the link into a nontrunk link even if the neighboring interface does
not agree to the change.
If you enter trunk mode, the interface goes into permanent trunking mode and
negotiates to convert the link into a trunk link even if the neighboring interface does not
agree to the change.
If you enter dot1q-tunnel mode, the port is set unconditionally as an 802.1Q tunnel
port.
The switchport mode command conflicts with 802.1X protocol. You cannot configure
802.1X protocol in trunk mode. 802.1X protocol is valid only in access mode.
Example
To set the trunk characteristics, use the switchport trunk commands. To reset all of the
trunking characteristics back to the original defaults, use the no form of this command.
Parameter
Parameter Description
vlan-allowed Sets the list of allowed VLANs that transmit traffic from this
interface in tagged format. Value is from 1 to 4094.
vlan-untagged Sets the list of allowed VLANs that transmit traffic from this
interface in untagged format.Value is from 1 to 4094.
-4-
VLAN Configuration Commands
Default
Command mode
interface configuration
Instruction
You can use this command on an interface no matter it is in access or trunk mode. But
this command is valid only when the interface is in trunking mode.
The vlan-allowed parameter sets the list of allowed VLANs that transmit traffic from this
interface in tagged format. The vlan-untagged parameter sets the list of allowed VLANs
that transmit traffic from this interface in untagged format.
The vlan-list format is all | none | add | remove | except vlan-list[,vlan-list...] where:
•all—Specifies all VLANs from 1 to 1005. Beginning with Cisco IOS Release 12.4(15)T,
the valid VLAN ID range is from 1 to 4094.
•none—Indicates an empty list. This keyword is not supported in the switchport trunk
allowed vlan form of the command.
•add—Adds the defined list of VLANs to those currently set instead of replacing the
list.
•remove—Removes the defined list of VLANs from those currently set instead of
replacing the list.
•except—Lists the VLANs that should be calculated by inverting the defined list of
VLANs.
Example
-5-
VLAN Configuration Commands
Parameter
Parameter Description
id Displays information about a single VLAN that is identified by a
VLAN ID number; valid values are from 1 to 4094.
Default
none
Command mode
Instruction
none
Example
Status: indicates the source of VLAN. Static: indicates the VLAN is formed by
configuration. Dynamic: indicates the VLAN is dynamically formed by GVRP protocol.
-6-
VLAN Configuration Commands
Ports Atttributes
-----------------------------------------------------------------
F0/1 Trunk,Untagged
F0/2 Access
F0/5 Trunk,Untagged
F0/7 Trunk,Tagged
F0/8 Trunk,Tagged
F0/9 Trunk,Tagged
F0/11 Access
F0/12 Access
F0/14 Trunk,Tagged
F0/15 Trunk,Tagged
F0/16 Trunk,Untagged
The following example shows the relevant information about a VLAN on an interface:
Switch#sho vlan int f0/6
Interface VLAN
Name Property PVID Vlan-Map uTagg-VLan-Map
-------------------- -------- ---- ---------------- ----------------
FastEthernet0/6 Trunk 1 3,5,7,9,11,13,15 none
17,19
Switch#sho vlan int f0/7
Interface VLAN
Name Property PVID Vlan-Map uTagg-VLan-Map
-------------------- -------- ---- ---------------- ----------------
FastEthernet0/7 Access 7 7 ----
-7-