The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Mass Change Of IP's

Discussion in 'General Discussion' started by n2972s, Dec 8, 2002.

  1. n2972s

    n2972s Registered

    Joined:
    Mar 23, 2002
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    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
     
  2. cyrus

    cyrus Member

    Joined:
    Mar 1, 2005
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    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
    
     
    #2 cyrus, Sep 11, 2005
    Last edited: Sep 15, 2005
  3. gorilla

    gorilla Well-Known Member

    Joined:
    Feb 3, 2004
    Messages:
    699
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Sydney / Australia
    or just simply log into WHM > Multi-Account Functions >Change Multiple Sites' IP
    which might be easier :)
     
  4. cyrus

    cyrus Member

    Joined:
    Mar 1, 2005
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    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 :)
     
  5. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    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
     
  6. gorilla

    gorilla Well-Known Member

    Joined:
    Feb 3, 2004
    Messages:
    699
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Sydney / Australia
    Have changed up to 20 sites IP at one time with the WHM feature
    Havent had to do more so I wouldnt really know how it would do , but just a week ago the change of the 20 sites IP was fine
     
  7. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    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.
     
  8. ntwaddel

    ntwaddel Well-Known Member

    Joined:
    Nov 3, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Templeton, CA
    so does the whm multiple update program increment the serial #?
     
  9. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    I would hope so, I've not had any issues with it of late.
     
  10. ntwaddel

    ntwaddel Well-Known Member

    Joined:
    Nov 3, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Templeton, CA
    so how does that work exactly, do i need to setup all the new ips, then use that tool and remove the old ips?
     
  11. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Yes, that's it :)
     
  12. ntwaddel

    ntwaddel Well-Known Member

    Joined:
    Nov 3, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    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
     
  13. ntwaddel

    ntwaddel Well-Known Member

    Joined:
    Nov 3, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    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.
     
  14. ntwaddel

    ntwaddel Well-Known Member

    Joined:
    Nov 3, 2003
    Messages:
    173
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Templeton, CA
    the wizard actually worked pretty good, a couple snags, but no show stoppers
     
Loading...

Share This Page