Change ip and default gateway with only one command

Unanswered Question
Oct 1st, 2010
User Badges:

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?

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
gatlin007 Fri, 10/01/2010 - 08:52
User Badges:
  • Silver, 250 points or more

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

paolo bevilacqua Fri, 10/01/2010 - 09:46
User Badges:
  • Super Gold, 25000 points or more
  • Hall of Fame,

    Founding Member

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.

Actions

This Discussion