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.
An anchor IP is only accessible to the Droplet it belongs to and the reserved IP assigned to the Droplet. You should bind any public services that you want to make highly available through a reserved IP to the anchor IP to prevent users from using the public IP addresses of your Droplets to bypass your reserved IP.
For example, if you are using a reserved IP in an active/passive load balancer setup, you should bind your load balancer services to their respective Droplet anchor IPs so they can only be accessed via the reserved IP address.
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.
To retrieve your Droplet’s anchor IP, you can use standard networking utilities, like
ip addr show eth0. For simplicity, we recommend using the Droplet Metadata service by running
curl on the Droplet.
To get a Droplet’s anchor IP,
curl the anchor interface IPv4 address endpoint from the Droplet:
curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/anchor_ipv4/address
You can similarly use the anchor IP netmask endpoint and anchor IP gateway endpoint.
Using metadata, you can also check if a Droplet has a reserved IP with the active reserved IP endpoint and get the address of its reserved IP address with the reserved IP address endpoint.
Learn more in the metadata API documentation.