WHM/Cpanel Add Additional IP

Hi,

Im having a battle my end in trying to get what I thought would be a simple task being completed.

Essentially my whm/cpanel server has had one main IP for some time. I have added an additional IP after contacting Linode they allocated one.

I hopped over to my whm server and added by the WHM interface.

The server rebooted this week and it then appears that Linodes Autoconfigure network feature swapped my base ip and the additional IP around creating a license warning.

I have then explored the /etc/sysconfig/network-scripts/ifcfg-eth0 file and found IPADDR0 and IPADDR1 are the wrong way around. I changed this and rebooted. The server then failed to boot.

At this point I then removed the IP from linode manager. Rebooted and server came back online.

I then tried, turning off auto configure networking as described at

https://www.linode.com/docs/networking/linux-static-ip-configuration/

I then added the additional IP in /etc/sysconfig/network-scripts/ifcfg-eth0 and rebooted.Again this broke connectivity.

I then had to LISH to server and removed the IP.

I then contracted in the services of a company who have qualified linux admins also cpanel certified.

They tried a fews things and still im in the same place. They suggested I reach out to linode and linode reminded me the server is unmanned and to contact the community.

Does anyone have any thoughts?

Thanks
Anthony

2 Replies

Hi Anthony,

The cPanel "Main IP" is based around the gateway. You will need to keep Network Helper disabled once the change is made. Here is a sample config that was created by Network Helper:

# /etc/sysconfig/network-scripts/ifcfg-eth0

# For full descriptions of what these switches do,
# and what the interface's defaults are, see
# /usr/share/doc/initscripts-*/sysconfig.txt
DEVICE="eth0"
NAME="eth0"
ONBOOT="yes"

# "bootp" and "dhcp" are for dhcp, anything else
# is for a static configuration. "none" is given
# by sysconfig.txt so we're using it.
BOOTPROTO="none"

# Use hardware-based IPv6 addresses, no privacy extensions.
IPV6INIT="yes"
IPV6_ADDR_GEN_MODE="eui64"
IPV6_PRIVACY="no"

# Since we want a static configuration, we're specifying DNS
# addresses in this file for NetworkManager. "No" here tells
# NM to use them when BOOTPROTO!=dhcp.
PEERDNS="no"

DOMAIN=members.linode.com
GATEWAY0=104.237.156.1

# resolvconf doesn't recognize more than 3 nameservers.
DNS1=173.255.243.5
DNS2=173.255.244.5
DNS3=173.230.145.5


IPADDR0=104.237.156.107

# Sysconfig.txt says that PREFIX takes precedence over
# NETMASK when both are present. Since both aren't needed,
# we'll go with PREFIX since it seems to be preferred.
PREFIX0=24

IPADDR1=74.207.253.249
PREFIX1="24"

If we want the primary IP to be 74.207.253.249 instead of 104.237.156.107, we can change GATEWAY0, IPADDR0, IPADDR1*:

# /etc/sysconfig/network-scripts/ifcfg-eth0

# For full descriptions of what these switches do,
# and what the interface's defaults are, see
# /usr/share/doc/initscripts-*/sysconfig.txt
DEVICE="eth0"
NAME="eth0"
ONBOOT="yes"

# "bootp" and "dhcp" are for dhcp, anything else
# is for a static configuration. "none" is given
# by sysconfig.txt so we're using it.
BOOTPROTO="none"

# Use hardware-based IPv6 addresses, no privacy extensions.
IPV6INIT="yes"
IPV6_ADDR_GEN_MODE="eui64"
IPV6_PRIVACY="no"

# Since we want a static configuration, we're specifying DNS
# addresses in this file for NetworkManager. "No" here tells
# NM to use them when BOOTPROTO!=dhcp.
PEERDNS="no"

DOMAIN=members.linode.com
GATEWAY0=74.207.253.1

# resolvconf doesn't recognize more than 3 nameservers.
DNS1=173.255.243.5
DNS2=173.255.244.5
DNS3=173.230.145.5


IPADDR0=74.207.253.249

# Sysconfig.txt says that PREFIX takes precedence over
# NETMASK when both are present. Since both aren't needed,
# we'll go with PREFIX since it seems to be preferred.
PREFIX0=24

IPADDR1=104.237.156.107
PREFIX1="24"

You can verify with the following commands:

curl -4 ifconfig.co
74.207.253.249

ip r
default via 74.207.253.1 dev eth0 proto static metric 100
74.207.253.0/24 dev eth0 proto kernel scope link src 74.207.253.249 metric 100
104.237.156.0/24 dev eth0 proto kernel scope link src 104.237.156.107 metric 100

*Really all that needs to be swapped is the Gateway value. However, I'm unsure if cPanel checks 'IPADDR0' anywhere so I recommend switching that too, as I did above. You can quickly swap out the gateway with this command, but it will not persist through a reboot:

ip route replace default via <your_new_gateway> dev eth0

Fantastic!

Worked.

Finally got there!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct