4 Replies Latest reply: Jan 16, 2019 8:23 AM by Bradley RSS

    Config.text and Startup-config Files in Cisco Switches


      It seems that the way Cisco Switch saves its configuration confuses a lot of students, makes it unclear where cisco switch saves its configuration file, and how the booting process works.


      That often happens when the student start reading about the password recovery process . so they always come up with the question (what is the difference between Config.text and startup-config?)  and (where the switch saves its configuration file , in NVRAM or in FLASH?)


      Its really very easy to answer those questions , but to get a clear picture of the process ,  we should start by the main concepts of the booting process.


      Boot sequence

      We can say , cisco switch (and router too) starts the booting process by making four steps:-


      First Step: Check the hardware components

      In this step , the switch , or router,  loads POST from the ROM and executes it . To check its internal components and make sure they work properly.

      if it passes the test successfully, the switch, or router, will do the next step.


      Second Step: Load the Bootstrap software

      In this step the switch, or router, loads the bootstrap software from the ROM. this software will lead the device through the booting process.

      If it is loaded successfully , the switch, or router will do the next step.


      Third step: Finding and loading the IOS.

      In this step , the switch , or router, will search for IOS  and loads it.

      To do this job , the device will use something called (configuration register)

      The configuration register tells the device where and which IOS to load.

      By default settings , the configuration register tells the device to load the IOS from Flash Memory , as the flash Memory is the default location for the IOS.

      Note that , the configuration register tells the device some other initial settings, we will talk about another one of them later.

      After loading the IOS successfully , the switch or router will do the next step.


      Fourth Step : Finding and loading startup configurations

      In this step , the switch, or router ,will search for a file contains the necessary sittings that makes the device do its job in the network , this settings like (device name , passwords , interfaces IPs, protocols …. etc)  after finding the file , the device will load it and applies all its contents.

      This file is called (Startup-Configuration) , and it is created only when we make changes to the device settings by applying the various controlling commands, and save those changes. And again, to do this job , the device will use (configuration register),

      The configuration register ,this time, tells the device whether to load the startup configuration or just ignore it.

      The default settings is loading the file. So the device will try to look for it and load it.

      If the device is new, there will be no startup configuration file, so in this case , if the device doesn’t find the start up configuration file, it will simply ask us to make one !!  by displaying the famous questions which appears on the CLI :-

      continue with configuration dialog ? [yes/no]




      if the device fined startup-configuration file ,which means we(or some one else) already saved the configuration in a previous session, the device will load it and applies its contents.

      The default location for this file is NVRAM.


      So , this is the boot sequence of both switches and routers.


      A full understanding of these steps will help us a lot , specially in password recovery , backup and restore IOS or startup configuration.


      Anyway here we will focus on the Fourth Step : (Finding and loading startup configurations) to explain what are config.text and startup-config files . And also to get a quick glance about password recovery.


      Config.text and Startup-config files


      When we make any changes in Switch or Router settings (like changing the host name,  putting passwords ,  …. Etc) , and save those changes by the command:-

      Copy running-config startup-config

      The device(switch or router) will CREATE a file named (startup-config) and saves it in NVRAM .

      And then , whenever the device is powered on or restarted (reloaded) , it will go through the four booting steps. when it reaches the fourth step , it will look for the startup-config in the NVRAM and load it  , applying all its commands and settings.


      And here we should notes something very important about a small difference between Routers and Switches regarding saving the configuration.


      • Routers save the configuration in ONE file named (startup-config) in NVRAM
      • Switches (at least many models of it) save the configuration in TWO connected files: one named (Startup-config) in the NVRAM , and the other named (Config.text) in Flash Memory.


      The both files in the switch contain same contents , same settings.

      When we make any change in switch’s settings and re-save those settings (by copy running-config startup-config command) both files will be changed saving the new settings.


      When we delete one of those files. The other one will be deleted automatically


      And we should note that , the switch keep the same booting procedure :-

      When the switch powered on or re-loaded  , during the boot process, precisely in the fourth step , it will look for the file (Startup-config) in the NVRAM and load it.


      So it will use the configuration file which saved in NVRAM named (Startup-config).


      So why the switch makes another connected copy of this file in the Flash memory by the name Config.text?


      Actually , we use this files (Config.text) which in Flash memory in the recovery process, as we will know later , simply because we cant access any files from NVRAM from the recovery mode.


      So , when we save the configurations in the switch , it creates two files:-

          • Startup-config in the NVRAM and
          • Config.text in the Flash Memory


      We can display the content of the NVRAM in the switch(or Router) by the command:-

      Switch# dir nvram:


      And we can display the content of the flash memory in the switch (or router) by the command:-

      Switch# dir flash:


      Switch# show flash:


      We will realize that both files are in same size.


      If we open the startup-config file from nvram by the command :-

      Switch# more nvram:startup-config


      And open the config.text file from the flash memory by the command:-

      Switch# more flash:config.text


      We will find exactly the same contents.


      If we delete (or to be precise empty the content of) the files startup-config from the nvram by the command:-

      Switch# delete nvram:startup-config


      the other file config.text in the flash memory will be empty too.

      In this case , when we open the files startup-config from the nvram, we will find nothing inside it, neither inside the cofnig.text file.



      Note that the delete nvram:startup-config command will empty the startup-config file, it will delete all its contents ,and the file will appear with just 5 bits size .


      Likewise if we delete the config.text files from the Flash memory by the command

      Switch#delete flash:config.text


      And reload the switch , the file startup-cofnig in the nvram will be empty(its contents will be deleted)


      And also something similar happened when we use the erase command to erase the content of the nvram :-

      Switch# erase nvram:


      in this case the switch will simply rename the file config.text from the flash to (config) and it will assume the files is deleted


      So as we see , both files are connected to each other.


      In the enable mode , we can access both files startup-config and config.text , to open and read , or to delete/empty its contents .

      But in the recovery mode we cannot access nvram files , so in this case we can only work on the flash files.


      Password Recover

      If we (or someone else) put a password to protect the device (switch or router) the passwords will be saved in the (startup-config) file in nvram in the router , and in both of startup-config file in nvram and config.text file in flash in the switch.


      whenever the device starts , it will look for the startup-cofnig file then loads and applies those settings with the passwords


      If we forget the those passwords. We simply can tell the router don’t load the Startup-config file.


      We’ve said before , in the fourth step of booting process , the device tries to find the Startup-config file and loads it.


      We’ve also said that , the device uses (configuration register) to decide whether to find and load the startup-configuration file or not.


      The default settings of the configuration register tells the  device to find and to load the startup-config file.


      In case we don’t know the password which saved in the startup-config file , and want to recovery the password, we simply can change the settings of the register to make it tells the device to don’t load the startup-config file.


      We can change the configuration  register settings by the command:

      config-register {code}


      when we do so , the device (router or switch) will doens load the startup-config file from the NVRAM.


      But the config-register command DOESN’T exist in many models of switches like  Catalyst 2950 , so we simply cannot tell the switch don’t load the startup-config file.


      So, in this case , we go to the recovery mode by pressing MODE button when starting up the switch. Then delete or change the name of the accessible config.text file from the Flash Memory.


      When are in the recovery mode , we cannot  access NVRAM , cannot display its contents , nor open , delete the startup-config file from it.

      So , again we treat with the config.text file from the flash memory, we can access all flash memory files , open ,rename , delete any of them.


      In our case to delete the password , we can simply rename or delete the config.text file , and reload the switch , it will automatically delete the contents of startup-cofnig file from NVRAM and start the switch with default settings , with no passwords.

      You can find a detailed steps to how to recovery switch password in the this link



      So again , the switch saves the configuration in two files:-

          • One in the NVRAM named startup-config , which the switch looks for and loads in booting process.
          • And one in the Flash Memory named config.text , which we can access from recovery mode .

      When we make any changes on any one of those fles , the changes will apply to the other

      When we delete one file , the other will be deleted/emptied.


      So I think that is a clear explanations of what are those files (Startup-config) and (config.text)


      You can easily find an explanation online to how to recovery password for any model of switches or routers in the way I mentioned here.

      you can also find a full explanation of configuration register code and how to use it.

      In this like you will find a useful information about configuration register codes http://www.cisco.com/c/en/us/support/docs/routers/10000-series-routers/50421-config-register-use.html#config-reg-meaning

      Good luck