Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I need to change the configuration of a remote (6 hours' drive) client's Cisco 871 (IOS 12.4.15T) from my location because of some new internet service at his location. To be more precise, I need to change the default route, ip address of the outside interface (Fa4) and disable the PPPoE setup there. Unfortunately, doing any of this will (obviously) break the connection to the router. I do not have an out-of-band management modem set up (I know, I know).

Is there any way to enter the commands I need to have run and have them execute one after the other, from a file on flash:? I have never tried anything like that before. Essentially a DOS-style batch file is exactly what I need. Nothing like it seems to be out there except using kron to execute CLI commands, but that is specified here as only taking EXEC commands, not configuration ones. Is there hope, or do I travel?

share|improve this question

5 Answers 5

up vote 4 down vote accepted

I believe it's possible to copy a file from flash: to running-config, but I am not 100% sure. You may be better off copying the existing running-config to a known-good-startup, copying the config you want on top of startup-config, then reload the router (with, ideally, somneone on site who can be walked through a password-recovery-style recovery, should the new config be broken).

Alternatively, if the relevant config can be comfortably fit in a single TCP frame, you could write some code to issue a reload in 10 command, then a config t and finish off with all relevant config commands, separated by CR NL, in a single frame.

Edit: Then either log on to the router manually or send a second frame with enough commands in it to cancel the reload (the relevant IOS command is reload cancel).

share|improve this answer
    
As you suspect, the best way to execute a number of commands at once is to merge them into the running-config using copy URI running-config. Naturally, preceded with reload in 10 just in case it doesn't work as expected. –  MikeyB Jan 31 '11 at 16:09

If you have a tftp server that is accessible to the router, you can edit your configuration there, and then load the configuration from the tftp server.

Just be very careful, and have a backup plan in place. If anything goes wrong, you're going to be offline and need to visit yourself, or find someone else local to be your hands.

share|improve this answer

You can do this with a tclsh macro.

Create macro

router#tclsh
router(tcl)# set foo {
+>conf t
+>int f0/1
+>ip addr.....
+>no ip route 0.0.0.0 .....
+>ip route 0.0.0.0 .....
+>exit  
+>exit  
+>}     

Execute and quit tclsh:

router(tcl)#eval $foo
...
router(tcl)#tclq

Test this in a lab to make yourself familiar with tclsh in Cisco routers.

share|improve this answer
    
That is awesome. –  atroon Jan 31 '11 at 16:11

Do you have telnet access to the router? You can telnet to the router, copy the running config to notepad, make the needed changes, and paste the contents of notepad back into the router from config mode and that should do it.

You may lose your telnet connection temporarily but the router will continue pasting the uploaded config and assuming that the new config works you'll be able to telnet back in and save it to the startup config.

share|improve this answer

You can use configure replace to rollback changes.

http://www.cisco.com/en/US/docs/ios/12_3t/12_3t7/feature/guide/gtrollbk.html#wp1131261

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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