CCNA · Lesson 3 of 13

Access Ports: How to Assign a Port to a VLAN

You know what a VLAN is. Now you will create one and put ports in it with just 4 commands.

By topologia.appUpdated: Nov 13, 2026⏱ 5 min❓ 4 questions📶 Level beginner

In a nutshell

An access port belongs to a single VLAN. It is configured with two commands: switchport mode access and switchport access vlan.

In this lesson
  1. What is an access port?
  2. Step 1: create the VLAN
  3. Step 2: assign the ports
  4. Step 3: verify
  5. Two behaviors you must know
  6. What you must remember
  7. Exam-style questions

What is an access port?

An access port belongs to a single data VLAN. That is where you connect PCs, printers or cameras. The PC does not even know VLANs exist: it sends normal Ethernet frames, untagged. The switch is the one that knows which VLAN the port belongs to.

Switch SW1 with PC1 and PC2 in VLAN 10 and PC3 and PC4 in VLAN 20 VLAN 10 · SALES · 192.168.10.0/24VLAN 20 · ACCOUNTING · 192.168.20.0/24 SW1 PC1 PC2 PC3 PC4 Fa0/1Fa0/2Fa0/3Fa0/4
Fa0/1 and Fa0/2 are access ports in VLAN 10; Fa0/3 and Fa0/4 in VLAN 20.Edit in the editor ↗

Step 1: create the VLAN

SW1# configure terminal
SW1(config)# vlan 10
SW1(config-vlan)# name SALES
SW1(config-vlan)# vlan 20
SW1(config-vlan)# name ACCOUNTING
SW1(config-vlan)# exit

The name is optional, but it helps a lot when there are dozens of VLANs.

Step 2: assign the ports

SW1(config)# interface range fa0/1 - 2
SW1(config-if-range)# switchport mode access
SW1(config-if-range)# switchport access vlan 10

SW1(config)# interface range fa0/3 - 4
SW1(config-if-range)# switchport mode access
SW1(config-if-range)# switchport access vlan 20

switchport mode access fixes the port as access (and stops it from negotiating a trunk with DTP). switchport access vlan 10 puts it in VLAN 10.

Step 3: verify

SW1# show vlan brief
VLAN Name        Status    Ports
---- ----------- --------- -------------------------
1    default     active    Fa0/5, Fa0/6, Fa0/7 ...
10   SALES       active    Fa0/1, Fa0/2
20   ACCOUNTING  active    Fa0/3, Fa0/4

Two behaviors you must know

  • VLAN that does not exist: if you assign a port to a missing VLAN (switchport access vlan 30), the switch creates it automatically and warns: % Access VLAN does not exist. Creating vlan 30.
  • Deleted VLAN: if you delete a VLAN with no vlan 10, its ports do not go back to VLAN 1: they become inactive and pass no traffic until you assign them to another VLAN.

Best practice

Put unused ports in an unused "parking" VLAN (for example 999) and disable them with shutdown.

What you must remember

  • Access port = one data VLAN, untagged frames.
  • Create: vlan 10 → name SALES.
  • Assign: switchport mode access + switchport access vlan 10.
  • Verify: show vlan brief.

Check what you learned

4 exam-style questions. Some have one answer and others ask you to choose several. Answer them all to complete the lesson.

Question 1 of 4 · One answerWhich command assigns interface Fa0/5 to VLAN 30?
Question 2 of 4 · Choose twoAn administrator has already entered interface range fa0/1 - 10. Which two commands complete the configuration of those ports as access ports in VLAN 20? (Choose two.)
Question 3 of 4 · One answerPorts Fa0/1 and Fa0/2 are in VLAN 10. The administrator runs no vlan 10. What happens to those ports?
Question 4 of 4 · One answerWhich command shows the existing VLANs and the access ports assigned to each one?