cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
55509
Views
35
Helpful
14
Replies

Modify startup-config while using running-config

Ranbeckycr_2
Level 1
Level 1

Hello Experts,

I'm trying to find a way to modify the startup configuration file of my router while working on the running configuration.

This is my dilema:

1. I need to change ISP on a remote location. The user at the remote location is NOT technical at all.  He will only be changing the cable.

I have been reading and I can't seem to find an answer to perform this task.

In example: 
old_ISP 1 - IP address (Fa0/0) 1.2.3.4  (running configuration)

               Gateway: 1.2.3.5

new_ISP 2 - IP address (Fa0/0) 6.7.8.9 (new startup configuration after reboot)

               Gateway: 6.7.8.10

Is there a way for me to make that change without losing network access?

Thanks for all the help

1 Accepted Solution

Accepted Solutions

John Blakley
VIP Alumni
VIP Alumni

Can you get access to the router now? If so, try the following:

1. tftp/ftp the startup config to yourself

2. edit the file

3. tftp the edited file back to the router overwriting the startup config

That'll do it, but the problem is that if you make a mistake then you've got nothing to fall back on other than walking the user through getting into the router and fixing the mistake.

HTH,

John

HTH, John *** Please rate all useful posts ***

View solution in original post

14 Replies 14

John Blakley
VIP Alumni
VIP Alumni

Can you get access to the router now? If so, try the following:

1. tftp/ftp the startup config to yourself

2. edit the file

3. tftp the edited file back to the router overwriting the startup config

That'll do it, but the problem is that if you make a mistake then you've got nothing to fall back on other than walking the user through getting into the router and fixing the mistake.

HTH,

John

HTH, John *** Please rate all useful posts ***

Randall

The suggestion from John is the most sure way to do it and is what I thought of first, so I agree with him. You can copy to startup config (and change startup config) without any impact on the running config. I would also point out that one other thing to be cautious about is that after you have copied the changed startup config back to the router startup config that if anything causes the router to reboot (power problems etc) then it will be running with the changes and you will have lost connectivity to the old provider. (so wait till pretty close to the time of the cut over to copy the changed file to the router) In this scenario you will probably do these steps 1) get the config from the router into a text file. 2) modify the text file with the changes that you need and save it. 3) copy the changed text file to the router startup config. 4) at cutover time power down the router. 5) have the user change the cables. 6) power up the router and hope that the new connection comes up as intended.

Another alternative might be to create a text file at your site and put into it the various changes that you need to make (interface address, gateway). At cutover time copy (using TFTP or FTP as you prefer) the text file to running config. Then have the user change the cables (without shutting down the router). If the changes worked the new connection should come up and then you have access to the router to copy running to startup to make the changes permanent. If the new connection does not come up, then you can simply switch the cables back, power cycle the router, and you should be working ok on the old connection and you can try to figure out why it did not work and try again.

Another thought is to ask if there is any possibility of out of band management for the remote router?

HTH

Rick

HTH

Rick

Thanks for the help and the pointers.

Awesome, thanks a lot, I'll give it a shot.

You can always make a copy of the config that you download from the device and make changes to the copy. Then if you upload the copy and it doesn't work correctly, at least you can get back to where you were fairly quickly.

Joseph W. Doherty
Hall of Fame
Hall of Fame

Disclaimer

The Author of this posting offers the information contained within this posting without consideration and with the reader's understanding that there's no implied or expressed suitability or fitness for any purpose. Information provided is for informational purposes only and should not be construed as rendering professional advice of any kind. Usage of this posting's information is solely at reader's own risk.

Liability Disclaimer

In no event shall Author be liable for any damages whatsoever (including, without limitation, damages for loss of use, data or profit) arising out of the use or inability to use the posting's information even if Author has been advised of the possibility of such damage.

Posting

Since old and new are IPs on the same Ethernet interface, I'm wondering whether you might be able to transition using secondary addressing on the same interface?  For gateway, could temporality place the interface in a route statement rather than an IP address.

e.g.

interface fastEthernet0/0

ip address 1.2.3.5 x.x.x.x secondary

ip address 6.7.8.10

ip route 0.0.0.0 0.0.0.0 fastEthernet0/0

PS:

Oh, if this interface is the only method to connect to the router remotely, you'll want the old address as the primary and the new address as the secondary, so as to not break connectivity.

If you make a change like above, you can also reload in 5, to restore your system if the above causes a problem.

If it's good, clean-up this later using a different start-up config, as already described.

BTW, don't forget you can have alternative config files stores on the different router storage.  This might be good the non-technical user has console access and you believe it might be easier to talk them though using a copy command rather than changing lines of the config.

Also on the subject of configuration files, recall later IOS version offer some form of archiving, but don't recall what all that it provides which might help in this situation, if anything.

I thought about the secondary IP but that would leave me with "extra configuration on the router".  Appreciate the help.

Good idea on the default gateway.

Disclaimer

The  Author of this posting offers the information contained within this  posting without consideration and with the reader's understanding that  there's no implied or expressed suitability or fitness for any purpose.  Information provided is for informational purposes only and should not  be construed as rendering professional advice of any kind. Usage of this  posting's information is solely at reader's own risk.

Liability Disclaimer

In  no event shall Author be liable for any damages whatsoever (including,  without limitation, damages for loss of use, data or profit) arising out  of the use or inability to use the posting's information even if Author  has been advised of the possibility of such damage.

Posting

Randall Villalobos wrote:

I thought about the secondary IP but that would leave me with "extra configuration on the router".  Appreciate the help.

Good idea on the default gateway.

