How to Enable Floating IPs on Older Droplets

Network traffic between a Floating IP and a Droplet flows through an anchor IP, which is an IP address aliased to the Droplet’s public network interface (eth0). Droplets must have an anchor IP before you can assign a Floating IP to it.

Droplets created after October 20, 2015 automatically have an anchor IP, but if your Droplet was created before this date, you’ll need to add an anchor IP manually.

If you try to assign a Floating IP to Droplet without an anchor IP, instructions to add one will open up. You can alternatively follow these instructions based on the operating system of your Droplet.

Enable Anchor IPs Immediately

First, find your Droplet’s anchor IP. On Linux distributions (like Ubuntu, Debian, CentOS, Fedora, and CoreOS), use the following command to add the anchor IP address to your networking configuration, substituting in your anchor IP.

sudo ip addr add 198.51.100.0/16 dev eth0

On FreeBSD, add the anchor IP with this command:

sudo ifconfig vtnet0 198.51.100.0 netmask 255.255.0.0 alias

To make the setting persist after reboots, you’ll need to modify the network interface of your Droplet. How you do this depends on the Droplet’s operating system.

Persist Anchor IPs After Reboots

Ubuntu and Debian

Open /etc/network/interfaces and add the line highlighted below, substituting in your anchor IP.

auto eth0
iface eth0 inet static
        address 203.0.113.0
        netmask 255.255.252.0
        gateway 162.243.184.1
        up ip addr add 198.51.100.0/16 dev eth0
        dns-nameservers 8.8.8.8 8.8.4.4

Fedora, CentOS 6 and CentOS 7

Open /etc/sysconfig/network-scripts/ifcfg-eth0 and add the line highlighted below, substituting in your anchor IP.

DEVICE='eth0'
TYPE=Ethernet
BOOTPROTO=none
ONBOOT='yes'
HWADDR=04:01:76:bc:91:01
IPADDR=104.131.99.188
NETMASK=255.255.192.0
GATEWAY=104.131.64.1
NM_CONTROLLED='yes'
IPADDR2=198.51.100.0
PREFIX2=16
DNS1=8.8.8.8
DNS2=8.8.4.4

Again, remember to replace the highlighted IP address your anchor IP.

CentOS 5

In order for your anchor IP to persist after reboot, you must create a new file containing the networking information at /etc/sysconfig/network-scripts/ifcfg-eth0 on the Droplet. This can be done by copying the existing /etc/sysconfig/network-scripts/ifcfg-eth0 file.

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

Open /etc/sysconfig/network-scripts/ifcfg-eth0:0 and modify the lines highlighted below to update the value of the IPADDR and DEVICE fields to the value of your anchor IP.

DEVICE='eth0:0'
TYPE=Ethernet
BOOTPROTO=none
ONBOOT='yes'
HWADDR=04:01:76:d6:cb:01
IPADDR=198.51.100.0
NETMASK=255.255.224.0
GATEWAY=45.55.64.1
NM_CONTROLLED='yes'
PREFIX2=16
DNS1=8.8.8.8
DNS2=8.8.4.4

CoreOS

In order for your anchor IP to persist after reboot, you must create a new file containing the networking information at /etc/systemd/network/static.network on the Droplet. You can do this by copying the existing file named similar to /var/run/systemd/network/00-04:EX:AM:PL:E5:01.network and adding a second Address field with the value of your anchor IP. The name of the file will match your Droplet’s MAC address.

sudo cp /var/run/systemd/network/00-04:EX:AM:PL:E5:01.network /etc/systemd/network/static.network

Open /etc/systemd/network/static.network and add the following line to the unit, substituting in your anchor IP.

MACAddress=04:EX:AM:PL:E5:01

[Network]
DNS=8.8.8.8
DNS=8.8.4.4

[Address]
Address=203.0.113.0/20
Address=198.51.100.0

[Route]
Destination=0.0.0.0/0
Gateway=45.55.64.1

FreeBSD

In order for your anchor IP to persist after reboot, append the new networking information to the file /etc/rc.digitalocean.d/droplet.conf, substituting in your anchor IP.

echo 'ifconfig_vtnet0_alias0="inet 198.51.100.0 netmask 255.255.0.0"' | sudo tee -a /etc/rc.digitalocean.d/droplet.conf