How to configure floating IP on CentOS

When you attach a new floating IP, you can find it listed to one of the servers at your Hatton control panel that the floating IP currently points to. However, using the new floating IP will require some manual setup. Follow the steps below on how to get this done on Ubuntu servers.

As an example, we have a cloud server with the public IP address, a floating IP, with a netmask These are highlighted below in red.

Before making changes to your network configuration, it’s always a good idea to take a backup, if you have taken out the backup add-on. Also, note that if your network configuration becomes inoperable, remember that you can always log in to your cloud server using the VNC console connection.


Configuring floating IP


Firstly, you’ll need to configure the servers at the OS level, so start up your cloud server at your Hatton control panel log in.

Check your current network settings with the following command.

ip addr

Commonly the second network interface card (NIC) named eth0, highlighted in red, has your public IPv4 address assigned to it.

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
   link/ether 6e:d7:1b:bf:3a:5f brd ff:ff:ff:ff:ff:ff
   inet brd scope global eth0
      valid_lft 53810sec preferred_lft 53810sec

On CentOS hosts, each NIC is controlled by its own configuration file. You will need to create a new network interface configuration file for the floating IP. The easiest way to do this is to duplicate the configuration file of the NIC with your regular IP, this way you don’t need to write the whole file from scratch.

For example, with eth0 you can use the following command.


sudo cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:1

Then edit the new alias interface.

sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0:1

Add the same “:1” to the device name, enter a new parameter NM_CONTROLLED=no, replace the IP address with the floating IP and then remove the gateway line.



Save the file and exit after these changes.

Finally, restart your network manager to enable the changes.

sudo systemctl restart network

If you were connected with SSH, the networking restart should not cause you to disconnect. In case you do lose connection and are unable to reconnect, you can always use the web Console at Hatton control panel under your Server settings to go through the setup again to make sure everything is entered correctly.

Repeat the process to add the alias on any other servers you wish to use the floating IP on.


Testing the configuration


Your configuration is now complete. You can test that it works by pinging floating IP on your server, the ping should return successful if the floating ip is configured correctly.



  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

What is a VPS

What Is a Virtual Private Server? First, let’s define what VPS actually stands for —  virtual...

What is the difference between a VPS and a web hosting plan?

Using a VPS is the next logical step up from using a web hosting plan. Virtual private servers...

What are the advantages of a VPS, compared to a dedicated server?

The advantage of a VPS is that you don’t have to worry about hardware management — so you would...