Use the vlan database global configuration command to enter the VLAN database configuration mode.
Syntax
vlan database
Default Configuration
This command has no default configuration.
Command Mode
Global Configuration Mode
User Guidelines
There are no user guidelines for this command.
Example
The following example enters the VLAN database mode.
Console # vlan database
Console (config-vlan)#
vlan
Use the vlan interface configuration (VLAN) command to create a VLAN. To delete a VLAN, use the no form of this command.
Syntax
vlan {vlan-range}
no vlan {vlan-range}
vlan-rangeA list of VLAN IDs to be added. List separate, non-consecutive VLAN IDs separated by commas without spaces. A hyphen designates a range of IDs.
Default Configuration
This command has no default configuration.
Command Mode
Interface Configuration (VLAN) Mode
User Guidelines
The maximum number of VLANs is 4095.
Example
The following example creates VLAN number 1972.
Console # vlan database
Console (config-vlan)# vlan 1972
interface vlan
Use the interface vlan global configuration command to enter the interface configuration (VLAN) mode to configure an existing VLAN.
Syntax
interface vlan vlan-id
vlan-idThe ID of an existing VLAN (excluding GVRP dynamic VLANs).
Default Configuration
This command has no default configuration.
Command Mode
Global Configuration Mode
User Guidelines
There are no user guidelines for this command.
Example
The following example configures the VLAN 1 IP address of 10.1.2.3 and subnet mask 255.0.0.0.
Console (config)# interface vlan 1
Console (config-if)# ip address 10.1.2.3 255.0.0.0
interface range vlan
Use the interface range vlan global configuration command to enter the interface configuration (VLAN) mode with the specified VLAN-list as the context.
Syntax
interface range vlan { vlan-range | all }
vlan-rangeA list of VLAN IDs to add. Separate non consecutive VLAN IDs with a comma and no spaces. A hyphen designates a range of IDs.
allAll existing static VLANs.
Default Configuration
This command has no default configuration.
Command Mode
Global Configuration Mode
User Guidelines
Commands under the interface range context are executed independently on each interface in the range. If the command returns an error on one of the interfaces, an error message is displayed and execution continues on other interfaces.
Example
The following example groups VLAN 221-228 and VLAN 889 to receive the same command.
Console (config)# interface range vlan 221-228, 889
Console (config-if)#
name
Use the name interface configuration command to add a name to a VLAN. To remove the VLAN name, use the no form of this command.
Syntax
name string
no name
stringA VLAN name, up to 32 characters in length.
Default Configuration
No name is defined.
Command Mode
Interface Configuration (VLAN) Mode
User Guidelines
The VLAN name should be unique.
Example
The following example names VLAN interface 19 as Marketing.
Console (config)# interface vlan 19
Console (config-if)# name Marketing
switchport mode
Use the switchport mode interface configuration command to configure a port VLAN membership mode. To reset the mode to the appropriate default for the port, use the no form of this command.
Syntax
switchport mode { access | trunk | general }
no switchport mode
accessPort belongs to a single, untagged VLAN.
trunkPort belongs to 1...n VLANs, all tagged (except, optionally, for a single native VLAN).
generalPort belongs to 1...n VLANs, and each VLAN is explicitly set by the user as tagged or untagged (full 802.1Q mode).
Default Configuration
All ports are in access mode and belong to the default VLAN (whose VID=1).
The following example configures port 1/e8 as an untagged layer 2 VLAN interface.
Console (config)# interface ethernet 1/e8
Console (config-if)# switchport mode access
switchport access vlan
The switchport access vlan interface configuration command configures the VLAN ID when the interface is in access mode. To reconfigure the default, use the no form of this command.
Use the switchport trunk native vlan interface configuration command to define the port as a member of the specified VLAN, and the VLAN ID as the port default VLAN ID (PVID). To configure the default VLANID, use the no form of this command.
Incoming untagged frames are assigned to this VLAN and outgoing traffic from this VLAN is sent untagged (despite the normal situation where traffic sent from a trunk-mode port is all tagged).
The port is added as a member in the VLAN. If the port is already a member in the VLAN (not as a native), it should be removed from the VLAN first.
Example
The following example defines port 1/e8, in trunk mode, and is configured to use VLAN number 123 as the native VLAN.
addvlan-listList of VLAN IDs to add. Separate non-consecutive VLAN IDs with a comma and no spaces. A hyphen designates a range of IDs.
removevlan-listList of VLAN IDs to remove. Separate non-consecutive VLAN IDs with a comma and no spaces. A hyphen designates a range of IDs.
taggedSets the port to transmit tagged packets for the VLANs. If the port is added to a VLAN without specifying tagged or untagged, the default is tagged.
untaggedSet the port to transmit untagged packets for the VLANs.
The following example shows how to add VLANs to the allowed list.
console (config)# interface ethernet 1/e8
Console (config-if)# switchport mode general
Console (config-if)# switchport general allowed vlan add
1,2,5,6 tagged
switchport general pvid
Use the switchport general pvid interface configuration command to configure the Port VLAN ID (PVID) when the interface is in general mode. To configure the default value, use the no form of this command.
Syntax
switchport general pvid vlan-id
no switchport general pvid
vlan-idPVID. The VLAN ID may belong to a non-existent VLAN.
The following example configures the PVID for port 1/e8, when the interface is in general mode.
Console (config)# interface ethernet 1/e8
Console (config-if)# switchport mode general
Console (config-if)# switchport general pvid 234
switchport general ingress-filtering disable
Use the switchport general ingress-filtering disable interface configuration command to disable port ingress filtering. To enable ingress filtering on a port, use the no form of this command.
The following example disables port ingress filtering on port 1/e8.
Console (config)# interface ethernet 1/e8
Console (config-if)# switchport general ingress-filtering
disable
switchport general acceptable-frame-types tagged-only
Use the switchport general acceptable-frame-types tagged-only interface configuration command to discard untagged frames at ingress. To enable untagged frames at ingress, use the no form of this command.
Syntax
switchport general acceptable-frame-types tagged-only
no switchport general acceptable-frame-types tagged-only
The following example configures port 1/e8 to discard untagged frames at ingress.
Console (config)# interface ethernet 1/e8
Console (config-if)# switchport general acceptable-frame-types
tagged-only
switchport forbidden vlan
Use the switchport forbidden vlan interface configuration command to forbid adding specific VLANs to a port. This command prevents GVRP from automatically making these VLANs active on the selected ports. To allow the addition of specific VLANs to the port, use the no form of this command.
addvlan-listList of VLAN IDs to add to the forbidden list. Separate non-consecutive VLAN IDs with a comma and no spaces. A hyphen designates a range of IDs.
removevlan-listList of VLAN IDs to remove from the forbidden list. Separate non-consecutive VLAN IDs with a comma and no spaces. A hyphen designates a range of IDs.