How To Create a Floating IP on DigitalOcean
This tutorial will show you how to create a new Floating IP and assign it to one of your DigitalOcean Droplets using the DigitalOcean Control Panel. It will also cover how to reassign the Floating IP, so it points to another Droplet.
A DigitalOcean Floating IP is a publicly-accessible static IP address that can be assigned to one of your Droplets, where it will route its traffic to. A Floating IP can also be instantly remapped, via the DigitalOcean Control Panel or API, to one of your other Droplets in the same datacenter.
Before continuing, you need to have a Droplet to connect a Floating IP to. If you don't already have one, learn how to set one up by following this link: How To Create Your First DigitalOcean Droplet Virtual Server.
In our example, we'll point the Floating IP to a Droplet named primary.
Assigning Your First Floating IP
First, go to the DigitalOcean Control Panel.
Click on the Networking link (top navigation menu), then Floating IPs in the side menu. The first time you visit the page, you will see a page that says you have no Floating IPs but you can create one:
Here, you can create a Floating IP by selecting one of your Droplets and clicking the Assign Floating IP button. If you want to acquire a Floating IP without assigning it to a Droplet immediately, you can simply select a particular datacenter from the list.
Note: Floating IPs are free to use as long as they are attached to a Droplet. Due to limited IPv4 availability, we charge $0.006 per hour for floating IPs that have been reserved but not assigned to a Droplet.
Viewing Your Floating IPs
In the Floating IPs page, a few moments after assigning a Floating IP, you see a new Floating IP that points to the Droplet that you selected:
If you have at least one Floating IP, this page will display a list of your Floating IPs, which includes the following details about each entry:
- Address: The Floating IP address, which is how it can be accessed in a web browser
- Datacenter: The datacenter in which the Floating IP was created. A Floating IP can only be assigned to Droplets within the same datacenter
- Droplet: The Droplet that the Floating IP is assigned to. Requests sent to the Floating IP address will be directed to this Droplet. This can also be set to "Unassigned", which means the Floating IP is reserved but will not pass network traffic to any Droplet
Editing Your Floating IPs
In addition to the Floating IP information, the Floating IPs page also allows you to perform the following actions:
- Reassign (Blue Pen Button): Assign the Floating IP to a different Droplet, within the same datacenter. You may also unassign the Floating IP
- Delete (Red X Button): Release the Floating IP from your account
If you want to quickly assign your Floating IP to a different Droplet, simply click the Reassign button then select your desired Droplet. After a few moments, the Floating IP information will be updated and its traffic will be routed accordingly.
Now that your Floating IP is assigned to one of your Droplet, you should be able to access the Droplet's network services via the Floating IP address. You may also want to update your DNS records to use the Floating IP address instead of the Droplet's public IP address.
To learn more about using Floating IPs, and creating high availability server setups, check out the How To Use Floating IPs on DigitalOcean tutorial.