Where IOS keeps your files
| Location | Contains | Persistence |
|---|---|---|
| RAM | running-config | Lost at power-off or reload |
| NVRAM | startup-config | Retained without power |
| Flash | IOS image and local backups | Retained without power |
| Backup server | Off-device backups | Retained if the network device is replaced |
Why live changes and a saved copy are kept apart
Applying changes instantly while keeping a separate saved copy gives you a built-in safety net. If a change goes badly (for example you lock yourself out of a remote router), a reload brings back the last saved configuration. Engineers working on a distant site sometimes schedule a reload with reload in 10 before a risky change, and cancel it with reload cancel once they know the change worked.
The boot sequence, from POST to prompt
In the classic IOS lab shown here, if the saved configuration is missing or bypassed, IOS can ask: Would you like to enter the initial configuration dialog? [yes/no]:. Answer no and configure the device yourself. The classic IOS router also checks a setting called the configuration register. The normal value 0x2102 means "load startup-config". The value 0x2142 means "ignore it", which is how password recovery can bypass the saved settings on that platform. These register values are not universal IOS XE switch commands.
Catalyst 9000 uses different boot controls
For a Catalyst 9200 running IOS XE 17.15.x, check the platform's boot settings rather than copying R1's register command. Catalyst 9000 switches use dedicated boot commands and ROMMON variables. A saved configuration can exist while a startup-configuration bypass is enabled; saving the file again does not by itself clear that bypass.
show version
show boot
show romvarRead-only privileged EXEC checks on the Catalyst 9000 example: identify model/release, inspect boot settings and look for SWITCH_IGNORE_STARTUP_CFG. show romvar is supported from IOS XE 16.10.1; use the guide for the exact model and release.
If SWITCH_IGNORE_STARTUP_CFG=1 is present, investigate why the switch is bypassing its saved file. Confirm the intended configuration and follow the release-specific recovery procedure before changing boot controls or reloading. Do not erase a valid startup configuration just because it was not loaded.
References: Catalyst 9000 boot-control equivalents and Catalyst 9200 IOS XE 17.15.x recovery guide.
Viewing, saving, erasing and backing up
R1 uses classic IOS 15.9-style examples below; switch VLAN-file examples describe a legacy Catalyst IOS lab. The Catalyst 9200 boot checks above are a separate IOS XE 17.15.x example. These are authored commands and outputs, not device captures.
Look at the configurations
show running-config
show startup-config
show running-config | section interface
show running-config interface GigabitEthernet0/1Privileged EXEC. The filtered forms save scrolling through hundreds of lines.
Save
copy running-config startup-configCopies RAM to NVRAM. The order is always copy <from> <to>. write memory does the same.
Will your change survive a restart?
You renamed R1 to R1-Branch. Choose what happens next.
Your new hostname survives
R1-Branch was copied to NVRAM before the restart.
Erase and start again
erase startup-config
delete flash:vlan.dat
reloadErase NVRAM (write erase is the same). On a switch, also delete the VLAN database. At the reload prompt, answer no to saving, or you write the old configuration back.
Back up and restore with TFTP
TFTP (Trivial File Transfer Protocol, UDP port 69) is a very simple file transfer protocol with no login and no encryption. It is still common for configuration backups inside a trusted network. FTP and SCP work the same way with ftp: and scp:. See FTP, SFTP and TFTP.
Device key: R1 (router) · SW1 (switch)
Lines show the example’s network connections. The coloured path and envelope follow the current step; its text identifies the sender, receiver and traffic type.
Reading the addresses
IP labels identify interfaces or destinations. Subnet labels identify networks; /n is the prefix length. A router ID (RID) identifies a routing process and need not be a reachable interface.
An IP address alone is not a URL. A web URL includes a scheme such as https://; an address on a router or printer does not imply a website.
- R1: Gi0/1 192.168.10.1
- SW1: Vlan1 192.168.10.2
- TFTP server: IP 192.168.10.50
- 1. copy running-config tftp: R1 asks to write a file and sends the configuration in numbered blocks (UDP 69 to start the transfer).
- 2. Each block is acknowledged. The server confirms every block; IOS prints a ! for progress.
- 3. copy tftp: running-config Restoring pulls the file back and merges it into the running configuration.
copy running-config tftp:
copy startup-config flash:r1-backup.cfg
copy tftp: running-config
copy tftp: startup-configBack up off the box, back up locally, merge a file into the live config, or replace the saved config (it takes effect at the next reload).
A backup taken just before a change window, as well as the scheduled ones, means the file to roll back to is minutes old rather than weeks old.
Choose the restore destination
Restoring into running-config merges settings
In this example, the backup changes R1's hostname. It contains no interface settings, so the existing interface description remains. Copying a file into running-config applies its commands to the current configuration; it does not replace the entire file.
Confirming the save and the backup worked
R1#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK]
R1#show startup-config Using 1843 out of 262144 bytes ! version 15.9 service password-encryption ! hostname R1 ! ...
startup-config is not present instead.R1#copy running-config tftp: Address or name of remote host []? 192.168.10.50 Destination filename [r1-confg]? !! 1843 bytes copied in 0.204 secs (9034 bytes/sec)
-confg. Each ! is a successful block. A row of dots and an error mean the server is unreachable or not running.R1#reload System configuration has been modified. Save? [yes/no]: yes Building configuration... [OK] Proceed with reload? [confirm]
R1#show version | include register Configuration register is 0x2102
Lost configs, half-restored files and failed transfers
- Configuration gone after a reload. It was never saved, or startup loading was bypassed. On the classic IOS R1 example, check for
0x2142withshow version; the normal register in this lab is0x2102. On Catalyst 9000, inspectshow bootandshow romvarinstead. Identify the platform and preserve the valid saved file before choosing a recovery procedure. - A restored file left old settings behind. Copying to running-config merges. Old lines that aren't in the file remain. Copy to startup-config and reload for a clean replace.
- Restored interfaces are shut down. When you merge into running-config, interfaces that are currently shut stay shut unless the file contains
no shutdown, which saved files don't show by default. Bring them up by hand. - TFTP copy fails with timeouts. Ping the server, check that the TFTP service is running and that a firewall allows UDP 69 (and the high ports the transfer then uses).
- A wiped switch still has its VLANs. The VLAN database (
vlan.datin flash) wasn't deleted.
Test yourself on saving and restoring
You configure a new static route on R1 and test it successfully. The router then loses power. Is the route there after it boots?
Which command saves the active configuration so it survives a reload?
You run 'copy tftp: running-config' with a file that has no 'ip domain name' line. The router already has one. What happens to it?
After 'erase startup-config' and 'reload' a switch boots with no hostname, but all its old VLANs are still there. Why?
The classic IOS R1 lab keeps booting into the initial configuration dialog even though show startup-config shows a valid saved config. What should you check?
A Catalyst 9200 running IOS XE 17.15.x has a valid startup-config but bypasses it. What is the next diagnostic step?