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.

Change all sites ips on a server

Discussion in 'General Discussion' started by aegenterprises, Jun 24, 2003.

  1. aegenterprises

    Joined:
    Mar 9, 2003
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I'm looking for a simple script (using awk?) that will change the ip address of all sites on my servers in httpd.conf. Basically all of my ips have changed and I need to update the ip address of approx 1200 sites on about 5 different servers. It will take MUCH too long to do them by hand. Any suggestions would be appreciated. I know cpanel has the "change sites ip" feature, but it has to be done site by site.

    Thanks

    cPanel.net Support Ticket Number:

    cPanel.net Support Ticket Number:
     
  2. aegenterprises

    Joined:
    Mar 9, 2003
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Any way to globally change each sites ip using the "changesiteip" script in /scripts ??

    All accounts are on shared ips...

    cPanel.net Support Ticket Number:
     
  3. Drake

    Drake Well-Known Member

    Joined:
    Nov 9, 2001
    Messages:
    83
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    New Jersey
    cPanel Access Level:
    DataCenter Provider
    Are you wanting to change the IP number(s) to other IP numbers currently on the same box? Or are you wanting to change the IP numbers to completely different IP's as if you were going to move the server to a different colocation facility? The prior is easier, the later is harder because you have to do them all at one time, instead of gradually at your leisure.

    Also, please consider any customers who do their own web development who might have utilized IP numbers in their page source code or scripts. But then again you said they're all on shared IP's so nobody should be using hard coded IP numbers.

    OK, I have been no help, but just adding food for thought.

    Drake P.

    www.DuraServer.net
    Web Hosting ~
    Shared & Dedicated Servers ~
    Networking ~ Linux
     
    #3 Drake, Jun 25, 2003
    Last edited: Jun 25, 2003
  4. ciphervendor

    ciphervendor Well-Known Member

    Joined:
    Aug 26, 2002
    Messages:
    1,052
    Likes Received:
    0
    Trophy Points:
    36
    I would assume that you're going to leave the last few octets the same. If this is the case, you only have to modify a few files by hand. Say that your existing box is under 10.1.1.0/24 and you need to change everything to 10.2.1.0/24, simply open each config file up in vi and issue the following:

    :%s,10.1.1,10.2.1,g
    :wq

    Be sure to make a backup of each config before you do this. You should only have to modify httpd.conf, proftpd.conf, domainips.

    To do your cpanel users file and your zone files, you will need to use the following:

    cd /var/cpanel/users/
    replace 10.1.1 10.2.1 -- *

    cd /var/named/
    replace 10.1.1 10.2.1 -- *

    Once you've completed all of the above, you will need to edit your ipaliases file as well as your ifconfig stuff.

    edit your ips file with vi and use the :%s command from above. For your main IP you can either use the setup command or edit the files manually in the network conf files.

    Once you're all done the changes, a reboot will bring everything back up on the new IPs.

    Just a warning, if you're not sure what I've instructed you to do above. I would suggest you read up on the commands before issuing them.

    cPanel.net Support Ticket Number:
     
    #4 ciphervendor, Jun 25, 2003
    Last edited: Jun 25, 2003
Loading...

Share This Page