Configure Additional IPs On CentOS, RockyLinux and AlmaLinux
First2Host uses Failover IP blocks. Failover IP blocks allow us to point IP blocks at different servers and services. To use Failover IPs you have to configure the additional IPs in your Linux VPS Server or Dedicated Server. If you have Failover IPs and multiple servers you can change the routing of your whole IP block to point to a different server. This is useful if you are upgrading your dedicated server to a larger one or if you want to use the IP block on a different server.
If you have many in the form of a Range. It would be quicker to use a Range File to configure additional IPs in Linux. The commands in this guide are aimed at RHEL-based servers. So that’s CentOS, AlmaLinux, RockyLinux and Fedora.
Copy Network Interface
First, log in to Linux server and take a copy of the existing eth0 interface. We will use this as a template to create interfaces for each IP in the block.
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
Next, edit the copied file using your favourite text editor and delete all of the text in the file. Replace the text with the below code
cd/etc/sysconfig/network-scripts/ ; nano ifcfg-eth0:0
Configure Additional IPs In Linux
Replace FAILOVER IP with the first IP in your block so, if your subnet was 192.168.0.1/29 you would put 192.168.0.1 in the APADDR and BROADCAST fields. Save and close the file.
#NM_CONTROLLED="no"
DEVICE=eth0:0
BOOTPRONTO=static
ONBOOT=yes
IPADDR=FAILOVER IP
BROADCAST=FAILOVER IP
NETMASK=255.255.255.255
Next, we need to take down any existing interface and bring it back up. We do this with the ifdown and ifup commands.
Restart Interface
To bring down the interface enter;
ifdown eth0:0
Then to bring it back up enter;
ifup eth0:0
At this point, you should now be able to ping the IP address you just configured. If you cannot ping the IP please submit a ticket to our product support team. We will double-check the routing of the IP block for you.
Repeat the steps above to configure the rest of your IP block on your server. For the next IP, you can open up the existing interface, change the APADDR and BROADCAST fields to represent the next IP and save the file as eth0:1. The video below will show you how to do this.