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 work on any WHM/cPanel server, no matter what distribution it's running.
To demonstrate, adding an IP address 221.121.xxx.xxx with a subnet mask of 255.255.255.0 to your server utilising whmapi1 would be as follows:
Connect to your server via SSH to begin using the details you have been provided:
ssh -p 22 root@your.server.ip.addressEnter the following ‘whmapi1‘ command to add an IP address and subnet.
whmapi1 addips ips=221.121.xxx.xxx netmask=255.255.255.0Make sure the new IP address is reachable by pinging it outside of your active SSH session.
ping 221.121.xxx.xxxOnce the new IP address is added and verified as working, you can assign the IP to a cPanel account. You can also assign the IP to multiple accounts.
whmapi1 setsiteip ip=221.121.xxx.xxx user=cpanel_usernameIf needed, you can check which IP address an account is currently in use:
whmapi1 accountsummary user=cpanelusernameTo list all IP addresses configured on the server for each user
whmapi1 listaccts | grep -E 'user|ip:'You can also remove the IP address with the following command:
whmapi1 delip ip=221.121.xxx.xxxTo confirm that the IP has been removed
whmapi1 listipsIf you have any issues with the above process, please feel free to submit a support ticket for further assistance.