n2972s

Registered
Mar 23, 2002
3
0
301
We have to change all the IP's on our server.

I am wondering if anybody has any idea on how to mass change the IP's of all our sites on the server.

What we want to do is do a mass change from our old shared IP to the new shared IP.

Any info would be appreciated.

Thanks
 

cyrus

Member
Mar 1, 2005
16
0
151
I know this post is way too old, but recently our datacenter changed their entire IP range and this is what we did.


Note: For this example, I assume that you are using a regular Linux Distro (RH/CentOS/FC) and have the /usr/bin/replace command which comes with MySQL-server.xx.rpm. I also assume that your datacenter has configured both old aswell as the new networks on their router.

OLD IP : 10.x.x.x with default route 10.x.x.1
NEW IP : 11.x.x.x with default route 11.x.x.1

Firstly add the new IP range using WHM->IP Functions (don't add the new base IP address).
Ping few of these newly added IPs just to make sure that everything is ok.

Reduce the TTL of all dns zones to something like 600 seconds.

Code:
cd /var/named
replace 14400 600 -- *.db
/usr/sbin/rndc reload

Take a backup of all the configuration files which will be modified by this script:


Code:
#!/bin/bash
# 10.x.x.x = OLD IP Range
# 11.x.x.x = NEW IP Range

cd /etc/httpd/conf
replace 10.x.x.x 11.x.x.x -- httpd.conf
service httpd restart

cd /var/named
replace 10.x.x.x 11.x.x.x -- *.db
rndc reload

cd /var/cpanel
replace 10.x.x.x 11.x.x.x -- *

cd /var/cpanel/dips
replace 10.x.x.x 11.x.x.x -- *

cd /var/cpanel/mainips
replace 10.x.x.x 11.x.x.x -- *

cd /var/cpanel/users
replace 10.x.x.x 11.x.x.x -- *
Once this script runs successfully, we will change the base IP address of the system. Assuming that your main interface is eth0, edit the file /etc/sysconfig/network-scripts/ifcfg-eth0 and carefully change the IP, Broadcast, Netmask, etc. to that of the new IP range.

From:
Code:
DEVICE=eth0
BOOTPROTO=static
BROADCAST=10.x.x..255
IPADDR=10.x.x.x
NETMASK=255.255.255.0
NETWORK=10.x.x.0
ONBOOT=yes
To:
Code:
DEVICE=eth0
BOOTPROTO=static
BROADCAST=11.x.x..255
IPADDR=11.x.x.x
NETMASK=255.255.255.0
NETWORK=11.x.x.0
ONBOOT=yes
Now we change the default route by editing /etc/sysconfig/network :

From:
Code:
NETWORKING=yes
HOSTNAME=your.hostname
GATEWAY=10.x.x.1
To:
Code:
NETWORKING=yes
HOSTNAME=your.hostname
GATEWAY=11.x.x.1
Also, if you are using your datacenter's DNS don't forget to change your DNS servers in /etc/resolv.conf

Thats about it, its better you check the configs once again and reboot the machine (alternately you can also restart each service ;) )

All the best :D




P.S: I forgot to add one more thing, after a day or so, change the TTL of all your zone files back to original
Code:
cd /var/named
replace 600 14400  -- *.db
/usr/sbin/rndc reload
 
Last edited:

cyrus

Member
Mar 1, 2005
16
0
151
Oh sorry I forgot to mention, that function is utterly useless when it comes to changing 100+ IPs on a system with more than 400 accounts. Try it and you'll see :)
 

dave9000

Well-Known Member
Apr 7, 2003
888
1
168
arkansas
cPanel Access Level
Root Administrator
Everytime I have used the change mutli account ips script I have to limit it to no more than 4 sites at a time and if a large site do only 1 at a time or the script will hang and then have to do the kill -9 pid on all hung processes and start over
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
33
473
Go on, have a guess
And once again, when you change a zone file contents you should increase each SERIAL number otherwise you are asking for propagation problems.
 

ntwaddel

Well-Known Member
Nov 3, 2003
173
0
166
Templeton, CA
what about the primary ip

can i change it in
/etc/sysconfig/network-scripts/ifcfg-eth0

then will it be listed as an option to switch the ips to in the whm feature
 

ntwaddel

Well-Known Member
Nov 3, 2003
173
0
166
Templeton, CA
what about the IP Migration tool, how does that work exactly?

I have 12 ip's on this server, the main shared ip is the primary ip address on the box, then 11 other sites with a dedicated ip.