switchport mode access is a Cisco IOS interface-configuration command that manually forces a switch port to operate as an access port. An access port carries traffic for one VLAN, unlike a trunk port, which carries multiple VLANs. Configure the port’s VLAN separately with switchport access vlan vlan-id. section 12.2.2 section 12.5
Use the command with these practical points in mind:
- Enter interface configuration mode before applying switchport mode access. section 12.2.2
- Assign the port to a VLAN with switchport access vlan vlan-id; the switch creates that VLAN automatically if it does not already exist. section 12.2.2
- Prefer manual access or trunk configuration instead of relying on Dynamic Trunking Protocol to choose the port mode. section 12.2.2
- Remember that access ports send and receive untagged frames and belong to a single broadcast domain. section 12.5
Configure grouped access ports
SW1(config)# interface range g0/0-3 SW1(config-if-range)# switchport mode access SW1(config-if-range)# switchport access vlan 10 This configures G0/0 through G0/3 as access ports assigned to VLAN 10. Similar interface ranges can be configured for VLANs 20 and 30. section 12.2.2
SW1(config)# interface range g0/0-3 #1 SW1(config-if-range)# switchport mode access #1 SW1(config-if-range)# switchport access vlan 10 #1 SW1(config-if-range)# interface range g1/0-3 #2 SW1(config-if-range)# switchport mode access #2 SW1(config-if-range)# switchport access vlan 20 #2 SW1(config-if-range)# interface range g2/0-3 #3 SW1(config-if-range)# switchport mode access #3 SW1(config-if-range)# switchport access vlan 30 #3 #1 Configures G0/0–3 as access ports in VLAN 10 #2 Configures G1/0–3 as access ports in VLAN 20 #3 Configures G2/0–3 as access ports in VLAN 30
Browse the complete grouped configuration for SW1’s access ports in VLANs 10, 20, and 30. section 12.2.2
