Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Member
    Join Date
    Apr 2006
    Posts
    6

    Default change site's ip from command line.

    I can change site's ip from whm:
    Account Functions->Change Site's IP Address

    How can i do the same from command line?

    Thanks!

  2. #2
    Member
    Join Date
    Apr 2006
    Posts
    6

    Default

    Guys, please help! It is very impotance for me.

  3. #3
    Member brianoz's Avatar
    Join Date
    Mar 2004
    Location
    Melbourne, Australia
    Posts
    1,117
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Perhaps we've all grown fat and lazy in our old age and never tried it. Well actually for me thinner and lazy but you get the idea.

    I suspect it goes something like:

    - Changeover DNS zone files to new IP addresses (edit them and update the serial numbers). This could be done manually, or with a tool to do it. It's not that hard to write a tool to do it. [But djbdns would be a much better solution ] [ignore that comment!!] You could probably get away without increasing the serial numbers if you don't have an off-machine secondary server (which doesn't help much anyway) and you do a "service named restart" to reload the zones when you're done editing.

    - Edit /etc/httpd/conf/httpd.conf and modify the VirtualHosts container lines for each affected site. You should initially put *both* the new and the old IPs into the container lines, so that apache will listen on *both* new AND old IPs for the affected sites. Otherwise the sites will be unavailable until DNS propagation completes - probably not something you want! The reason for this is that the cpanel httpd.conf explicitly states which IPs each website will respond to in VirtualHosts lines, and you get a cpanel "no site configured" if you try to access the site on IPs other than those defined in httpd.conf. The VirtualHosts lines are the lines controlling which IPs will respond to which site, and they should go from what they are currently, ie with one IP, something like:
    Code:
    <VirtualHost 72.257.212.226>
    (ie just the old IP) to
    Code:
    <VirtualHost 72.257.212.226 72.257.212.227>
    (ie both the new and old IPs while you wait for DNS to settle), to:
    Code:
    <VirtualHost 72.257.212.227>
    (ie just the new IP after DNS propagation has settled). You want to wait at least 72 hours for propagation to complete - some large ISPs offer special cache machinery which ignores TTLs as a trade-off for speed, so they'll need a good 24 hours to clear out the old IP. Note that other services like mail and ftp (AFAIK) don't care about the IP on which the request arrives so shouldn't cause problems.

    BTW, if you want to change *all* the sites on the server, go for cpanel's wonderful IP migration Wizard. You may have to add NameVirtualHost entries to httpd.conf for each new IP after it completes, but that's about it (except, give it a full 48 hours, 72 is better, after the first pass before you "complete" the operation in WHM). This tool is only lacking the ability to do migrations of subsets of the system (eg by reseller) and the ability to automatically complete an operation ("at" is your friend).

    Don't try and change the server main IP since the cpanel licence is generated off it, and cpanel will probably stop working rather suddenly and you may end up unable to log in via ssh.

    I don't really know for sure whether this is all that's involved. There may be something in /var/cpanel so a good "grep -r 72.257.212.226 /var/cpanel /usr/cpanel" would probably help in discovering that. Perhaps someone more knowledgeable than myself would care to comment.

    Hey let us know how you go with this, if it you try it manually and it works out for you I could write some perl/PHP to automate it, possibly even a WHM addon if I get overexcited or have a sleepless night.... anybody done this and wanna comment on my above methods?
    Last edited by brianoz; 04-20-2006 at 10:37 AM.

  4. #4
    Member Kasper's Avatar
    Join Date
    Aug 2004
    Location
    Chicago
    Posts
    28

    Default

    Hello,

    Probably you want to try to use
    /scripts/updatedomainips

    --
    Eugene,
    =
    Lost time is never found again
    =
    http://howto4life.com/

  5. #5
    Member brianoz's Avatar
    Join Date
    Mar 2004
    Location
    Melbourne, Australia
    Posts
    1,117
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Hey Kasper, thanks for the guess, but as far as I can see all updatedomainips does (despite the promising name!) is rebuild /etc/domainips, and call /scripts/buildpureftproot. For a moment there I thought someone had already done the hard work.

    I had to spend 30 minutes reading bad perl code to understand this, I wish Cpanel could learn to comment their stuff - as in "this script does this" (this is not to dis cpanel, they have produced a result beyond what I could have done, just dising their coding!).

Similar Threads & Tags
Similar threads

  1. How to change Main Shared Virtual IP from command line
    By vpsville in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 07-04-2008, 04:04 PM
  2. Where to change the command line?
    By SNN in forum cPGS Discussions
    Replies: 3
    Last Post: 01-11-2008, 02:17 PM
  3. Change Site's IP Address using command line
    By inteltechs in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 04-27-2007, 01:47 AM
  4. Command Line Password change
    By goibay in forum New User Questions
    Replies: 1
    Last Post: 11-27-2006, 07:27 PM
  5. Problems with Change Site's IP Address command and Addon Domains
    By elenlace in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 11-23-2004, 05:30 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube