Switchport Access Vlan Command on CISCO Router/Switch

Other Cisco Other Cisco Material Original source

Command

Switchport Access Vlan

Use

Sets the VLAN that the interface belongs to.

Syntax

Switch(config-if)#switchport access vlan <vlan # >

Example

In this example, port fa0/2 on SW3 is set to VLAN 10. Here is the VLAN information on SW3 before the changes. Notice that all interfaces belong
to VLAN 1.

Copy

SW3#show vlan brief



VLAN Name Status Ports

—- ——————————– ——— ——————————-

1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4, Fa0/5

Fa0/6, Fa0/7, Fa0/8, Fa0/9

Fa0/10, Fa0/11, Fa0/12, Fa0/13

Fa0/14, Fa0/15, Fa0/16, Fa0/17

Fa0/18, Fa0/19, Fa0/20, Fa0/23

Fa0/24, Gi0/1, Gi0/2

10 VLAN0010 active

11 VLAN0011 active

12 VLAN0012 active

13 VLAN0013 active

14 VLAN0014 active

15 VLAN0015 active

16 VLAN0016 active

17 VLAN0017 active

18 VLAN0018 active

19 VLAN0019 active

20 VLAN0020 active

99 VLAN0099 active

555 VLAN0555 active

1002 fddi-default act/unsup

Next, int fa0/2 is configured for VLAN 10.

Copy

SW3#conf t

Enter configuration commands, one per line. End with CNTL/Z.

SW3(config)#int fa0/2

SW3(config-if)#switchport access vlan 10

Finally, the VLAN information for SW3 is displayed with fa0/2 assigned to VLAN 10.

Copy

SW3(config-if)#do show vlan brief



VLAN Name Status Ports

—- ——————————– ——— ——————————-

1 default active Fa0/1, Fa0/3, Fa0/4, Fa0/5

Fa0/6, Fa0/7, Fa0/8, Fa0/9

Fa0/10, Fa0/11, Fa0/12, Fa0/13

Fa0/14, Fa0/15, Fa0/16, Fa0/17

Fa0/18, Fa0/19, Fa0/20, Fa0/23

Fa0/24, Gi0/1, Gi0/2

10 VLAN0010 active Fa0/2

11 VLAN0011 active

12 VLAN0012 active

13 VLAN0013 active

14 VLAN0014 active

15 VLAN0015 active

16 VLAN0016 active

17 VLAN0017 active

18 VLAN0018 active

19 VLAN0019 active

20 VLAN0020 active

99 VLAN0099 active

555 VLAN0555 active

1002 fddi-default act/unsup
← All Other Cisco articles Home