This document explains how to change IPs on Unix/Linux servers for H-Sphere 2.4.x.
If you have an older version, please get updated first.
Changing IPs on Systems Without NAT
H-Sphere IP migration is performed by means of Java IP Migrator
called by the IPMIGR wrapper available for download from the
psoft.net website. IP Migrator will:
- change H-Sphere physical, logical, and system IPs
- update IPs in H-Sphere database
- change IPs in the system files except network startup configuration
- update IP-dependent resources such as apache, FTP and DNS
IP Migrator doesn't migrate NIC system files to avoid potential
problems with server inaccessibility. These files must be migrated
manually by the local administrator.
IP Migration Pre-Requisites
Before you begin IP migration, do the following changes, and
don't forget to undo them after the migration:
- Add the following line
to the very beginning of the /hsphere/shared/scripts/apache-reconfig
script. This will prevent Apache from restarting gracefully after
posting each web site configuration:
exit 0
- (Skip this step for IP Migrator 0.3 and up)
Add the following line
to the very beginning of the /hsphere/shared/scripts/ip-shared
script. This will protect the main H-Sphere IP.
exit 0
After that, replace the IP on the main network interface to the new
IP for all boxes, and set up the old IP as an alias for the new one;
Example:
eth0 Link encap:Ethernet HWaddr 00:D2:B5:A1:07:12
inet addr:[New_IP] Bcast:[New_Broadcast] Mask[New_NetMask]:
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:269050319 errors:0 dropped:0 overruns:0 frame:11
TX packets:336024701 errors:0 dropped:0 overruns:19 carrier:0
collisions:0 txqueuelen:100
Interrupt:21 Base address:0x4000
eth0:0 Link encap:Ethernet HWaddr 00:D2:B5:A1:07:12
inet addr:[Old_IP] Bcast:[Old_Broadcast] Mask:[Old_NetMask]
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:21 Base address:0x4000
Important: If IP migration is performed within one datacenter,
make sure that your servers can be accessed from the Internet
at both old and new IPs. If you change to IPs outside your
datacenter, it would take a downtime before you make your servers
available on new IPs.
IP Migration Map File
Before you start IP migration, you may manually create an
IP migration map file
in the cpanel user home directory ~cpanel/.
The file contains the list of old IPs to be migrated to new IPs.
It can be either an
XML file,
or a plain text file of the following format:
IP_OLD1 IP_NEW1 [MASK_NEW1]
IP_OLD2 IP_NEW2 [MASK_NEW2]
...
IP_OLDn IP_NEWn [MASK_NEWn]
Specify the mask in the third column only if it differs from the default mask (255.255.255.0)
for this particular IP. Otherwise, omit it.
Important: IP migration map file must have the cpanel:cpanel ownership! Either create it under
the cpanel user, or run under root:
IP Migration Step By Step
The steps below are performed on the server with the Control Panel installed.
- Log into the CP server as root:
# su -
- Download IP Migrator:
The latest IP Migrator version is 0.3.
If you have an older version, update it.
- Untar the archive:
# tar -zxf IPMIGR-0.3.tgz
- Enter the IP Migrator directory:
# cd IPMIGR
- Install the IP Migrator:
# make install
This will install the following files:
- ~cpanel/ipmigrator - IP migrator itself
- ~cpanel/IPMigratorFast.jar - makes H-Sphere related changes: in the system database,
configs, etc.
- ~cpanel/shiva/ipm/ipmigr - makes changes in service config files on H-Sphere servers
- Stop H-Sphere
- Back up H-Sphere system database
- Log in as the cpanel user
- Start H-Sphere
- Remove the following line
from /hsphere/shared/scripts/apache-reconfig and
from /hsphere/shared/scripts/ip-shared:
exit 0
- If the IPs have been migrated successfully and all IP-dependent services seem
to work fine, finish the migration by removing the old IPs. To remove the old IPs, run:
./ipmigrator --clear-old-ips --xml=<ipm_xml>
Where <ipm_xml> is the IP migration map XML file that you used for the migration.
Example:
Changing External IPs on Systems With NAT
This section explains how to change your external IPs on a system using
NAT (see details here). You may need to follow
this instruction when you move to a different location and would like
to preserve your internal IP settings.
- Change IPs in SiteStudio configs /hsphere/shared/SiteStudio/psoft_config/*.
You can use a simple script:
#!/bin/sh
if [ $# = 0 ] ; then
echo $"Usage: changeip.sh OldIP NewIP"
exit 1
fi
for i in /hsphere/shared/SiteStudio/psoft_config/*.properties
do
echo "Processing $i";
echo ",s/$1/$2/g
wq" | ed $i
done
- Change external IPs in httpd.conf on the web box.
- Restart H-Sphere
- Log in as the cpanel user
and recreate zones with the dns creator:
java psoft.hsphere.tools.DNSCreator -m db -dz
How do I get H-Sphere working on two sets of IPs?
If you would like to ensure smooth change of IPs and have everything
duplicated on the old and new sets of IPs before making the switch,
you need to do the following:
On the Web box:
- Before the IP migration you need to copy the
/hsphere/local/config/httpd/sites directory to
/hsphere/local/config/httpd/sites.old to preserve your
old client's apache configs.
- Go to /hsphere/local/config/httpd/sites.old and edit index.conf changing sites to sites.old
(cd /hsphere/local/config/httpd/sites.old; perl -pi -e 's/sites/sites.old/' index.conf)
- Copy namevh.conf to namevh.old.conf
- Proceed with the IP migration.
- Add the following lines at the bottom of the /hsphere/local/config/httpd/httpd.conf file:
Include /hsphere/local/config/httpd/sites.old/[0-9]*.conf
Include /hsphere/local/config/httpd/namevh.old.conf
On the DNS servers:
- Add your old DNS IPs to the /etc/named.conf config to force your DNS servers
to listen to the old IPs.
- Bind your old IPs to the NIC on your servers.
|