H-Sphere Documentation Sysadmin Guide

For more information contact us at info@psoft.net

Changing IPs

 

This document explains how to change H-Sphere IPs and covers the following areas:

 

Changing IPs on Systems Without NAT

We are about to release a comprehensive IP migration script that 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

The script doesn't migrate NIC system files to avoid potential problems with server inaccessibility. These files must be migrated manually by the local administrator.

The migration utility doesn't modify reverse DNS configuration because H-Sphere doesn't manage reverse DNS. For configuring reverse DNS, you may refer to www.tldp.org/HOWTO/DNS-HOWTO-5.html#ss5.3

Before you begin IP migration using the old or the new script, do the following changes, and don't forget to undo them after the migration:

  1. 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.
  2. 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 using the old IP migration script available in H-Sphere older than 2.3.1 final:

  1. 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

    -------------

  2. Make sure that your servers can be accessed from the Internet at both old and new IPs;

    - The steps below are performed on the server with the Control Panel installed -

  3. Enter each of your servers from the CP server at least once using the new IP address:

    su - cpanel -c ssh root@[New_H-Sphere_IP]

    Make sure that the 'cpanel' user can log to all H-Sphere servers at the new IPs without entering the password in the interactive mode.

  4. Make sure that the 'cpanel' user can to login to all H-Sphere servers at the old IPs without entering the password in the interactive mode. To do this, enter each of them from your CP server at least once using the command:

    su - cpanel -c ssh root@[Old_H-Sphere_IP]

  5. Create the ipmigration.xml file describing the migration 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]"/>
    ----
    


  6. Copy the created file to the cpanel's home directory.

  7. Change the owner and the group of the copied file in the Control Panel using the command

    chown cpanel:cpanel ~cpanel/ipmigration.xml

  8. Stop the Control Panel

  9. Execute the su -l cpanel command and login as cpanel.

  10. Execute the migration command:

    java psoft.hsphere.tools.IPMigrator < ipmigration.xml

    This utility transfers H-Sphere to the new IP address.
    If you get an error on any of the steps, you can continue the migration from that step using the script's options. For more detailed information on this, run

    java psoft.hsphere.tools.IPMigrator --help

    NOTE: The IP migration process may take rather long.

  11. Please follow carefully the error notifications. You may also find more detailed information on the migration process at /var/log/hsphere/hsphere.log

  12. Edit Bind (/etc/named.conf) configuration files for all DNS servers and change the IP addresses to the new ones in the listen-on directive.

  13. Restart Bind at all DNS servers.

  14. Start Control Panel

  15. Login to Control Panel interface as admin

  16. Enter E.Manager > P.Servers

  17. Replace the IP addresses of the physical servers to the new ones.

 

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.

  1. Change IPs in ~cpanel/shiva/psoft_config/ips-map.xml and ~cpanel/shiva/psoft_config/hsphere.properties
  2. 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
    ------------------
    
  3. Change external IPs in httpd.conf on the web box.
  4. Restart H-Sphere
  5. Recreate zones with the dns creator:
    su -l cpanel
    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:

  1. _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.
  2. Proceed with the IP migration.
  3. Add the following directives to the /hsphere/local/config/httpd/namevh.conf file:
    NameVirtualHost [old_IP]:80
    NameVirtualHost [old_IP]:443
  4. Add the following line at the bottom of the /hsphere/local/config/httpd/httpd.conf file:
    Include /hsphere/local/config/httpd/sites.old/index.conf
  5. On the DNS servers:

  6. Add your old DNS IPs to the /etc/named.conf config to force your DNS servers to listen to the old IPs.
  7. Bind your old IPs to the NIC on your servers.


Home   Products   Services   Partners   Support   News   Contact   Forum
© Copyright 1998-2003. Positive Software Corporation.
All rights reserved.