Configure or Change Interface (access mode) VLAN on Cisco IOS
-
Herry Purnama
- Infrastructre & hardware, Network, Cisco ios
- December 5, 2018


Check the interface details on port Gi1/0/1.
ams-101-sw1>en
ams-101-sw1#sh run | begin interface GigabitEthernet1/0/1
interface GigabitEthernet1/0/1
switchport access vlan
401
switchport mode access
link state group 1 downstream
spanning-tree portfast
!
Okay, the port is configured with VLAN 401 right now. Let’s change it to VLAN 402. (Below command will change ports 1)
ams-101-sw1#conf t
ams-101-sw1(config)#int gi
1/0/1
ams-101-sw1(config-if)#switchport access vlan
402
ams-101-sw1(config-if)#no sh
ams-101-sw1(config-if)#
exit
But if you want to configure it to multiple ports, you can use below command (this command will add ports 2-13 to VLAN 402)
ams-101-sw1#conf t
ams-101-sw1(config)#int range gi
1/0/2-13
ams-101-sw1(config-if-range)#switchport access vlan
402
ams-101-sw1(config-if-range)#no sh
ams-101-sw1(config-if-range)#
exit
Now let’s verify the VLAN 402 members.
ams-101-sw1#sh vlan | include 402
VLAN Name Status Ports
407 Linux_Server active Gi1/0/1, Gi1/0/2, Gi1/0/3, Gi1/0/4, Gi1/0/5,Gi1/0/6, Gi1/0/7, Gi1/0/8, Gi1/0/9, Gi1/0/10, Gi1/0/11, Gi1/0/12, Gi1/0/13, Po1
Check the running config for a specific interface (in this case we check Gi1/0/2).
ams-101-sw1#sh run | beg interface GigabitEthernet1/0/2
interface GigabitEthernet1/0/2
switchport access vlan
402
switchport mode access
link state group 1 downstream
spanning-tree portfas
And don’t forget to save your configuration.
ams-101-sw1#copy running-config startup-config
That’s it.

Herry Purnama
Technical Project Lead at T-Systems Malaysia
Note
Disclaimer: The views expressed and the content shared in all published articles on this website are solely those of the respective authors, and they do not necessarily reflect the views of the author’s employer or the techbeatly platform. We strive to ensure the accuracy and validity of the content published on our website. However, we cannot guarantee the absolute correctness or completeness of the information provided. It is the responsibility of the readers and users of this website to verify the accuracy and appropriateness of any information or opinions expressed within the articles. If you come across any content that you believe to be incorrect or invalid, please contact us immediately so that we can address the issue promptly.