cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5672
Views
10
Helpful
8
Replies

Change ip address and default gateway on a Cisco switch

AnwarJutt98
Level 1
Level 1

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 ? jazz monthly internet packages

8 Replies 8

balaji.bandi
Hall of Fame
Hall of Fame

basically i do this if no support available remote.

 

Setup a EEM Script tp change the IP and Gateway. ( do not write the configuration - if working you can connect remotely save the config).

 

Safe side i setiup switch reload at time (certain time, like after 20min opf EEM Script running.)

 

Once you able to access the switch ( cancel the reload time) -

 

is this make sense (got get confident test small environment and deploy in real if you have Lab ?)

 

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

The original post asks the question "Is it possible to change the startup config, and reboot the switch with the new settings" and the answer is yes this is possible. It works - assuming that there are no problems with the startup config. The down side of this is that if there are any problems then recovery is very difficult, basically requires someone to console into the switch and make changes.

I like the suggestion of an EEM script to make the changes. It should also be possible to create a small file on a tftp server that has the commands to change the IP address and default gateway. Then access the switch. Issue the command reload in 20 (so if something does not work right the reload will back out the changes) followed by the command copy tftp running to bring in the changes. When the changes are made you should lose your existing connection (the address to which you connected is no longer valid) but you should be able to establish a new connection. If things are looking good then cancel the scheduled reload.

 

HTH

Rick

johnlloyd_13
Level 9
Level 9

hi,

is the new IP address using the same/current management VLAN?

 

Another possible option if the device is remote is to put the commands you want to run to change the configuration into a file and get them on the device flash. Then you can write the current current, schedule a reboot in case it fails, and then copy the commands to running config. If you are able to connect to it, cancel the reboot. If not, the reboot should restore the original config. Obviously this would need to be done during a maintenance window.

copy tftp://1.2.3.4/script_file flash:
copy run start
reload in 10
copy flash:script_file run
! wait to see if you can still connect to the device
! if that succeeds
reload cancel
copy run start

Joseph W. Doherty
Hall of Fame
Hall of Fame

Yes.

As others have noted, one method is to obtain a copy of the device's startup config, copy over the existing startup config (difference sources for the new startup can be used - although generally not the running config), and reload the switch.  As Rick mentions, it your revisions "break" remote access, you'll then need local access to correct.

Possibly another method (another variation of what others have suggested), is to copy the revised statements into a file on that device, and them, (remotely) issue the command to copy that local (to device) file into the device's running config.  (This technique works great if you need to apply multiple config statements for a change, where one or more will "break" remote access until all are applied.)  As also noted by others, if you only change the running config you can use a scheduled reload to restore the device to its prior working config.  If all well, you just cancel the scheduled reload.  (I often use a 5 to 10 minute delay when scheduling the reload.)

AnwarJutt98
Level 1
Level 1

You can schedule the reload command. There are two keywords that you can specify for reload scheduling:

reload at [specific date and time]
reload in [minutes]

Examples:

CiscoRouter# reload at 14:00

The above will reload the router at 2:00pm in the current date. 

CiscoRouter# reload in 2

The above will reload the router in 2 minutes from now. Very useful as we will see in the special case below. unionwell spain

CiscoRouter# show reload

The above shows the current state of the reload command. If you have scheduled a reload operation after some time from now, the above command will show the exact time when the device will reboot.

CiscoRouter# reload cancel

The above will abort any scheduled reload operation.

Also see All about the Cisco Reload Command – How to Schedule a Cisco Reload

I use the "reload in X" command as a fail safe rather than a way to implement my changes. The reason for that is that if anything goes wrong I want the switch to reboot and restore the old configuration that worked. This is very important for remote configuration. traffic rider mod apk download

The question then becomes, how to change the IP and gateway on the fly?

The best way is to make use of the topology around you. You will need to ensure that there is a neighbouring switch or router in the new subnet.

The trick is to set the "reload in 5" (or whatever your desired time period to make the changes below) first. Then change the IP. note: You will lose connectivity once you press enter on the "IP address" command , but all configured well, you will be able to connect to your neighbor device then hop over to the new address on the target switch.

Once you've reconnected via the new address, update the default gateway and try to reconnect remotely (i.e. not via the neighbor). If it all works you can save your config and cancel the reload "reload cancel".

If for any reason you can't reconnect at any step, wait the 5 minutes and the switch will reload and become available again via the old config.

Hello
yes you can -you have a few options:

*Create the amended config file (notepad will do) and then tftp it to the startup-config of the rtr/switch so then as and when you reload the rtr/switch the new config will be applied-

copy tftp:x.x.x.x/new config nvram:startup-config
reload in xx

note-once you’ve done this you cannot then save to the startup-config until you have reloaded the rtr/switch otherwise you will overwrite the download config.

 

*Create the amended config file (notepad will do) and then tftp it to flash:
copy tftp:x.x.x.x/new config flash
copy run start < save existng config
reload in xx
configure replace flash:new_config < if it works then...
reload cancel
copy run start


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul