Quiz Entry - updated: 2026.06.18
How do you assign a switch port to a VLAN (Virtual Local Area Network)?
Enter the interface, set it to access mode with switchport mode access, then assign it to a VLAN with switchport access vlan <id>.
Command sequence:
Switch# configure terminal
Switch(config)# interface fa0/18
Switch(config-if)# switchport mode access
Switch(config-if)# switchport access vlan 20
Switch(config-if)# end
What each command does:
interface fa0/18— select the physical portswitchport mode access— set this port as an access port (single VLAN only, not a trunk). This is important — it prevents the port from negotiating trunkingswitchport access vlan 20— assign this port to VLAN 20- The end device on this port must have an IP (Internet Protocol) address in VLAN 20's subnet (e.g., 172.17.20.0/24)
Useful notes:
- If the VLAN doesn't exist yet when you assign it, newer Catalyst switches will auto-create it
- You can assign multiple ports at once using
interface range fa0/1 - 12 - Use
no switchport access vlanto return a port to VLAN 1 - Always verify with
show vlan brieforshow interfaces switchport