switchport access vlan

This command configures the specified switch port interface as a static-access member of a VLAN.

Syntax

switchport access vlan <vlan id> 

Command

Description

<vlan id>

Defines a valid VLAN interface ID. Range is 1 to 3999.

Default

A single VLAN interface is available (VLAN 1).

Note

If the port is in the trunk mode, this command will not alter the switchport mode to ‘Access’. Instead it will save the value to be applied when the port does switch to Access mode.

Command Mode

Privileged User

Related Commands

switchport mode

Example

This example sets the switchport mode to static access and makes the GigabitEthernet interface 4/2 port a member of VLAN 3:

(config-data)# interface gigabitethernet 4/2
(conf-if-GE 4/2)# switchport access vlan 3