Switch ports
Use these M4500 CLI commands to set switch port mode to access or trunk, configure trunk and access VLANs, and display switch port settings.
This section describes the commands used for switch port mode.
switchport mode
This command configures an interface to be operated on VLAN access mode. In this mode, only one VLAN could be assigned to this interface. Use ‘switchport access vlan <vlan-id>’ to configure the access VLAN. In VLAN access mode, only the untagged packets are handled.
| Default | General Mode |
| Format | switchport mode <access | general | trunk> |
| Mode | Interface Config |
no switchport mode
This command sets the mode to General.
| Format | no switchport mode |
| Mode | Interface Config |
switchport trunk allowed vlan
Use this command to configure the list of allowed VLANs that can receive and send traffic on this interface in tagged format when in trunking mode. The default is all.
The VLANs list can be modified using the add or remove options or replaced with another list using the vlan-list, all, or except options. If all is choosen, all VLANs are added to the list of allowed vlan. The except option provides an exclusion list.
Trunk ports accept tagged packets, where tagged packets are processed on the VLAN ID contained in the packet, if this VLAN is in the allowed VLAN list. Tagged packets received with a VLAN ID to which the port is not a member are discarded and MAC learning is not performed. If a VLAN is added to the system after a port is set to the Trunk mode and it is in the allowed VLAN list, this VLAN is assigned to this port automatically.
| Default | All |
| Format | switchport trunk allowed vlan {<vlan-list> | all | add <vlan-list> | remove <vlan-list> | except <vlan-list>} |
| Mode | Interface Config |
| Parameter | Definition |
|---|---|
| All | Specifies all VLANs from 1 to 4093. This keyword is not allowed on commands that do not permit all VLANs in the list to be set at the same time. |
| add | Adds the defined list of VLANs to those currently set instead of replacing the list. |
| remove | Removes the defined list of VLANs from those currently set instead of replacing the list. Valid IDs are from 1 to 4093; extended-range VLAN IDs of the form XY or X, Y, Z are valid in this command. |
| except | Lists the VLANs that should be calculated by inverting the defined list of VLANs. (VLANs are added except the ones specified.) |
| vlan-list | Either a single VLAN number from 1 to 4093 or a continuous range of VLANs described by two VLAN numbers, the lesser one first, separated by a hyphen. |
no switchport trunk allowed vlan
This command resets the list of allowed VLANs on the trunk port to its default value.
| Format | no switchport trunk allowed vlan |
| Mode | Interface Config |
switchport trunk native vlan
Use this command to configure the Trunk port Native VLAN (PVID) parameter. Any ingress untagged packets on the port are tagged with the value of Native VLAN. Native VLAN must be in the allowed VLAN list for tagging of received untagged packets. Otherwise, untagged packets are discarded. Packets marked with Native VLAN are transmitted untagged from Trunk port. The default is 1.
| Default | 1 (Default VLAN) |
| Format | switchport trunk native vlan <vlan-id> |
| Mode | Interface Config |
no switchport trunk native vlan
Use this command to reset the switch port trunk mode native VLAN to its default value.
| Format | no switchport trunk native vlan |
| Mode | Interface Config |
switchport access vlan
Use this command to configure the VLAN on the Access port. Only one VLAN can be assigned to the Access port. Access ports are members of VLAN 1 by default. Access ports may be assigned to a VLAN other than VLAN 1. Removing the Access VLAN on the switch makes the Access port a member of VLAN 1. Configuring an Access port to be a member of a VLAN that does not exist results in an error and does not change the configuration.
| Default | 1 (Default VLAN) |
| Format | switchport access vlan <vlan-id> |
| Mode | Interface Config |
no switchport access vlan
This command sets the access VLAN ID to 1.
| Format | no switchport access vlan |
| Mode | Interface Config |
show interfaces switchport
Use this command to display the switchport status for all interfaces or a specified interface.
| Format | show interfaces switchport [<slot/port> | port-channel <trunk-id>] |
| Mode | Privileged EXEC |