Cisco IOS

switchport

CautionConfigure port VLANs

interface <if> → switchport mode access / switchport access vlan <id>

Sets port mode and VLAN membership — mismatched access VLANs are the classic moved-cable failure.

Examples

  • interface Gi1/0/12 switchport mode access switchport access vlan 20Put a port in VLAN 20

Syntax

(config-if)# switchport mode access|trunk / switchport access vlan N

Before you run it

VLAN changes take effect immediately.

Used when you see

VLAN misconfiguration
3
Fix the port's mode and access VLAN
See the whole flow →

Related commands

You can carry a laptop to the rack. Signal will not follow.

Check syntax standing in front of the hardware, with no connection at all. Free to install, no ads.

Get it free on the App Store