Cisco Startup-Config – Editing Startup-Config on Cisco Devices

ciscocisco-ios

I have a Cisco router, and I want to remove a few lines from startup-config. How could I do it? Do I need to copy it over to a PC, edit it there, then copy it back, or can I do it through the serial console somehow?

Best Answer

Edit: Karl Billington's method is superior and should be used when possible

The other (extremely painful) way is:

  • Setup a console connection if you don't already have one. The rest of the steps below are over the console connection

  • Reboot the switch, stop it at the rommon/bootloader (usually Control-C or break)

  • Configure the rommon/bootloader to ignore the startup Boot the IOS. It should come up with a default config after ignoring the startup-config

  • Run show startup-config. This will print the entire startup-config, including the undesirable lines that you want to remove.

  • Now do a conf term and start pasting the output of show startup-config, excluding the undesirable lines that you want to exclude

  • Issue the command wr mem. This will save your edited config.

  • Reboot. This time configure the rommon/bootloader to not ignore the startup-config

As you can see this is extremely messy, and is error-prone especially if your config is large. But if the real solution (editing it off-box and then copying it to the device) won't work for whatever reason, and you're in a "desperate times call for desperate measures" situation, you can give this a shot.

Related Topic