BuycPanel Blog

Latest news and updates

How to Set Up Multiple Shared IPs on cPanel

Posted by Jamison on 02 12 2015.

There are many reasons why you would need multiple shared IPs on a single server. For one, when you set up multiple shared IPs, you can minimize the effects of a DoS (Denial of Service) attack by blocking off traffic to other IPs. This could work assuming the malicious attempt only affects one IP address and not all the other addresses pertaining to your site.

The thing is, the default setting for a regular cPanel account allows for only one shared IP. Besides, IP addresses are in short supply these days and each of them costs money. Indeed, requiring multiple IPs that you can use for each of your domains could well put you in a tight spot. Fortunately, there’s a workaround that allows you to set up multiple shared IPs via cPanel. The trick involves creating a reseller account.

More than just owning one primary cPanel account, a reseller can also sell or allocate multiple cPanel accounts to other users or domains. Simply put, by opting for a reseller account, a cPanel owner enjoys added privileges and access to WHM or web host manager interface where all the shared IPs under the primary account can be managed.

Assigning the shared IPs to their domains and subsequently managing them would require you to be logged into your account as a reseller. Once assigned to a reseller, an IP will be identified as used in the WHM/cPanel.

Here are the steps in setting up multiple shared IPs on cPanel.

Log in to your cPanel using Root or Administrator account.

In /var/cpanel/, create a directory named “mainips”.

Under “mainips” directory, create a file named “root”.

Type in the shared IPs that you plan to use. Enter one IP in each line.

Alternative Method

If you have WHM (web host manager) interface in your cPanel, you can also set up multiple shared IPs using the steps below.

Reserve the IP addresses you want to use.

You can do this by accessing WHM’s “Reserved IP” interface. Keep in mind that you can’t reserve an IP without first adding it on the server. Use the “Add a New IP Address” function in WHM.

You can also reserve IPs by dropping them in the /etc/reservedips file. Just make sure to type in a single IP per line. Like so:

IPAddress.1

IPAddress.2

IPAddress.3

… and so on.

Rebuild the IP pool.

You can do this by running /scripts/rebuildippool command or via the “IP Functions” interface. Just click “Proceed” for the scan to start. This step will place your reserved IP addresses into the IP address pool and ensure that the IPs will not be used as dedicated IPs for any single cPanel account.

To enable multiple accounts to use the shared IPs, you need to add the IPs in a pool. List each IP on the /var/cpanel/mainips/root file, making sure to type in one IP per line. Whenever a new account is created in root, the first address listed in the file is used. If you want your reseller to also use multiple shared IPs, just replace /root with /reseller’s username.