148
5.2.2 VLAN Configuration Commands 5.2.2.1 vlan
Command: vlan <vlan-id>[name <vlan-name>]
no vlan <vlan-id>[name]
Function: Create a VLAN and enter VLAN configuration mode, and can set VLAN name.
In VLAN Mode, the user can assign the switch port to the VLAN. The “no vlan
<vlan-id>” command deletes specified VLANs.
Parameter: <vlan-id> is the VLAN ID to be created/deleted, valid range is 1 to 4094.
<vlan-name> is the name that create VLAN, valid range is 1 to 16 characters
Command mode: Global Mode
Default: Only VLAN1 is set by default.
Usage Guide: VLAN1 is the default VLAN and cannot be configured or deleted by the
user. The allowed VLAN number is 4094. It should be noted that dynamic VLANs learnt by
GVRP cannot be deleted by this command.
Example: Create VLAN100 and enter the configuration mode for VLAN 100.
Switch(Config)#vlan 100
Switch(Config-Vlan100)#
5.2.2.2 switchport access vlan
Command: switchport access vlan <vlan-id>
no switchport access vlan
Function: Add the current Access port to the specified VLAN, the “no switchport access
vlan” command delete the current port from the specified VLAN, and the port will be
partitioned to VLAN1.
Parameter: <vlan-id> is the VID for the VLAN to add current port, valid range is 1 to
4094.
Command mode: Interface Mode
Default: All ports belong to VLAN1 by default.
Usage Guide: Only ports in Access mode can join specified VLANs, and an Access port
can only join one VLAN at a time.
Example: Add some Access port to VLAN100.
Switch(Config)#interface ethernet 1/8