Skip to content

IP Address Change

Anoop Rajendra edited this page May 15, 2017 · 1 revision

Changing the IP address space across a Cluster.

Save existing network information

  1. Dump the hostfile

    # stack report hostfile > stacki.hosts.csv
    
  2. Dump /etc/hosts

    # stack report host > hosts.stacki
    
  3. Dump network config

    # stack report networkfile > networks.stacki
    

Change CSV Files

  1. Open network file, and add a new line. Change the file from

    NETWORK,ADDRESS,MASK,GATEWAY,MTU,ZONE,DNS,PXE
    private,192.168.16.0,255.255.240.0,192.168.16.1,1500,stacki.com,False,True
    

    to

    NETWORK,ADDRESS,MASK,GATEWAY,MTU,ZONE,DNS,PXE
    private,10.2.0.0,255.255.255.0,10.2.0.1,1500,stacki.com,False,True
    oldprivate,192.168.16.0,255.255.240.0,192.168.16.1,1500,stacki.com,False,False
    

    Note that this moved original private to oldprivate. The private line now contains new network information, including new Address, Mask, and Gateway

  2. Open hosts.csv file, and change the IP addresses of the hosts from original to new.

Apply the change

  1. Import the network.csv file into the database

    # stack load networkfile file=networks.csv
  2. Import the hosts.csv file.

    # stack load hostfile file=hosts.csv

    This might throw out an error message saying

    error - host frontend is not in cluster

    This error occurs because of a mismatch between IP address recorded in the database, and IP address of the NIC itself. It's OK to ignore this error message for now.

  3. Reset the bootactions of all hosts.

    # stack set host boot backend action=os
    # stack sync config
    # stack sync host config
  4. Open the /etc/hosts file.

    You should see old IP addresses for all hosts. This is currently showing incorrect information since, all the hosts still have their old networking information.

    NOTE
    During a switch-over of IP addresses, there will be many instances where the information in the database, will be inconsistent with information in the /etc/hosts file, which in turn will be inconsistent with the status of the nodes. This might cause network connectivity issues.

  5. The /etc/hosts file has old IP addresses for all hosts. Move this to another location.

  6. Copy over the ORIGINAL /etc/hosts file that was backed up.

  7. In this file, change only the IP address of the frontend to the new IP address. Leave all the others IP addresses still pointing to the old IP addresses.

    NOTE
    This is required for the stack command line to function correctly.

    Copy this version of /etc/hosts file to a safe location. this will need to be used again. Call it /tmp/etc.hosts.unstable

  8. Next, change the networking files on the backend nodes.

    # stack sync host network backend restart=no

    This will change all networking files on the backend nodes, but will not restart the networking.

    This means that the networking files, such as /etc/sysconfig/network, /etc/sysconfig/network-scripts/ifcfg-* files have information in them, that is inconsistent with the running configuration of the hosts.

  9. The previous step will have rewritten the /etc/hosts file. Copy over the /tmp/etc.hosts.unstable file back to /etc/hosts

  10. Reset the networking of all hosts.

    If you have console access to all backend hosts, instead of running the stack run host command, log into each hosts' console, and run

    # service network restart

    If you don't have console access to the hosts, or if you have a large number of hosts, you can try to run the following -

    # stack run host backend command="service network restart"

    This will change the IP address of backend hosts, and the command will lose connectivity, and will not return. After about a minute, hit Ctrl-C to kill the stack run host command.

  11. Reset the networking for the frontend.

    IMPORTANT
    Make sure that you have console access to the frontend. Do not run these commands over SSH. You will lose connectivity.

    # stack sync host network <frontend> restart=no
    # service network restart
  12. Your networks, for backends and the frontend, should be fully configured, and accessible over the new IP space.

  13. Test to see if you have connectivity between frontend and backend hosts

  14. Test to see if you have connectivity to the frontend from an external host.

Clone this wiki locally