What are floating IPs and how do they work?

Each Cloud server on QuantumHost automatically comes with one IPv4 and one IPv6 net (/64). You can also add floating IPs for a small fee.

Floating IPs help you to create highly flexible setups. You can assign a floating IP to any server. The server can then use this IP. You can reassign it to a different server at any time, or you can choose to unassign the floating IP from servers altogether.

You can use floating IPs globally. This means you can assign a floating IP to a server in one location and later reassign it to a server in a different location. For optimal routing and latency, you should use floating IPs in the location where you create them.

For floating IPs to work, you must configure them inside the operating system of the server you use.

To temporarily configure a floating IPv4 “1.2.3.4”, you can run

ip addr add 1.2.3.4/32 dev eth0

Please note that this configuration will not survive a reboot.

To configure the first IPv6 address of floating IPv6 netblock 2a01:4f8:2c17:2c::/64, you should run:

ip addr add 2a01:4f8:2c17:2c::1/128 dev eth0

 

How do I permanently configure a floating IP?

Floating IP Persistent

If you are using more than one floating IP, then the number on the interface (eth0:1) will be increased (example eth0:2).

On Debian based distributions (Ubuntu versions before 20.04, Debian):

  1. Access the server via SSH.
  2. Create the configuration file and open an editor:
    touch /etc/network/interfaces.d/60-my-floating-ip.cfg
    nano /etc/network/interfaces.d/60-my-floating-ip.cfg
  3. Paste the following configuration into the editor and replace your.Float.ing.IP with your floating IP:
    IPv4:

    auto eth0:1
    iface eth0:1 inet static
    address your.Float.ing.IP
    netmask 32

IPv6:

auto eth0:1
iface eth0:1 inet6 static
address one IPv6 address of the subnet, e.g. 2a01:4f9:0:2a1::2
netmask 64

4. Now you should restart your network. Caution: This will reset your network connection:

sudo service networking restart

Ubuntu 20.04:

  1. Access the server via SSH.
  2. Create the configuration file and open an editor:
    touch /etc/netplan/60-floating-ip.yaml
    nano /etc/netplan/60-floating-ip.yaml
  3. Paste the following configuration into the editor and replace your.Float.ing.IP with your floating IP:

IPv4:

network:
version: 2
ethernets:
 eth0:
  addresses:
  - your.float.ing.ip/32

IPv6:

network:
version: 2
ethernets:
 eth0:
  addresses:
  - your.float.ing.ip/64

4. Now you should restart your network. Caution: This will reset your network connection:

sudo netplan apply

On RHEL based distributions (Fedora, CentOS):

  1. Access the server via SSH.
  2. Create the configuration file and open an editor:
    touch /etc/sysconfig/network-scripts/ifcfg-eth0:1
    vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
  3. Paste the following configuration into the editor and replace your.Float.ing.IP with your floating IP:
    IPv4:

    BOOTPROTO=static
    DEVICE=eth0:1
    IPADDR=your.Float.ing.IP
    PREFIX=32
    TYPE=Ethernet
    USERCTL=no
    ONBOOT=yes

    IPv6:

    BOOTPROTO=none
    DEVICE=eth0:1
    ONBOOT=yes
    IPV6ADDR=one IPv6 address of the subnet, e.g. 2a01:4f9:0:2a1::2/64
    IPV6INIT=yes
  4. Now you should restart your network. Caution: This will reset your network connection:
    systemctl restart network