How to add an IP to a WHM/cPanel server via SSH
  • 28 Dec 2022
  • 1 Minute to read
  • Dark
    Light

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

  • Dark
    Light
  • New

Article Summary

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 whmapi1command:
    # 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
  4. If you made a mistake for any reason, you can remove the IP with the following command:
    # whmapi1 delip ip=221.121.221.121
  5. 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
  6. You can check which IP an account is currently using:
    # whmapi1 get_shared_ip user=cpanelusername
  7. 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.



Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Eddy, a super-smart generative AI, opening up ways to have tailored queries and responses