Search code examples
ciscocisco-ios

Change ip address and default gateway on a Cisco switch


I have some switches where i need to change both ip address and default gateway on the management vlan. (remote)

Is it possible to change the startup config, and reboot the switch with the new settings ?


Solution

  • There is another way to do this. You can load a config in from flash.

    So, SCP the config onto the flash of the device containing the config.

    something like:

    scp myfile.txt admin@myrouter:flash
    

    myfile.txt contains the actual config:

    interface vlan
     ip address x.x.x.x x.x.x.x
    !
    ip default-gateway x.x.x.x
    

    Then on the switch do:

    copy flash:myfile.txt running-config
    

    This should load the contents of the file into the running config and execute both the IP address change and default gateway (even if you get cut off.)