A VLAN is a group of ports that can be located anywhere in the network, but
communicate as though they belong to the same physical segment. This section
describes commands used to create VLAN groups, add port members, specify how
VLAN tagging is used, and enable automatic VLAN registration for the selected
interface.
Use this command to enter VLAN database mode. All commands in this mode will
take effect immediately.
Default Setting
None
Command Mode
Global Configuration
Command Usage
Use the VLAN database command mode to add, change, and delete VLANs. After
finishing configuration changes, you can display the VLAN settings by entering
the show vlan command.
Use the interface vlan command mode to define the port membership
mode and add or remove ports from a VLAN. The results of these commands are
written to the running-configuration file, and you can display this file by
entering the show running-config command.
Use this command to enable ingress filtering for an interface. Use the no
form to restore the default.
Syntax
switchport ingress-filtering
no switchport ingress-filtering
Default Setting
Disabled
Command Mode
Interface Configuration (Ethernet, Port Channel)
Command Usage
Ingress filtering only affects tagged frames.
If ingress filtering is disabled, the interface will accept any VLAN-tagged
frame if the tag matches a VLAN known to the switch (except for VLANs explicitly
forbidden on this port).
If ingress filtering is enabled, incoming frames tagged for VLANs which
do not include this ingress port in their member set will be discarded.
Ingress filtering does not affect VLAN independent BPDU frames, such as
GVRP or STA. However, they do affect VLAN dependent BPDU frames, such as GMRP.
Example
The following example shows how to set the interface to port 1 and then enable
ingress filtering:
Use the switchport mode command to configure the VLAN membership mode
for a port. Use the no form to restore the default.
Syntax
switchport mode {trunk | hybrid} no switchport mode
trunk - Specifies a port as an end-point for a VLAN trunk. A trunk
is a direct link between two switches, so the port transmits and receives
tagged frames that identify the source VLAN. However, note that frames belonging
to the ports default VLAN (i.e., associated with the PVID) are sent
untagged.
hybrid - Keyword that specifies a hybrid VLAN interface. The port
may receive or transmit tagged or untagged frames.
Default Setting
All ports are in hybrid mode with the PVID set to VLAN 1.
Command Mode
Interface Configuration (Ethernet, Port Channel)
Example
The following shows how to set the configuration mode to port 1, and then
set the switchport mode to hybrid:
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, Port Channel)
Command Usage
If switchport mode is set to 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 2, 5 and 6 to the allowed list
as tagged VLANs for port 1:
Use this command to configure the PVID (i.e., default VID) for a port. Use
the no form to restore the default.
Syntax
switchport native vlanvlan-id no switchport nativevlan
vlan-id - Default VLAN ID for a port. (Range: 1-4094, no leading
zeroes)
Default Setting
VLAN 1
Command Mode
Interface Configuration (Ethernet, Port Channel)
Command Usage
If an interface is not a member of VLAN 1 and you assign its PVID to this
VLAN, the interface will automatically be added to VLAN 1 as an untagged member.
For all other VLANs, an interface must first be configured as an untagged
member before you can assign its PVID to that group.
If acceptable frame types is set to all or switchport mode is set
to hybrid, the PVID will be inserted into all untagged frames entering
the ingress port.
Example
The following example shows how to set the PVID for port 1 to VLAN 3: