• Welcome to Web Hosting Community Forum for Webmasters - Web hosting Forum.
 

Recommended Providers

Fully Managed WordPress Hosting
lc_banner_leadgen_3
Fully Managed WordPress Hosting

WordPress Theme

Divi WordPress Theme
WPZOOM

Forum Membership

Forum Membership

Best way to update cPanel main IP

Started by Rick, February 26, 2014, 02:27:01 PM

Rick

We have had this particular server running for quite some time without any issues until today. We were just informed that we were the target of a DDOS attack and as a result, the datacenter has null routed the IP address in question. This IP address was not only our main IP address, but also the main shared IP for the shared hosting accounts.

If we were to pick another IP address in our pool to act as both the main IP and the new shared IP (Or split them up even), what would be the best way to change this in cPanel? I know we can set the new shared IP in the basic setup area in WHM, but I'm not sure how to tell cPanel to use a different IP as its "main" IP.

Rick

Kailash

The best way to deal with such issue is,

Create few resellers accounts from WHM -> Assign different IP addresses to each reseller account -> spread your domains to different resellers.

Rick

Hello Kailash,

Thank you for the details. This will certainly help you reduce the impact of DDoS attacks.

Thanks!

- Rick

DouglasSmith

#3
The best to change the cpanel main IP is firstly you have to login and then go to basic cpanel. Change the primary IP address here with the option The IP address that will be used for setting up the main IP.


hmb-willem

Hello,

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:

192.168.1.1

192.168.1.2

192.168.1.3

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

192.168.1.1 =shared ip

192.168.1.2=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

imort

Quote from: Rick on February 26, 2014, 02:27:01 PM
If we were to pick another IP address in our pool to act as both the main IP and the new shared IP (Or split them up even), what would be the best way to change this in cPanel? I know we can set the new shared IP in the basic setup area in WHM, but I'm not sure how to tell cPanel to use a different IP as its "main" IP.
Rick

You can take a look at official documentation here: https://documentation.cpanel.net/display/ALD/IP+Migration+Wizard

AmarInfotech

Splitting of websites on different IPs is definitely a workaround if you have 10-20 websites but not a solution. If you have hundreds of websites, moving them to different IPs and changing their A record will be time consuming but most importantly will result in downtime too. You have to find the target domain and get it off your server as soon as possible because if the attack is re-initiated on the target domain, the data center will null-route the new IP as well.

sankalppatil

We have had this particular server running for quite some time without any issues until today. We were just informed that we were the target of a DDOS attack and as a result, the data centre has null routed the IP address in question. This IP address was not only our main IP address but also the main shared IP for the shared hosting accounts.

ownwebservers1

To change the main IP of cpanel, you must first login and then go to basic cpanel. Using the option, change the primary IP address. This is the IP address that will be used to set up the main IP address.