3.22.2 Port VLAN Configuration
This command defines the port mode as access (default), trunk, or hybrid unconditionally.
Command Syntax:
switchport mode { access | trunk | hybrid }
Argument | Description | |
Parameter |
|
Configure a switch port to Access mode. |
|
Configure a switch port to Trunk mode. | |
|
Configure a switch port to Hybrid mode. | |
Default |
The switch port default mode is access | |
Mode |
Port List Interface mode | |
Usage |
Set port mode. To revert to the default, use the ‘no’ version of the command. | |
Example |
Example 1: Configure the port 3 mode as trunk.
|
Configure VLAN ID to be added internally by the Switch whenever native VLAN packet (packet with no VLAN header) is received.
Command Syntax:
switchport trunk native vlan <pvid>
switchport hybrid native vlan <pvid>
Argument |
Description | |
Parameter |
|
VLAN ID of the native VLAN when this port is in trunk/hybrid mode. |
Default |
Trunk/Hybrid native default VLAN is VLAN1 | |
Mode |
Port List Interface mode | |
Usage |
Configure a port VLAN ID for a trunk/hybrid port. To revert to the default, use the ‘no’ version of the command. | |
Example |
Example 1: Configure port 3 as trunk with PVID 4.
|
Port in Trunk mode may control the tagging of frames on egress. Options are default Untag Port VLAN (frames classified to the Port VLAN are transmitted untagged and all other frames are transmitted with the relevant tag) and Tag all (all frames transmitted with a tag).
Command Syntax:
switchport trunk vlan tag native
Argument |
Description | |
Parameter |
N.A |
N.A |
Default |
Frames classified to the Port VLAN (Native VLAN) do not get tagged on egress. | |
Mode |
Port List Interface mode | |
Usage |
Set the trunk port egress tagging to all. To revert to the default (untag native VLAN), use the ‘no’ version of the command. | |
Example |
Example 1: Configure port 3 as trunk with PVID 4 and set egress tagging to tag all.
|
Ports in Trunk and Hybrid mode may control which VLANs they are allowed to become members of. By default, Trunk or Hybrid port will become a member of all VLANs (1–4095). The ports can also be configured to never become members of one or more VLANs (forbidden VLANs).
Command Syntax:
switchport trunk allowed vlan { all | none | [ add | remove | except ] <vlan_list> }
switchport forbidden vlan { add | remove } <vlan_list>
Argument |
Description | |
Parameter |
|
all VLANs are allowed (1–4095) |
|
Port will not become member of any VLAN | |
|
Add VLANs to the current list | |
|
Remove VLANs from the current list | |
|
All VLANs except the following (VLAN ID or list) | |
|
VLAN IDs. Individual elements are separated by commas and ranges are specified with a dash. | |
Default |
All VLANs are allowed (1–4095) | |
Mode |
Port List Interface mode | |
Usage |
Configure allowed/forbidden VLANs for a port. To revert to the default, use the ‘no’ version of the command. | |
Example |
Example 1: Configure port 3 as trunk and exclude VLAN 10, 30, 31, and 32 from allowed VLANs.
Example 2: Configure port 3 as trunk and add VLAN 4 to the list of forbidden VLANs.
|
Use this command to specify the port type in Hybrid mode.
Command Syntax:
switchport hybrid port-type { unaware | c-port | s-port | s-custom-port }
Argument |
Description | |
Parameter |
|
Port is not aware of VLAN tags. No matter the received frame is tagged or untagged, port adds a tag (based on PVID) to the frame and then forward it. |
|
Customer port. If the received frame is untagged, the C-port adds a tag (based on the PVID) to the frame and then forwards it. If the frame is already tagged, the C-port forwards it without adding a tag. | |
|
Provider port. Port only accepts untagged frames. If the received frame is untagged, S-port adds a tag (based on PVID) to the frame and then forwards it. If the frame is already tagged, it is discarded. | |
|
Custom provider port. When Ethertype is set to 0x8100, S-custom ports do the same as C-ports: If the received frame is untagged, S-custom port adds a tag (based on PVID) to the frame and then forward it; If the frame is already tagged, it will be forwarded without adding a tag. | |
Default |
Hybrid port type is C-port | |
Mode |
Port List Interface mode | |
Usage |
Configure Hybrid port type. To revert to the default, use the ‘no’ version of the command. | |
Example |
Example 1: Configure port 3 as hybrid Unaware type.
|
Use this command to enable/disable ingress filtering on hybrid ports. Access and Trunk ports always have ingress filtering enabled. Set Ingress acceptance criteria.
Command Syntax:
switchport hybrid ingress-filtering
switchport hybrid acceptable-frame-type { all | tagged | untagged }
Argument |
Description | |
Parameter |
|
Both tagged and untagged frames are accepted |
|
Only frames tagged with the corresponding port type tag are accepted. | |
|
Only untagged frames are accepted. | |
Default |
Ingress filtering disabled. Hybrid port is set to accept all frames (tagged and untagged) | |
Mode |
Port List Interface mode | |
Usage |
Enable ingress filtering and configure type of frames accepted on ingress. To revert to the default, use the ‘no’ version of the command. | |
Example |
Example 1: Configure port 3 as hybrid, enable ingress fltering and accept tagged frames only on ingress.
|
Use this command to configure Egress tagging on Hybrid port.
Command Syntax:
switchport hybrid egress-tag { none | all [ except-native ] }
Argument |
Description | |
Parameter |
|
No Egress tagging. All frames transmitted without a tag. |
|
Tag all frames. All frames are transmitted with a tag. | |
|
Tag all frames except frames classified to native VLAN. | |
Default |
Hybrid port is set to tag all frames except frames classified to native VLAN. | |
Mode |
Port List Interface mode | |
Usage |
Configure egress tagging. To revert to the default, use the ‘no’ version of the command. | |
Example |
Example 1: Configure port 3 as hybrid and set egress tagging to all.
|