Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Community Member

Change ip and default gateway with only one command

I need to change multiple commands on a router with only one command, for example I have to send these command:

conf t

interface fastethernet 0/0

ip address 192.168.0.1 255.255.255.0

exit

ip route 0.0.0.0.0 0.0.0.0 192.168.0.254

Is it possible send only one "macro" command to a router?

2 REPLIES
Silver

Re: Change ip and default gateway with only one command

I'm going to guess you are accessing the router over the very interface and route you are configuring?  This is always dangerous business.

Out of band management; such as a modem you can dial into that's connected to the console is the best way.

If you don't have that option continue at your own risk.

1.  Write mem

2.  Reload in 20 ### Router will reload with saved config 20 minutes latter in the event of 'lost router' scenario.

3.

ip route 0.0.0.0.0 0.0.0.0 fa0/0

no ip route 0.0.0.0 0.0.0.0 x.x.x.x  ### This is the original default route

### Still work?

4.

int fa0/0
ip address 192.168.0.1 255.255.255.0
exit

ip route 0.0.0.0 0.0.0.0 192.168.0.254

no ip route 0.0.0.0 0.0.0.0 fa0/0

### Still work??

5. write mem

6. reload cancel


Chris

Hall of Fame Super Gold

Re: Change ip and default gateway with only one command

As Christoper pointed out, that is always dangerous to do.

I would recommednt he following:

a. prepare a complete new configuration file

b: conf overwrite

c. reload

As long the new configuration is correct, that method is guaranteed to work.

809
Views
0
Helpful
2
Replies
CreatePlease to create content