How to Manually Enable Reserved IPs

A DigitalOcean Reserved IP address is a publicly-accessible static IP address that you can assign to a Droplet and then reassign to another Droplet later, as needed. You can implement a failover mechanism with reserved IPs to build a high availability infrastructure.


Droplets created from a custom image do not receive an anchor IP address and do not require one to use a reserved IP. When you assign a reserved IP address to a Droplet created from a custom image, the reserved IP is automatically mapped to the Droplet’s public IPv4 address instead of an anchor IP.

Droplets created before 20 October 2015 or that were created using a custom image do not have anchor IP addresses automatically assigned to them. To use reserved IPs with Droplets created before this date or Droplets created using a custom image, you need to manually add an anchor IP address to the Droplet’s public network interface (usually eth0).

If you try to add a reserved IP to a Droplet without an anchor IP, you’ll receive a warning in the control panel with instructions on how to add the anchor IP.

Droplets created from a custom image do not receive an anchor IP address and do not require one to use a reserved IP. When you assign a reserved IP address to a Droplet created from a custom image, the reserved IP is automatically mapped to the Droplet’s public IPv4 address instead of an anchor IP.

Enable Anchor IPs Immediately

First, find your Droplet’s anchor IP. You’ll use it in all of the following commands.

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

sudo ip addr add use_your_anchor_ip/16 dev eth0

On FreeBSD, add the anchor IP with this command:

sudo ifconfig vtnet0 use_your_anchor_ip netmask 255.255.0.0 alias

To make the setting persist after reboots, you 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 14.x and Debian 7,8

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 use_your_anchor_ip/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=use_your_anchor_ip
PREFIX2=16
DNS1=8.8.8.8
DNS2=8.8.4.4

        
    

Again, remember to replace the highlighted IP address with 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 the /etc/sysconfig/network-scripts/ifcfg-eth0:0 file 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=use_your_anchor_ip
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

        
    

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 use_your_anchor_ip netmask 255.255.0.0"' | sudo tee -a /etc/rc.digitalocean.d/droplet.conf