1

On a Cisco 800 series router, I am trying to swap the ip addresses for the WAN and Vlan1 interfaces both at once, but one of them is the one that I'm currently connected to over a Wifi Connection from another router (see picture). When I hit enter on one command, the change is applied immediately, effectively cutting off my connection.

Is there a way that I can stash the configuration lines in a temporary buffer or so and have them applied both in one go when I exit the configure mode or upon reboot?

LAN testing topology

1
  • Configuration changes are applied immediately to Cisco devices.
    – Ron Maupin
    Mar 7, 2018 at 1:03

3 Answers 3

3

I'm not aware of a buffer as such that can store commands.

What you can do is edit the config as a flat file (swapping the addresses as you wish) then upload it to the Cisco 800.

So....

  1. copy running config to ftp or tftp server

    $ copy flash: tftp:

  2. edit file / change ip addresses

  3. ftp/tftp it back $ copy flash: tftp:

  4. copy it to the start-up/running config using

    $copy flash:config.text run

Be aware if you dont copy it to the startup-config too you will lose changes on reload.

4
  • Thanks, that's almost what I had in mind. However, it involves an extra service (tftp server external to the router) which I didn't anticipate.. I may end up doing it that way but I'm still interested if my original plan could be achieved completely on the device.
    – captcha
    Mar 2, 2018 at 21:03
  • The trouble is the fact you need to move a ssh connection from one interface to another, if you just move this then reconnect it should be fine (then you can apply opposing ip address to other interface). However this does take the network down but I believe is the quickest way to do this. Really you just need a third ip to ssh to then your free to change ip addresses over. Is this on a local network, I guess not ?
    – O King
    Mar 6, 2018 at 11:17
  • Yah, all LAN, easily accessible, nothing critical, just for testing. My current setup is that I've connected one of the Cisco's LAN switch ports to a Wireless router LAN switch port. I connect to that router over WiFi and ssh into the Cisco. My main goal was to configure the Cisco for access over the WAN port and the steps I envisioned were to: 1) set the Cisco LAN switch to an ip on a non-conflicting network, 2) set the WAN port to an ip of the wireless router's LAN 3) activate this new configuration 4) walk over to the Cisco and swap the cable from the LAN port to the WAN port.
    – captcha
    Mar 7, 2018 at 0:26
  • 1
    Why on earth don't you use the console port if its all locally accessible and just for testing ? You can entirely accomplish this but you cannot do it using CLI commands you need to edit the config then apply it on either reboot or using #copy flash: run .... You seem to be hung up on the idea of having these commands in some sort of text buffer this doesn't exist on cisco as far as I know and they achieve similar functionality by having 'running-config' and 'startup-config' files that are on NVRAM
    – O King
    Mar 7, 2018 at 15:53
1

Ok, found it..

No silly blue serial cables or TFTP servers required.

The secret sauce here is the built-in tcl scripting language in Cisco IOS. This allows you to stuff all the commands in one go and configure the interfaces as you please.

enable

reload in 10

tclsh

ios_config "int vlan1" "ip address 10.1.1.1 255.255.255.0" "int fa4" "ip address 192.168.20.72 255.255.255.0" "end"

This will indeed cut off your live connection to the router, but the new interface changes are all in effect and there's no need to reboot the router even. I simply walked over to the router, swapped the ethernet cable from the LAN port to the WAN port and voila, this time I was able to connect to the Cisco over the WAN port.

After confirming that everything was looking good, I did a final

wr mem

..and the new configuration is permanently stored as the new startup-config.

1

If you're on a recent IOS (so, honestly, probably not on an 871), you can use IOS.sh. Once you do term shell, you can separate commands by semicolons on one line, and they'll be run sequentially, just like in bash or similar.

Here's an example one-liner, where I changed out a route:

LAB-6807#show run | incl 111.111
ip route 172.31.111.111 255.255.255.255 Loopback0
LAB-6807#term shell
LAB-6807#conf t; no ip route 172.31.111.111 255.255.255.255 Loopback0; ip route 172.31.111.111 255.255.255.255 Null0; end
Enter configuration commands, one per line.  End with CNTL/Z.
LAB-6807#
*May 18 22:33:27.772: %SYS-5-CONFIG_I: Configured from console by hunter on vty1 (x.x.x.x)
LAB-6807#show run | incl 111.111
ip route 172.31.111.111 255.255.255.255 Null0
LAB-6807#

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .