switchport access vlan is a Cisco IOS interface-configuration command that assigns an access port to one VLAN. Configure the port with switchport mode access first, then specify the VLAN ID. section 12.2.2
An access port sends and receives untagged frames for its assigned VLAN and is typically used for an end host such as a PC. VLAN membership belongs to the switch port; ordinary hosts are not aware of it. section 12.5 section 12.3
Ports in the same VLAN can forward and flood frames within one broadcast domain, while hosts in different VLANs cannot communicate directly. Assigning a nonexistent VLAN ID automatically creates that VLAN, although the vlan command is needed before naming it. section 12.2.2
Assigning port ranges
SW1(config)# interface range g0/0-3 SW1(config-if-range)# switchport mode access SW1(config-if-range)# switchport access vlan 10 This places G0/0 through G0/3 in VLAN 10. Repeating the pattern with VLANs 20 and 30 assigns additional port ranges to those broadcast domains. 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
Use the configuration listing to compare access-mode commands and VLAN assignments across three interface ranges. section 12.2.2
