3

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?

  • What is wrong with issuing "conf t", making your changes, exit, and issuing a "wr mem" or "copy run start" command? Is it that you only want to touch the startup config and leave the running configuration untouched? – Kevin Bowen Apr 11 '18 at 5:53
4

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.

4

Yes, only real way is to copy the startup-config file to a PC and edit on there, then copy back. Of course the commands will not take effect until the next reload and you will have to be careful you don't corrupt the config in any way. Make sure you use a proper text editor like Notepad++ and not a word processor when you edit to make sure you don't insert any odd character codes.

  • I used a USB drive, but after connecting it to a PC ios won't recognize it. – Máté Varga Apr 8 '18 at 19:20
  • What filesystem is it formatted with? Needs to be FAT – Karl Billington Apr 8 '18 at 19:38
  • It's formatted on the router, it works perfectly, then I plug it into a windows PC, and even if I do nothing with it and connect it back to the router it won't work anymore – Máté Varga Apr 8 '18 at 19:43
  • Try another drive, or you could use TFTP - try Solarwinds free TFTP server – Karl Billington Apr 8 '18 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.