How to add an IP to a WHM/cPanel server via SSH

Follow

Sometimes it's quicker to administer a server via SSH, rather than logging into the WHM control panel and using the Graphical User Interface.

The whmapi1 command line tool is very useful for performing certain WHM administration tasks via SSH. 

The following whmapi1 commands should work on any WHM/cPanel server, no matter what distribution it's running.

For example, if you want to add the IP address 221.121.221.121 with netmask 255.255.255.0 to your server:

1. SSH to your server.

# ssh root@your.server.ip.address -p 22

2. Enter the whmapi1 command:

# whmapi1 addips ips=221.121.221.121 netmask=255.255.255.0

3. Make sure the new IP is reachable by pinging it:

# ping 221.121.221.121

If you made a mistake for any reason, you can remove the IP with the following command:

# whmapi1 delip ip=221.121.221.121

Once the new IP is added and verified as working, you can begin assigning cPanel accounts to the IP as needed:

# whmapi1 setsiteip ip=221.121.221.121 user=cpanelusername

You can check which IP an account is currently using:

# whmapi1 get_shared_ip user=cpanelusername

Or list all IP's configured on the server:

# whmapi1 listips

If you have any issues with the above process, please feel free to submit a support ticket for further assistance.

 

Have more questions? Submit a request

Comments

Powered by Zendesk