Back to Command Reference
Interface ConfigDomain 2.0

switchport access vlan [vlan-id]

Binds a static access interface to a specific Layer 2 broadcast domain. Any untagged frames entering this port are immediately mapped to the specified VLAN ID inside the switch's MAC address forwarding architecture.

Quick Reference

Execution ModeSwitch(config-if)#
Prerequisite Modeswitchport mode access
Default Factory ValueVLAN 1
Negation Commandno switchport access vlan

Syntax & Parameters

switchport access vlan [vlan-id]
ParameterDescription & Operational Limits
[vlan-id]The active VLAN number to associate with the port.

• Valid range encompasses 1 to 4094.

• Cannot use reserved system tokens (1002 - 1005).

CLI Deployment Scenarios

Scenario 1: Standard Assignment

You need to map interface GigabitEthernet 0/4 into the pre-existing Sales broadcast domain on VLAN 30.

Switch(config)# interface g0/4
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 30

Scenario 2: The Magic Auto-Creation Feature

You assign a port to a VLAN that hasn't actually been created in the switch's database yet. Cisco IOS will build it on the fly.

Switch(config)# interface g0/12
Switch(config-if)# switchport access vlan 45
% Access VLAN 45 not existing. Creating vlan 45...
! Note: While the VLAN is created, it will not have a custom descriptive name. It will default to "VLAN0045".

CCNA Exam Gotchas

[!]

Reverting Default Behavior vs. Port Orphans

Executing no switchport access vlan on an interface safely resets the port's logical assignment back to factory standard VLAN 1. However, explicitly executing no vlan [id] globally isolates the port from the database, turning it into an inactive orphan interface that cannot send or receive frames. Cisco loves testing this subtle contrast.

[!]

The SVI Contrast

Do not confuse an access port configuration with a Layer 3 Switch Virtual Interface (SVI). Entering interface vlan 30 moves you into an IP routing interface context. To place a hardware switch port into a VLAN domain, you must use interface g0/x followed by the switchport access vlan 30 command sequence.