Yes it does leave extra configuration but that's what would be part of the later "clean-up" I mentioned.  Perhaps a little more overall work, but provides a recovery option before the transition and a back out option during the transition.  Both critical points correctly noted by the other posters.

Consider you do everything "right" but new provider's link has an issue when you first try moving to new link.  Of course, if you disco your working link at exactly the same time as you try to move to the new link, back out doesn't matter. (I'm one of the people who believes Mr. Murphy was an optimist, so I would prefer some service window overlap between old and new providers.)

As to the default gateway, only recommend it for the transition.  It's not as efficient as having the next hop in the default route.  It avoids filling your RAM with the ARP table.

pathiahia
Level 1
Level 1

Excuse me for reviving this very old thread, but I think I have a nice addition for all the folks that get here via google looking for answers to a similair question.

What I usually do on an Cisco ISR router is start tclsh and run a command like this:

ios_config "no ip route 0.0.0.0 0.0.0.0 <old_gateway>" "ip route 0.0.0.0 0.0.0.0 <new_gateway>" "interface <desired_interface>" "ip address <new_ip> <new_subnetmask>"

That way you will change both ip address and default route to your new connection in the running configuration in one command. After that the guy onsite can change the cabling to the new connection.
If your new connection does not work properly or you made a boobobo in the configuration lines you can simply revert to your old setting by asking the guy onsite to change the cabling again and power cycle the router and it'll come back up with its old startup configuration.
If it does work then ssh back into the router again and give a copy run start and you'll be migrated to your new connection without a huge risk of losing access and sending out a technician.

You can also use tclsh to change your uplink port from auto/auto to 100Mbps/Full Duplex in one command. For example:

ios_config "int <desired_interface>" "speed 1000" "duplex full"

Again, if things don't work out well and you lose connection to the router, just let someone onsite reboot the router and it'll be back with its previous settings.

pathiathia has the easiest answer.  My suggestion is this (Note, the " are included as part of the command):

reload in 10

tclsh

ios_config "no ip route 0.0.0.0 0.0.0.0 <old_gateway>" "ip route 0.0.0.0 0.0.0.0 <new_gateway>" "interface <desired_interface>" "ip address <new_ip> <new_subnetmask>"

__________________________________________________________________________

If all works as you want it to:

reload cancel

wr mem

Martin12
Level 1
Level 1

Taking into account this post is old , there is another option - the one without reload !!! :)

 

1 Modify the configuration in notepad

2 Copy it to router flash: or nvram:

3 Type " Configure replace your_path:// "

 

The device should already process config line by line and replace it, not just merge the configuration. There are some caveats and more option to the replace command though. You can read more about the command on cisco.com

 

config replace options gathered with ? mark :

-------
force Forcibly replace without prompting for user input
ignorecase Ignore case
list List the commands applied in each pass
nolock Do not acquire config lock
revert Options for reverting back to the original config
time Time for which to wait for confirmation

<cr>

 

The thing is that where normally you would get cut from device and not be able to send more characters via console, this process will still finish what you wanted provided that it is reading the configuration stored on the device and just re-writing the running-conf.

If you do everything properly and opposite side device is matching the new configuration (subnet, LACP configuration...) - you are done without any reload

Another variation, you can copy just the commands to effect the change to device's flash then issue a reload in 10 (or whatever you think is a good fallback reload time), copy flash:<file> to running. If okay, cancel reload and save running to startup, if not okay, reload will restore startup config. (NB: I've used this approach several time when updating a remote device whose changes will disconnect me.)

darmonwebb
Level 1
Level 1

I use this community for all types of information. I came across something that may be useful for this problem. Cisco has built in TCL scripting. Not sure of what platforms it may or may not be available but this worked for me.

1. copy start-up config to flash

2. Do a "show start" command and paste the output to your local text editor like notepad

3. Make whatever changes you want reflected in that file. You can save but it isn't needed because you will just be pasting it later

4. From enable mode, type tclsh and hit enter. This gets you into "scripting" mode

5. Now type puts [open "flash:filename" w+] { 

6. DO NOT hit ENTER! Instead just paste your text file in. At the end of you file be sure to close the scripter with "}" without the quotes and then hit enter

7. Quit tcl with tclquit

8. Open the file you created and make sure it looks correct

10. If you are satisfied, copy that file to startup and viola!

 

Example:

(tcl)#puts [open "flash:CHANGES" w+] {conf t
+>default int g0/2
+>!

+>end

+>wr mem}

(tcl)#tclquit

#dir
Directory of flash0:/

1 -rw- 104134844 Jul 23 2015 12:22:30 -04:00 c2900-universalk9-mz.SPA.154-3.M2.bin
2 drw- 0 Jul 23 2015 13:42:28 -04:00 archive
76 -rw- 410 Sep 26 2018 12:23:32 -04:00 CHANGES

 

 

HTH someone!

Hi,
One note to this tclsh created startup config. What I noticed during one of my migrations, the C3850 switches for example have built-in wireless controller capability. Even though you are not using it, if you create the startup config just like this:
tclsh
puts [ open "nvram:/startup-config" w+] {
!
version 15.2
!


hostname YOUR-SWITCH
!
some mgmt. config and such
!
// define you vlans and define SVI !!!
!

ip default-gateway IP_ADD

!
end
}
tclquit

AND you miss this command, it will terminate and revert the config replace operation
!
ap group default-group <<<<<<<
!

It is platform specific, there can be other caveats with other HW platforms and I strongly advise you to test in the lab with real HW to know what commands need to be in startup otherwise you will fail ...

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card