4 Command Line Interface

switchport allowed vlan

This command configures VLAN groups on the selected interface. Use the no form to restore the default.

Syntax

switchport allowed vlan {add vlan-list[tagged untagged] remove vlan-list}no switchport allowed vlanadd vlan-list- List of VLAN identifiers to add.remove vlan-list- List of VLAN identifiers to remove.

vlan-list- Separate nonconsecutive VLAN identifiers with a comma and no spaces; use a hyphen to designate a range of IDs. Do not enter leading zeros. (Range: 1-4094).

Default Setting

All ports are assigned to VLAN 1 by default.The default frame type is untagged.

Command Mode

Interface Configuration (Ethernet Ports 1-8, Port Channel)

Command Usage

A port, or a trunk with switchport mode set to hybrid, must be assigned to at least one VLAN as untagged.

If a trunk has switchport mode set to trunk (i.e., 1Q Trunk), then you can only assign an interface to VLAN groups as a tagged member.

Frames are always tagged within the switch. The tagged/untagged parameter used when adding a VLAN to an interface tells the switch whether to keep or remove the tag from a frame on egress.

If none of the intermediate network devices nor the host at the other end of the connection supports VLANs, the interface should be added to these VLANs as an untagged member. Otherwise, it is only necessary to add at most one VLAN as untagged, and this should correspond to the native VLAN for the interface.

If a VLAN on the forbidden list for an interface is manually added to that interface, the VLAN is automatically removed from the forbidden list for that interface.

Example

The following example shows how to add VLANs 1, 2, 5 and 6 to the allowed list as tagged VLANs for port 1:

Console(config)#interface ethernet 1/1 Console(config-if)#switchport allowed vlan add 1,2,5,6 tagged Console(config-if)#

4-174