switchport access vlan [vlan-id]
Assigns a specific VLAN to an access port, placing the port in that VLAN for untagged traffic.
switchport access vlan [vlan-id]When to Use This Command
- Assigning a desktop user to VLAN 10 on a switch port
- Configuring a port for a printer in a separate VLAN
- Setting up a VoIP phone port with a data VLAN
- Reassigning a port from default VLAN 1 to a user VLAN
Command Examples
Assign port to VLAN 10
Switch(config-if)# switchport access vlan 10No output is generated on success. Use 'show interfaces status' or 'show vlan brief' to verify.
Verify VLAN assignment
show interfaces statusPort Name Status Vlan Duplex Speed Type Gi0/1 Desktop-PC connected 10 a-full a-100 10/100/1000BaseTX Gi0/2 Printer connected 20 a-full a-100 10/100/1000BaseTX
The 'Vlan' column shows the access VLAN assigned to each port. Gi0/1 is in VLAN 10, Gi0/2 in VLAN 20.
Understanding the Output
The command itself produces no output on success. To verify, use 'show interfaces status' or 'show vlan brief'. In 'show interfaces status', the 'Vlan' column indicates the access VLAN for ports in access mode. A value of '1' is default; any other number indicates a configured access VLAN. In 'show vlan brief', the port appears under the assigned VLAN's list. Ensure the VLAN exists in the VLAN database; otherwise, the port will be inactive until the VLAN is created.
CCNA Exam Tips
Remember that 'switchport access vlan' only works on ports in access mode; trunk ports use 'switchport trunk allowed vlan'.
If the VLAN does not exist, the port will not forward traffic until the VLAN is created.
The default access VLAN is 1; changing it to another VLAN removes the port from VLAN 1.
CCNA 200-301 may test the difference between access and trunk ports and the commands to configure each.
Common Mistakes
Forgetting to set the port to access mode with 'switchport mode access' before assigning a VLAN.
Assigning a VLAN that hasn't been created yet, causing the port to be in an inactive state.
Using 'switchport access vlan' on a trunk port, which is ignored for trunking.
Related Commands
show interfaces status
Displays a summary of all switch interfaces including their status, VLAN, duplex, speed, and type, used to quickly verify interface connectivity and configuration.
show vlan brief
Displays a summary of all VLANs configured on the switch, including VLAN ID, name, status, and ports, used to quickly verify VLAN configuration and port assignments.
switchport mode access
Configures a switch interface as an access port, placing it in a single VLAN and removing any trunking functionality.
Practice for the CCNA 200-301
Test your knowledge with hundreds of CCNA practice questions covering all exam domains.
Practice CCNA Questions