How to Set up Multiple Shared IPs on a cPanel Server

There are some situations where you may need to set up multiple shared IP addresses on a server. Some reasons may include grouping accounts per IP or lowering the effect of DDoS attacks if it becomes necessary to block traffic to a specific interface. Whatever the reason, multiple shared IP addresses on a cPanel server is rather easy to set up.

If you want to label the reserved IPs, set them up in /etc/reservedips:

1.2.3.4=shared ip

4.5.6.7=shared ip

… and so on

Now rebuild the IP pool:

/scripts/rebuildippool

This will prevent the IPs from being used as dedicated IPs for individual cPanel accounts, but for multiple accounts to be able to use them as shared IPs you’ll need to add them to a pool. Simply use the /var/cpanel/mainips/root file to list each IP on its own line. When root creates an account on the server, the first IP address in that file will be used. If you want a reseller to have multiple shared IPs as well, simply replace ‘root’ with the reseller’s username.

To take this configuration further, you may want to have the main IP rotate automatically so each IP in the pool gets equal use. We’ve written a script to automate this task rather seamlessly via cron.