Switch Port Commands

Use these commands to configure switch port mode.

This section describes the commands used for switch port mode.

switchport mode

M4250

M4350

Use this command to configure the mode of a switch port as access, trunk, or general:

  • Trunk mode. In trunk mode, the port becomes a member of all VLANs on the switch unless specified in the allowed list in the switchport trunk allowed vlan command. The PVID of the port is set to the native VLAN as specified in the switchport trunk native vlan command. This means that trunk ports accept both tagged and untagged packets. Untagged packets are processed on the native VLAN and tagged packets are processed on the VLAN for which the ID is contained in the packet. MAC learning is performed on both tagged and untagged packets. Tagged packets that are received with a VLAN ID of which the port is not a member are discarded and MAC learning is not performed.

    The trunk ports always transmit packets untagged on a native VLAN.

  • Access mode. In access mode, the port becomes a member of only one VLAN. The port sends and receives untagged traffic. The port can also receive tagged traffic. Ingress filtering is enabled on the port. This means that when the VLAN ID of a received packet is not identical to the access VLAN ID, the packet is discarded.
  • General mode. In general mode, you can perform custom configuration of the VLAN membership, PVID, tagging, ingress filtering, and so on. The general mode is legacy behavior of the switch port configuration and you use legacy CLI commands to configure the port in general mode.
Default General mode
Format switchport mode {access | trunk | general}
Mode Interface Config

no switchport mode

This command resets the switch port mode to its default value.

Format no switchport mode
Mode Interface Config

switchport trunk allowed vlan

M4250

M4350

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.

You can modify the VLAN list by using the add and remove options and replace the VLAN list with another list by using the all or except options. If you use the all option, all VLANs are added to the list of allowed VLANs. The except option provides an exclusion list.

Default all
Format switchport trunk allowed vlan {vlan-list | all | {add vlan-list} | {remove vlan-list} | {except vlan-list}}
Mode Interface Config
Parameter Description
all Specifies all VLANs from 1 to 4093. This keyword is not allowed for 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 must 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

M4250

M4350

Use this command to configure the trunk port native VLAN (PVID) parameter of the switch port. Any ingress untagged packets on the port are tagged with the value of the native VLAN. The native VLAN must be in the allowed VLAN list for tagging of received untagged packets. Otherwise, untagged packets are discarded. Packets marked with the native VLAN are transmitted untagged from the trunk port. The default ID is 1, the default VLAN.

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 trunk mode native VLAN of the switch port to its default value.

Format no switchport trunk native vlan
Mode Interface Config

switchport access vlan

M4250

M4350

Use this command to configure the VLAN on the access port. You can assign one VLAN only to the access port. The access port is a member of VLAN 1 by default. You can assign the access port to a VLAN other than VLAN 1. If you remove the access VLAN on the switch, the access port becomes a member of VLAN 1. If you configure the access port as a member of a VLAN that does not exist, an error occurs and the configuration does not change.

Default 1 (default VLAN)
Format switchport access vlan vlan-id
Mode Interface Config

no switchport access vlan

This command resets the switch port access mode VLAN to its default value.

Format no switchport access vlan
Mode Interface Config

show interface switchport

M4250

M4350

Use this command to either display the switch port status for all interfaces.

Format show interface switchport
Mode Privileged EXEC

Command example:

CODE
(NETGEAR Switch) #show interface switchport
Packets Received Without Error................. 0
Broadcast Packets Received..................... 0
Packets Received With Error.................... 0
Packets Transmitted Without Errors............. 16
Broadcast Packets Transmitted.................. 0
Transmit Packet Errors......................... 0
Packets forwarded by cpu....................... 0
IP Packets received without errors............. 0
Time Since Counters Last Cleared............... 13 day 1 hr 36 min 28 sec

show interfaces switchport

M4250

M4350

Use this command to either display the switch port status for all interfaces, for a specific interface or LAG, or for a specific mode (access, trunk, or general). If you select a specific interface or LAG, you can optionally specify a group ID from 0 to 2 for a protected port group.

If you select a specific mode (access, trunk, or general) but do not specify an interface for the mode, the selected mode is displayed for all interfaces.

To specify an actual interface or port, do the following:

  • For an M4250 series switch, use the argument slot/port.
  • For an M4350 series switch, use the argument unit/slot/port, as shown in the command format.
Format show interfaces switchport [unit/slot/port [group-id] | lag lag-int-num [group-id] | {access | trunk | general} [unit/slot/port]]
Mode Privileged EXEC

Command example:

CODE
(NETGEAR Switch) #show interfaces switchport 1/0/1
Port: 1/0/1
VLAN Membership Mode: General
Access Mode VLAN: 1 (default)
General Mode PVID: 1 (default)
General Mode Ingress Filtering: Disabled
General Mode Acceptable Frame Type: Admit all
General Mode Dynamically Added VLANs:
General Mode Untagged VLANs: 1
General Mode Tagged VLANs:
General Mode Forbidden VLANs:
Trunking Mode Native VLAN: 1 (default)
Trunking Mode Native VLAN tagging: Disable
Trunking Mode VLANs Enabled: All
Protected Port: False

Command example:

CODE
(NETGEAR Switch) #show interfaces switchport access 1/0/1

Intf      PVID
--------- ----
1/0/1     1

Command example:

CODE
(NETGEAR Switch) #show interfaces switchport trunk 1/0/6

Intf      PVID  Allowed Vlans List
--------- ----- -------------------
1/0/6     1     All

Command example:

CODE
(NETGEAR Switch) #show interfaces switchport general 1/0/5

Intf      PVID  Ingress    Acceptable  Untagged  Tagged    Forbidden Dynamic
                Filtering  Frame Type  Vlans     Vlans     Vlans     Vlans
--------- ----- ---------- ----------- --------- --------- --------- ---------
1/0/5     1     Enabled    Admit All   7         10-50,55  9,100-200 88,96

Command example:

CODE
(NETGEAR Switch) #show interfaces switchport general

Intf      PVID  Ingress    Acceptable  Untagged  Tagged    Forbidden Dynamic
                Filtering  Frame Type  Vlans     Vlans     Vlans     Vlans
--------- ----- ---------- ----------- --------- --------- --------- ---------
1/0/1     1     Enabled    Admit All   1,4-7     30-40,55  3,100-200 88,96
1/0/2     1     Disabled   Admit All   1         30-40,55  none      none