How to Set up Multiple Shared IPs on a cPanel Server

How to Set up Multiple Shared IPs on a cPanel Server
5 (100%) 11 votes

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

 

Don't be selfish, share!Tweet about this on TwitterShare on RedditShare on TumblrBuffer this pageDigg thisShare on FacebookFlattr the authorEmail this to someoneShare on Google+Pin on PinterestPrint this pageShare on LinkedInShare on StumbleUpon

4 Comments

  1. Pingback: How to Assign an IP To Multiple cPanel Accounts :: The cPanel Admin

  2. Pingback: How to Assign an IP To Multiple cPanel Accounts | Justox.com

  3. Pingback: How to Assign an IP To Multiple cPanel Accounts -

Leave a Reply

Your email address will not be published. Required fields are marked *

Log in