ReNumber ip address via script ?

Hello,
I need to change ip address of many router can I do this with script ? for example 172.16.57.2/24 but only .57. will change with .58. at ip>>address and at routing>> Ospf >>Network.
if possible I will add script to all boards and do schedule to make all board same time.

Thnx

It is tricky. I would do “/ export file=config-…” for all of them, or at least the main types, and get the files via scp or ftp.

Then you can look at the places that need renumbering. I don’t use ospf, but I’d still need to change things in a lot of submenus:
/ip pool, /ppp profile, /ip address, /ip dhcp-server-network, /ip dns static, lots of places under /ip firewall, and /ip route

Probably if you do:

  • generate a backup export of all configurations, inspect them with grep…, prepare the script, test with one test router for errors
  • deploy the script in all routers via scp/ftp, schedule it to run at a fixed time
  • probably reboot all routers once it is done, or you will have to flush connections, dhcp-client/server leases, ospf state…
  • check which ones are not coming back and fix them
  • for the ones apparently running, repeat the export of all configuration and look again for the prefix for missing cases

You can do it with a reasonable downtime, depending on the number and location of routers.

thank you very much nostromog, I will try to test this