The Switchport Mode Access Cisco command

Cisco Command: switchport mode access

Usage:

  • The ‘switchport mode access’ command is used on Cisco switches to configure a switch port as an access port.
  • This command must be used on an interface that is currently in a trunk or dynamic auto mode.

Function:

  • The ‘switchport mode access’ command sets the switch port to accept only untagged traffic.
  • When a switch port is in access mode, it will only allow traffic from devices that are directly connected to that port.
  • This is in contrast to a trunk port, which allows traffic from multiple VLANs to be carried on a single physical link.

Equipment:

  • The ‘switchport mode access’ command can be used on any Cisco switch that supports VLANs.
  • This includes Catalyst 2960, 3560, 3750, and 4500 series switches.

Procedure:

  • To configure a switch port as an access port, follow these steps:
  • Enter the ‘configure terminal’ command to enter global configuration mode.
  • Enter the ‘interface ‘ command to select the switch port that you want to configure.
  • Enter the ‘switchport mode access’ command to set the switch port to access mode.
  • Enter the ‘exit’ command to exit global configuration mode.

Verification:

  • To verify that the switch port has been configured as an access port, you can use the ‘show interface ‘ command.
  • This command will display the current settings for the switch port, including the switch port mode.

switchport mode access Usage Examples

Here are some examples of the Cisco command ‘switchport mode access’:

  1. Configure interface GigabitEthernet1/0/5 as an access port:
    Switch(config)# interface GigabitEthernet1/0/5
    Switch(config-if)# switchport mode access
    
  2. Configure interface GigabitEthernet1/0/5 as an access port and assign VLAN 10:
    Switch(config)# interface GigabitEthernet1/0/5
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 10
    
  3. Configure interface GigabitEthernet1/0/5 as an access port, assign VLAN 10, and enable trunking on the uplink port:
    Switch(config)# interface GigabitEthernet1/0/5
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 10
    Switch(config-if)# switchport trunk encapsulation dot1q
    
  4. Configure interface GigabitEthernet1/0/5 as an access port, assign VLAN 10, and enable trunking on the uplink port with a native VLAN of 10:
    Switch(config)# interface GigabitEthernet1/0/5
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 10
    Switch(config-if)# switchport trunk native vlan 10
    
  5. Configure interface GigabitEthernet1/0/5 as an access port, assign VLAN 10, and enable trunking on the uplink port with a native VLAN of 10 and allowed VLANs 20 and 30:
    Switch(config)# interface GigabitEthernet1/0/5
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 10
    Switch(config-if)# switchport trunk native vlan 10
    Switch(config-if)# switchport trunk allowed vlan 20,30
    
  6. Configure interface GigabitEthernet1/0/5 as an access port, assign VLAN 10, and enable voice VLAN 20:
    Switch(config)# interface GigabitEthernet1/0/5
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 10
    Switch(config-if)# switchport voice vlan 20
    
  7. Configure interface GigabitEthernet1/0/5 as an access port, assign VLAN 10, and disable trunking:
    Switch(config)# interface GigabitEthernet1/0/5
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 10
    Switch(config-if)# switchport trunk encapsulation dot1q
    
  8. Configure interface GigabitEthernet1/0/5 as an access port with 802.1X authentication:
    Switch(config)# interface GigabitEthernet1/0/5
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 10
    Switch(config-if)# switchport dot1x authentication
    
  9. Configure interface GigabitEthernet1/0/5 as an access port with 802.1X authentication and VLAN 10 as the default VLAN:
    Switch(config)# interface GigabitEthernet1/0/5
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 10
    Switch(config-if)# switchport dot1x authentication
    Switch(config-if)# switchport default vlan 10
    
  10. Configure interface GigabitEthernet1/0/5 as an access port with 802.1X authentication and MAC authentication bypass:
    Switch(config)# interface GigabitEthernet1/0/5
    Switch(config-if)# switchport mode access
    Switch(config-if)# switchport access vlan 10
    Switch(config-if)# switchport dot1x authentication
    Switch(config-if)# switchport dot1x mac-auth-bypass