≡ Menu

How to Create and Delete VLAN on Cisco Catalyst Switch

One of the typical configuration activities you’ll perform on a Cisco Switch is to manipulate VLANs.

VLAN stands for Virtual Local Area Network.

In one physical cisco switch, you can create multiple VLANs that connects to different network.

For example, a VLAN for 10.10.191.0 network, a VLAN for 10.10.192.0 network, and a VLAN for 10.10.193.0 network. All three of these can be configured in the same physical switch.

While these commands were tested on a cisco catalyst switch 3750 series, similar commands (may be with slight variation to the port number format) should work on all cisco switches.

Create VLAN on Cisco Switch

If you are planning to have only one network in your whole switch (for example, 10.10.192.0). i.e All the ports in the switch will be connected to the 10.10.192.0 network, then you don’t need to create a VLAN, just use the default VLAN 1.

Every switch comes with the default VLAN 1 as shown below. In this example, all the ports in this switch ( from 1 through 8 ) are part of the default VLAN 1.

#show vlan

VLAN Name       Status    Ports
---- -------------------------------- --------- ------------
1    default    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

In the following example, we are creating 192 VLAN network (for 10.10.192.0 network). While creating a VLAN you also need to specify the range of ports from the switch that needs to be part of this VLAN network.

In this example, ports 3 through 6 are configured as part of 192 VLAN network.

config t
vlan 192
interface range gigabitEthernet 1/0/3-6
switchport access vlan 192
exit

In the above commands:

  • config t – Goes into the configuration mode
  • vlan 192 – Creates VLAN 192
  • interface range gigabitEthernet 1/0/3-6 – Indicates that the port numbers 3 through 6 are assigned to this VLAN
  • swithport access vlan 192 – Indicates that the access to the vlan 192 is enabled

Apart from providing the access to the vlan 192 for the port numbers 3 through 6, you can also specify the following additional switchport configuration parameters (for example, nonegotiate and mode access)

config t
interface range gigabitEthernet 1/0/3-6
switchport mode access
switchport nonegotiate
exit

Once you’ve created a VLAN verify it as shown below,

#show vlan

VLAN Name       Status    Ports
---- -------------------------------- --------- ------------
1    default    active    Gi1/0/1, Gi1/0/2, Gi1/0/7, Gi1/0/8
192  VLAN0192   active    Gi1/0/3, Gi1/0/4, Gi1/0/5, Gi1/0/6

On a side note, it is always recommended that you upgrade ISO image on your cisco switch to the latest version.

Delete VLAN on Cisco Switch

You might want to delete a VLAN, if you are planning to switch the ports assigned to VLAN 192 to a different VLAN. Or, you might want to delete a VLAN, just because you’ve created it by mistake.

Let us assume that you want to delete the VLAN 192 (ports 3 though 6) that you just created.

Deleting a VLAN is as simple as assigning the default VLAN 1 to the ports that are part of the VLAN you want to delete, and delete the VLAN.

i.e If you want to delete VLAN 192, assign VLAN 1 to the ports 3 through 6, and just delete the VLAN 192.

First, assign the default VLAN 1 to ports 3 though 6 as shown below.

interface range gigabitEThernet 1/0/3-6
switchport access vlan 1
exit

Next, delete the vlan itself as shown below.

no vlan 192

Finally, verify that the VLAN 192 got deleted as shown below.

#show vlan

VLAN Name       Status    Ports
---- -------------------------------- --------- ------------
1    default    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

As a final note, if you don’t know what you are doing, do not execute any of the above commands on production switch, as you might bring down your network. Do this only on a test system, where you can play around and learn how to manipulate VLANs on cisco switch.

Add your comment

If you enjoyed this article, you might also like..

  1. 50 Linux Sysadmin Tutorials
  2. 50 Most Frequently Used Linux Commands (With Examples)
  3. Top 25 Best Linux Performance Monitoring and Debugging Tools
  4. Mommy, I found it! – 15 Practical Linux Find Command Examples
  5. Linux 101 Hacks 2nd Edition eBook Linux 101 Hacks Book

Bash 101 Hacks Book Sed and Awk 101 Hacks Book Nagios Core 3 Book Vim 101 Hacks Book

Comments on this entry are closed.

  • jalal hajigholamali October 28, 2011, 8:32 am

    Hi,

    Thanks a lot

  • Andrew October 28, 2011, 12:52 pm

    what about the hidden vlan.dat file ?
    I think that is still in place even after using the no vlan command.

  • ciscofreek February 27, 2012, 12:16 pm

    yeah you will delete the vlans until such time as a reboot when the vlan.dat file will reinsert the vlans. You also need to delete the vlan.dat file in flash and also be aware of vtp updates if you are running multiple switches

  • Abubakar Abdulrasheed September 4, 2012, 4:18 am

    I really enjoyed the guide and comment given, this will help me in the cause of doing my job.

  • iulian October 29, 2012, 3:08 pm

    you must delete both vlan.dat an reasing interface

  • kavi kumar November 20, 2012, 9:32 pm

    Hi,

    Nice explaination fa cisco switch in VLAN.

    thanks a lot…

  • sudhir kumar February 27, 2013, 12:00 am

    how to configure VLAN on cisco switch please reply

  • kevin March 21, 2013, 3:19 am

    How do i configure and set a cisco sf200 switch its an webbased switch.

    i need 4 vlans 145, 146,147,148 to begin.
    can anyone help.

    regards

  • solabayya May 14, 2013, 8:07 am

    nice explanations.

  • charan June 5, 2013, 2:22 am

    very good explanation

  • umesh tiwari October 24, 2013, 7:14 am

    How to create a two switch2950 configure vlan in cisco, drow and example step ?

  • kahil November 21, 2013, 10:32 am

    Hi please can you help
    how do the switch will know that port 3 to 6 are assigned to vlan 192 with the ip adress 10.10.192.0
    in your configuration you only said port from 3 to 6
    and vlan 192 but not defining the ip adress?

    config t
    vlan 192
    interface range gigabitEthernet 1/0/3-6
    switchport access vlan 192
    exit”

    also what 1/0 mean in “interface range gigabitEthernet 1/0/3-6”

    and please how to assign port 1 and 2 to a vlan
    and 3 and 4 to another vlan

    thanks for your help

  • Mey January 22, 2014, 5:33 am

    Hi guy.
    To create a vlan just select a number for the vlan, like 22. and then in global configuration mode type: vlan 22
    (config)# vlan 22

  • paul March 16, 2014, 9:49 am

    I have a catalyst 3750g switch and I am new to cisco. The speed LED is off, in an article I read it says it transmit at 10 Mbps when off and 1000 Mbps when flashing. How do I set this to 1000 Mbps? what are the commands that I need to enter in the terminal emulator? Thanks in advance!

  • Francis otto Margai May 8, 2014, 12:44 pm

    i love cisco

  • Ali December 2, 2015, 4:32 am

    Thank you very much. Breif & nice explanation.

  • Rob December 7, 2015, 5:21 am

    Which program should I use to do this?

  • Sharath February 8, 2016, 3:13 pm

    Hi,
    I have a task to to in network switch, to replace data vlan 10 to vlan 100. I am bit helpless to to so, request for help and options to configure things.
    I have locations which had a data vlan in production VLAN need to replace with same ip segment and flawless. I have a single switch connected to firewall and FW is connected to router and that to WAN link.

  • YONG LIN January 10, 2017, 7:26 pm

    Thank you so much my friend, i learned great stuff from here!

  • adrian May 2, 2017, 11:33 pm

    i have Cisco C3750, which currently running on VLAN 1 as default, VLAN 10 for Data/ Internet & VLAN 100 for IP Phone.
    i am going to add another VLAN in my network which is VLAN30 for CCTV/IP Camera. Doest the network for the IP Camera will be go live if i just add in the VLAN 30 into this core switch C3750? Kindly advice.
    Thanks.

  • yusuf December 20, 2017, 11:32 pm

    can you mention how to configure vlan command cisco witch 2950