I have to change IP numbers across a number of virtual and physical machines because of network center move. This has to be done before network startup, of course. I'm thinking about the best method to do this. Where should I include/init this script? Or would it rather make more sense to do this on the last shutdown?
Changes largely involve removing old files and putting new files in place (resolv.conf, hosts, sysconfig/network + network-scripts, firewall, postfix, httpd etc.). The only other change besides replacing files would be changing the IP address in a webcontrol interface in a MySQL table, so this part has to be done after MySQL startup.
Could be run-once or have to disable manually after successful startup.
Thanks,
Kai
Kai Schaetzl wrote:
Changes largely involve removing old files and putting new files in place (resolv.conf, hosts, sysconfig/network + network-scripts, firewall, postfix, httpd etc.). The only other change besides replacing files would be changing the IP address in a webcontrol interface in a MySQL table, so this part has to be done after MySQL startup.
If I needed to do this, I would start by making a tarball of all files that need to changed. Then I would edit the files as needed and make a tarball of the new version.
Next I would write two scripts, one to enable the new settings and one to restore the old settings. At the end of each script restart network services. Then create an at job to enable the new settings at now+2min and another to restore the former settings at now+7min.
In two minutes you should be able to ssh to the host and cancel the second at job. If anything goes wrong, just wait 5 minutes and old network settings are back.
c
Kai Schaetzl wrote:
I have to change IP numbers across a number of virtual and physical machines because of network center move. This has to be done before network startup, of course. I'm thinking about the best method to do this. Where should I include/init this script? Or would it rather make more sense to do this on the last shutdown?
I just noticed that this is a one-time occurrence after the move to a new network. In this case there is no need to schedule the at job. Just make a backup of files you are changing, then make the changes. They will not take effect immediately unless you restart any of the services. (So don't restart an services or reboot the server prior to the move.)
Plan a time to make the changes prior to shutting down at the old data center. They should come up correctly in the new environment.
c
Kai Schaetzl wrote:
I have to change IP numbers across a number of virtual and physical machines because of network center move. This has to be done before network startup, of course. I'm thinking about the best method to do this. Where should I include/init this script? Or would it rather make more sense to do this on the last shutdown?
Changes largely involve removing old files and putting new files in place (resolv.conf, hosts, sysconfig/network + network-scripts, firewall, postfix, httpd etc.). The only other change besides replacing files would be changing the IP address in a webcontrol interface in a MySQL table, so this part has to be done after MySQL startup.
Could be run-once or have to disable manually after successful startup.
There are several possibilities (this *is* *Nix, after all), but several questions first: aren't you using dhcp to give them IPs? Won't the dhcp client rewrite resolv.conf?
For the other stuff, if it needs to run once, why not have the script looking for a lock file, and if it's not there run, ending by creating the lock file. Then, after everything's up and wonderfully correct, you can run a script everywhere that, if it finds the lockfile, deletes both that, and the script?
mark
On Fri, Sep 20, 2013 at 10:13 AM, m.roth@5-cent.us wrote:
Kai Schaetzl wrote:
I have to change IP numbers across a number of virtual and physical machines because of network center move. This has to be done before network startup, of course. I'm thinking about the best method to do this. Where should I include/init this script? Or would it rather make more sense to do this on the last shutdown?
Changes largely involve removing old files and putting new files in place (resolv.conf, hosts, sysconfig/network + network-scripts, firewall, postfix, httpd etc.). The only other change besides replacing files would be changing the IP address in a webcontrol interface in a MySQL table, so this part has to be done after MySQL startup.
Could be run-once or have to disable manually after successful startup.
There are several possibilities (this *is* *Nix, after all), but several questions first: aren't you using dhcp to give them IPs? Won't the dhcp client rewrite resolv.conf?
For the other stuff, if it needs to run once, why not have the script looking for a lock file, and if it's not there run, ending by creating the lock file. Then, after everything's up and wonderfully correct, you can run a script everywhere that, if it finds the lockfile, deletes both that, and the script?
I'd probably do it as a search/replace script trying to make it so the search targets will only match once (the old values) so it doesn't matter if it runs again or not. And I'd probably copy the script in and run it as part of the final shutdown steps.
On 9/20/2013 5:31 AM, Kai Schaetzl wrote:
I have to change IP numbers across a number of virtual and physical machines because of network center move. This has to be done before network startup, of course. I'm thinking about the best method to do this. Where should I include/init this script? Or would it rather make more sense to do this on the last shutdown?
reconfigure the servers to use dhcp and configure the hosts via reservations on the dhcp servers. new location on a new subnet would have require reservations, reboot and voila!
DNS should be taking care of any application stuff (when the servers are moved, their entries are updated on the DNS servers)
On Fri, Sep 20, 2013 at 9:11 PM, John R Pierce pierce@hogranch.com wrote:
On 9/20/2013 5:31 AM, Kai Schaetzl wrote:
I have to change IP numbers across a number of virtual and physical machines because of network center move. This has to be done before network startup, of course. I'm thinking about the best method to do
this.
Where should I include/init this script? Or would it rather make more sense to do this on the last shutdown?
reconfigure the servers to use dhcp and configure the hosts via reservations on the dhcp servers. new location on a new subnet would have require reservations, reboot and voila!
DNS should be taking care of any application stuff (when the servers are moved, their entries are updated on the DNS servers)
+1 to DNS + DHCP.
1. Configure your DNS A entries to the new IP scheme. 2. Configure your DHCP to give out fixed IP based on the MAC addresses of your servers and their respective IP number in your new DNS scheme. 3. Configure the systems to do DHCP and they should boot up with the new IP numbers. 3. Services like Postfix, NFS etc. should be using DNS names rather than IP numbers IMO, so the changes should be minimal if any.
-- Arun Khan Sent from my non-iphone/non-android device