Command Reference VLAN Commands
2 VLAN0002 STATIC Gi0/1
20 VLAN0020 STATIC Gi0/1
Adds the interface to a VLAN.
Use this command to configure an interface as a static access port and assign it to a VLAN. Use the
no or default form of the command to assign the port to the default VLAN.
switchport access vlan vlan-id
no switchport access vlan
default switchport access vlan
The VLAN ID at which the port to be added.
By default, the switch port is an access port and the VLAN is VLAN 1.
Interface configuration mode.
Enter one VLAN ID. The system will create a new one and add the interface to the VLAN if you enter
a new VLAN ID. If the VLAN ID already exists, the command adds the port to the VLAN.
If the port is a trunk port, the operation does not take effect.
Ruijie(config)# interface gigabitethernet 1/1
Ruijie(config-if)# switchport access vlan 2
Specifies the interface as Layer 2 mode (switch
port mode).
Specifies a native VLAN and the allowed-VLAN
list for the trunkport.