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.
First you’ll want to reserve the IP address via WHM -> Reserved IPs. Alternatively, simply drop them into /etc/reservedips, separated by line, ie:
If you want to label the reserved IPs, set them up in /etc/reservedips:
192.168.1.1 =shared ip
… and so on
Now rebuild the IP pool:
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.
Click here to download the script
wget -O /usr/bin/rotate_main_ips http://www.thecpaneladmin.com/files/rotate_main_ips.py
chmod 755 rotate_main_ips
echo ‘*/30 * * * * /usr/bin/rotate_main_ips’ > /etc/cron.d/rotate_main_ips
service crond reload