Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Change Site IP Address Using PHP or SSH

Discussion in 'cPanel Developers' started by raonaveed, Aug 5, 2010.

  1. raonaveed

    raonaveed Member

    Nov 30, 2009
    Likes Received:
    Trophy Points:

    I would like to know the followings

    1. How to change any website IP address using SSH command may i know that command?

    2. How can i do that using XML-API or anyother PHP code. Please guide to change site IP address using php code in this case i would like to know 2 things specialy.
    i. How to load in drop down or show delegates IP of any specific Reseller.
    ii. How to assign any specific IP to any domain (same way root has Change Site IP address)

    The aim of the script is to provide resellers to assign dedicated IPs to their clients. Thanks for reading post looking forward for positive response.

    Best Regards
  2. cPanelDavidN

    cPanelDavidN Integration Developer

    Dec 17, 2009
    Likes Received:
    Trophy Points:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi Raonaveed,

    IP assignment to domains and IP delegation to resellers are both complex tasks. And for that reason, it's probably best that your resellers use the WHM features as they are.

    Details for xml-api:

    1) listips. The reseller will need 'all root' reseller privileges to list the IP pool.

    2) setsiteip. The reseller will need all root privileges to assign an IP to a domain.

    3) There isn't a function to list delegated IPs for a particular reseller.

    4) There isn't a function to manage delegated IPs for a particular reseller.

    5) There isn't a function to list just domain and ip assignment. There is accountsummary, which will list all information for a particular account.

    Details for command line:

    1) you can find a list of IPs delegated to a particular reseller at:

    2) there isn't a command line script to manage IP delegation. It is not advisable to modify /var/cpanel/dips/$reseller_name

    3) there isn't a command line script to manage a domains ip. Changing the domain IP does stuff with Apache and your DNS solution (ie, Bind). It's not as simple as changing a text file.

    That being said, I'm would think that the best solution would be to implement a WHM Plugin. It should be feasible to create one that could perform the functionality that you desire. The Plugin would need to:

    1) Enforce a (custom) ACL for your resellers.

    2) Utilize the xml-api calls that are available (listips, setsiteip, accountsummary)

    3) Read /var/cpanel/dips/$reseller_name, and /etc/domainips to display IP delegation/assignment

    Best Regards,
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice