Sign Up|Login Courses & Workshops
Overview
Pricing
CISCO REFERENCE HOME

switchport mode access

Switchport mode access

The switchport mode command allows us to configure the trunking operational mode on a Layer 2 interface on a Cisco IOS device. By entering the command switchport mode access we configure the interface to operate in access mode. This ensures that the interface will pass traffic for a single VLAN only. In access mode, the interface will not tag an outgoing ethernet frame with an 802.1Q VLAN ID tag. It will also discard received frames that are tagged with a VLAN ID.

Let's take a look at an example:

SW1 Console
SW1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#interface gi0/1
SW1(config-if)#switchport mode ?
accessSet trunking mode to ACCESS unconditionally
dynamicSet trunking mode to dynamically negotiate access or trunk mode
trunkSet trunking mode to TRUNK unconditionally
SW1(config-if)#

The context sensitive help shows us that the options for the switchport mode command include:

  • access
  • dynamic
  • trunk

We can use this command to set the interface to operate in access mode as follows:

SW1 Console
SW1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW1(config)#interface gi0/1
SW1(config-if)#switchport mode ?
accessSet trunking mode to ACCESS unconditionally
dynamicSet trunking mode to dynamically negotiate access or trunk mode
trunkSet trunking mode to TRUNK unconditionally
SW1(config-if)#switchport mode access
SW1(config-if)#

The switchport mode access command is usually followed by the command switchport access vlan. This command specifies which VLAN the interface belongs to. If this command is omitted when an interface is statically set to access mode, the interface is assigned to the default VLAN - VLAN 1.

VLANs, trunking, VLAN tagging and inter-vlan routing are covered comprehensively in the following interactive course: Course 5 - VLANs & Trunks. The course features visual, animated explanations and hands-on interactive labs.

TRY THIS COURSE

Want to test your networking skills with hands-on configuration and troubleshooting questions? Try out the Workshops section of this website here: Workshops (Login required).

Read how to use the device simulators on this website here: Workshops - General Instructions