Changing a Site’s IP Address

4.5/5 - (15 votes)

There are three ways to change a site’s IP address on a cPanel server:

Via WHM:

Go to WHM > Change site’s IP Address , select the account, then select the IP

Via Command Line:

/usr/local/cpanel/bin/setsiteip -u $user $ip

Manually:

(This is also useful for changing the IP address of a single domain in an account, without affecting other domains on that account)

1) Edit /var/named/domain.com.db, change the domain’s A records, increment the serial number, and sync the zone out. For help in changing DNS, see this post.  To sync a zone:

/scripts/dnscluster synczone $domain

Obviously, you do this on whatever server acts as a nameserver for the domain in question.

2) Replace instances of the old IP with the new IP in /var/cpanel/userdata and /var/cpanel/users

replace 123.123.123.123 222.222.222.222 — /var/cpanel/userdata/user/*

replace 123.123.123.123 222.222.222.222 — /var/cpanel/users/user

3) If the new IP is shared, remove the user’s main domain entry from /etc/domainips. If it’s a dedicated IP, add/change the IP in /etc/domainips and /etc/ssldomains (if the site has an SSL)

4) Run /scripts/rebuildhttpconf and /scripts/rebuildippool, and restart Apache

9 Comments

  1. Pingback: Installing A Wildcard SSL Certificate :: The cPanel Admin

  2. Pingback: Changing the Shared IP Address of a Live Server | Cheap Webhosting Domain Register

  3. Pingback: Changing the Shared IP Address of a Live Server | BEC Community Blog

  4. cpuser Reply

    hah! I feel dumb. I didn’t know this:
    /usr/local/cpanel/bin/swapip

    When doing it from the command line.. I always did it the manual way. The more you know lol.

  5. Pingback: SERVERTECHS » Blog Archive » Installing A Wildcard SSL Certificate

  6. Pingback: Installing A Wildcard SSL Certificate

  7. Pingback: cPanel :: Change Website's IP | :: b l a c k o n s o l e ::

Leave a Reply

Your email address will not be published. Required fields are marked *

Log in