Networks Training

  • About
  • My Books
  • IP Tools
  • HOME
  • Cisco Networking
    • Cisco General
    • Cisco IOS
    • Cisco VPN
    • Cisco Wireless
  • Cisco ASA
    • Cisco ASA General
    • Cisco ASA Firewall Configuration
  • Certifications Training
    • CCNA Training
    • Cisco Certifications
    • I.T Training
  • General
    • Tech News
    • General Networking
    • IP Telephony
    • Network Security
    • Product Reviews
    • Software
  • Cisco Routers
  • Cisco Switches
You are here: Home / Cisco Switches / Deleting the VLAN Database from a Cisco Switch (IOS or Nexus)

Deleting the VLAN Database from a Cisco Switch (IOS or Nexus)

Edited By Harris Andrea

If you have your own Cisco switch equipment at your home lab or at your work environment you might have encountered the situation that you want to completely erase the whole switch configuration including any VLANs that are already configured on the switch (usually the vlan.dat file).

deleting vlan.dat cisco switch

On a Cisco switch, erasing the switch startup configuration is one thing and erasing the VLANs that exist on the switch is another thing.

The VLAN information is stored in a file with name “vlan.dat” which exists in the flash storage of the switch. If you run “show flash” command you will see this file. This is also called the VLAN Database.

It is a good practice to completely erase everything on a switch (both switch configuration and switch Vlans) before using the switch in another part of your network. This is important in order to avoid any network conflicts because of any old configuration settings that are already configured on the switch.

Now let us see how to delete the configuration and Vlans from a Cisco switch.

Regular Cisco IOS Switches

1) Deleting the switch configuration

MORE READING:  Private VLAN Configuration on Cisco Switches (Example Configuration)

This is the easy part. It’s the same as deleting the configuration from any other Cisco network IOS device. Basically you need to delete the “startup-configuration” and then reboot the switch.

Switch#erase startup-config

Erasing the nvram filesystem will remove all configuration files! Continue?

[confirm]

[OK]

Erase of nvram: complete

Switch#reload

2) Deleting the switch Vlans

The strange part is that after deleting the switch configuration you will notice that the Vlans are still there.

Switch#show vlan brief

2   VLAN0002                         active
3   VLAN0003                         active
4   VLAN0004                         active

By executing the command “show vlan brief” you can see that there are 3 vlans configured on the switch. These vlans are stored in a file in flash memory called “vlan.dat” as we mentioned at the beginning of this article. You can see this file if you read what is stored in the flash:

Switch#show flash:

Directory of flash:/

1  -rw-     4414921          <no date>  c2960-lanbase-mz.122-25.FX.bin

2  -rw-         616          <no date>  vlan.dat

64016384 bytes total (59600847 bytes free)

As you can see from output above, the file “vlan.dat” is stored in flash. You have to delete this file in order to completely erase all vlans on the switch.

MORE READING:  What is Cisco Virtual Port Channel (vPC) - Explained and Discussed

Switch#delete vlan.dat

Delete filename [vlan.dat]?

Delete flash:/vlan.dat? [confirm]

Note:

Depending on the Switch version, you might need to use command “delete flash:vlan.dat” instead of the above.

Switch#sh flash

Directory of flash:/

1  -rw-     4414921          <no date>  c2960-lanbase-mz.122-25.FX.bin

64016384 bytes total (59601463 bytes free)

Switch#reload

After executing the command “delete vlan.dat” just hit enter twice and it will be gone. Then you have to reload the switch.

Cisco Nexus Switches (NX-OS)

For Cisco Nexus Switches (running NX-OS software) the situation is different. Normally the VLANs configured on the switch are stored inside the running-configuration of the device and there is no vlan.dat file in the flash.

So basically by erasing the startup-config and then rebooting, it will normally delete also the VLANs.

Use the command “write erase” and then reboot the device.

Spread the love

Related Posts

  • What is Cisco Switch Virtual Interface (SVI) – Configuration Example and Explanation
  • What is Cisco Virtual Port Channel (vPC) – Explained and Discussed
  • Discussion and Explanation of BPDU Guard (With Cisco Config Example)
  • From Reactive to Proactive: Mastering Network Performance with Switch Monitoring
  • How Does a Network Switch Learn MAC Addresses?

Filed Under: Cisco Switches

Download Free Cisco Commands Cheat Sheets

Enter your Email below to Download our Free Cisco Commands Cheat Sheets for Routers, Switches and ASA Firewalls.

By subscribing to our email list you will be receiving technical tutorials and industry news from time-to-time. You can unsubscribe at any time.

About Harris Andrea

Harris Andrea is an Engineer with more than two decades of professional experience in the fields of TCP/IP Networks, Information Security and I.T. Over the years he has acquired several professional certifications such as CCNA, CCNP, CEH, ECSA etc.

He is a self-published author of two books ("Cisco ASA Firewall Fundamentals" and "Cisco VPN Configuration Guide") which are available at Amazon and on this website as well.

Comments

  1. Bran (electronic wholeseller) says

    November 19, 2010 at 5:07 pm

    I excuted everything but after executing the command “delete vlan.dat” its not working …..:( ….though the information is really helpful …thanks …:)

  2. Blog Admin says

    November 19, 2010 at 6:43 pm

    Try the command “delete flash:vlan.dat“

  3. Louis S says

    April 2, 2021 at 5:28 pm

    Did not work for me. Cisco 2960x.
    Erased file, reloaded and new vlan.dat file created with same vlans

  4. Harris Andrea says

    April 2, 2021 at 5:56 pm

    Have you erased the running configuration first? You need to erase the running config, reboot, and then delete the vlan.dat file.

  5. Emmanuel Chigere says

    July 10, 2021 at 1:36 pm

    Great one Sir.
    It worked perfectly now. Thanks for this info.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search this site

About Networks Training

We Provide Technical Tutorials and Configuration Examples about TCP/IP Networks with focus on Cisco Products and Technologies. This blog entails my own thoughts and ideas, which may not represent the thoughts of Cisco Systems Inc. This blog is NOT affiliated or endorsed by Cisco Systems Inc. All product names, logos and artwork are copyrights/trademarks of their respective owners.

Amazon Disclosure

As an Amazon Associate I earn from qualifying purchases.
Amazon and the Amazon logo are trademarks of Amazon.com, Inc. or its affiliates.

Search

BLOGROLL

Tech21Century
Firewall.cx

Copyright © 2026 | Privacy Policy | Terms and Conditions | Contact | Amazon Disclaimer | Delivery Policy