|
This document explains how to change H-Sphere IPs and covers
the following areas:
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 Migrator doesn't modify reverse DNS configuration because H-Sphere
doesn't manage reverse DNS. For information on reverse DNS configuration,
you may refer to www.tldp.org/HOWTO/DNS-HOWTO-5.html#ss5.3
Before you begin IP migration, do the following changes, and
don't forget to undo them after the migration:
- Add the line
exit 0
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.
- Add the line
exit 0
to the very beginning of the /hsphere/shared/scripts/ip-shared
script. This will protect the main H-Sphere IP.
To perform the IP migration:
- Replace the IP on the main network interface to the new
IP for all boxes.
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
-------------
- 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.
- The steps below are performed on the server with the
Control Panel installed -
following this template:
------------------------- ipmigration.xml template ----------------------
<?xml version="1.0"?>
<!DOCTYPE ipmigrate [
<!ELEMENT ips (ip+)>
<!ATTLIST ip name CDATA #REQUIRED>
<!ATTLIST ip new_ip CDATA #REQUIRED>
<!ATTLIST ip new_mask CDATA "[New_NetMask]">
]>
<ips>
<ip name="[Old_IP]" new_ip="[New_IP]"
new_mask="[New_NetMask]"/>
<ip name= .........
</ips>
-------------------------------------------------------------------------
In the prolog (the DTD header of the xml file), specify what
attributes will be provided with each IP. If you are going
to use the same netmask for all new IPs, set [New_NetMask]
to the needed value:
----
<!ATTLIST ip new_mask CDATA "[New_NetMask]">
----
If netmasks are going to be different for different IPs,
change "[New_NetMask]" to #REQUIRED. This will
tell IP migrator to take net mask values from the XML definitions
for individual IPs:
----
<!ATTLIST ip new_mask CDATA #REQUIRED>
----
In the <ips> ... </ips> block, list all old-new
IP pairs, including users' dedicated IPs. If you have specified the
common netmask in the DTD header, you don't need to set it in the
definition line for each individual IP:
-----
<ip name="[Old_IP]" new_ip="[New_IP]" />
-----
If you have set new mask in the DTD header to #REQUIRED,
you need to specify the netmask parameter for each IP:
----
<ip name="[Old_IP]" new_ip="[New_IP]" new_mask="[New_NetMask]"/>
----
- Copy the created file to the cpanel's home directory.
- Change the owner and the group of the copied file in
the Control Panel using the command
# chown cpanel:cpanel ~cpanel/ipmigration.xml
- Log into the control panel server as root:
# su -
- Download IP Migrator:
# wget http://www.psoft.net/shiv/IPMIGR.tgz
IP Migrator was updated on 30 Apr 2004.
If you have an older version, update it.
- Untar the archive:
# tar -zxf IPMIGR.tgz
- Enter the IP Migrator directory:
# cd IPMIGR
- Install the IP Migrator:
# make install
- Stop H-Sphere
- Back up H-Sphere system database
- Log in as the cpanel user
and run IP Migrator:
# ./ipmigrator
- Carefully follow the error notifications. You
may also find more detailed information on the migration
process at /var/log/hsphere/hsphere.log
- Start H-Sphere
- Remove the line
exit 0
from /hsphere/shared/scripts/apache-reconfig and
from /hsphere/shared/scripts/ip-shared.
Changing IPs on Systems Using 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 ~cpanel/shiva/psoft_config/ips-map.xml and
~cpanel/shiva/psoft_config/hsphere.properties
- 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/index.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.
|