How to Set up Multiple Shared IPs on a cPanel Server
- Written by Vanessa Vasile
- Published in Hacks, Howto, Scripts
- 7 Comments
- Permalink
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:
1.2.3.4
4.5.6.7
7.8.9.10
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.
Click here to download the script
Installation steps:
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
7 Comments
Pingback: How to Assign an IP To Multiple cPanel Accounts :: The cPanel Admin
Pingback: How to Assign an IP To Multiple cPanel Accounts | Justox.com
Pingback: How to Assign an IP To Multiple cPanel Accounts -
your tutorial is useful for me to avoid from DDos attack.
Thanks for goto space tab bar over return
Hi,
Is it possible that exim sends from these main shared IPs ? That will be useful for resellers. I know that is possible for a dedicated IPs, but how to manage a global reverse DNS for a reseller ?
Thank you for your advise.
not really good resolution, because if you’re hosting your own dns server and IP is reserved, it will be also used for rotation, highly not recommended