Switching (VLAN/STP)

switchport access vlan <id>

Place the access port in the given VLAN.

Works on: SwitchMode: iface
Watch out

It does not change the port's mode: on a trunk the VLAN is stored and only applies after 'switchport mode access'.

Run this command live

Don't just read it — type switchport access vlan <id> in a real network simulator in your browser and watch it take effect. No install, no account needed to start.

Open the lab

Frequently asked

What does the "switchport access vlan <id>" command do?

Place the access port in the given VLAN.

What's the common gotcha with "switchport access vlan <id>"?

It does not change the port's mode: on a trunk the VLAN is stored and only applies after 'switchport mode access'.

More Switching (VLAN/STP) commands

← Back to the full command reference