How to Configure DNS Settings for DigitalOcean Droplets and Floating IPs
Configuring DNS settings for your DigitalOcean Droplets and Floating IPs is essential for directing visitors reliably to your infrastructure. Without proper Domain Name System records, your users cannot reach your applications by their domain names, and services like SSL certificates or email authentication will fail to function.
Whether you are pointing a standard web server droplet or managing highly available services behind an elastic IP, setting up your DNS correctly ensures seamless traffic routing and minimal downtime.
Before making any changes to your production environment, it is always a smart practice to verify your current records using the DNS Lookup tool on XiaTools to see how resolvers currently view your domain globally.
Understanding DigitalOcean DNS Infrastructure
DigitalOcean provides an integrated, anycast DNS management service that allows you to manage your domain records directly from your control panel without needing to host your own nameservers.
When you add a domain to your DigitalOcean account, you are given a set of authoritative nameservers (ns1.digitalocean.com, ns2.digitalocean.com, and ns3.digitalocean.com). You must point your domain registrar to these nameservers to activate DigitalOcean's DNS management.
Key Record Types for Droplets and Floating IPs
- A Records: Map a domain name directly to an IPv4 address, such as your Droplet's public IP or a Floating IP.
- AAAA Records: Map a domain name to an IPv6 address assigned to your Droplet.
- CNAME Records: Alias one domain name to another, though they should generally not be used on the root apex domain due to RFC constraints.
- TXT Records: Used for domain verification, SPF, DKIM, and DMARC security configurations.
Step-by-Step DigitalOcean DNS Configuration Guide
Follow this structured workflow to configure your DNS records accurately inside the DigitalOcean control panel and verify that they resolve correctly.
Step 1: Point Your Domain Registrar to DigitalOcean
Before creating individual records, your domain must use DigitalOcean's nameservers.
- Log in to your domain registrar (where you purchased the domain).
- Locate the custom nameserver or DNS management section.
- Replace your registrar's default nameservers with DigitalOcean's three standard nameservers:
ns1.digitalocean.comns2.digitalocean.comns3.digitalocean.com
- Save your changes. Note that global propagation can take anywhere from a few minutes up to 24 hours.
Step 2: Add Your Domain to DigitalOcean
- Log in to your DigitalOcean control panel.
- Navigate to the main networking or developer menu, then select the Domains section (exact menu paths may differ slightly depending on UI updates).
- Enter your domain name (e.g.,
example.com) in the Enter domain field and select the project where your Droplet resides. - Click Create Domain. DigitalOcean will automatically generate default NS and SOA records for you.
Step 3: Create A Records for Your Droplet or Floating IP
To direct traffic from your domain to a Droplet or Floating IP, you need to create standard A records.
- In your domain's record management table within DigitalOcean, select the A record tab.
- In the HOSTNAME field, enter
@to represent the root domain (example.com), or enter a subdomain name likewwworapp. - In the WILL DIRECT TO dropdown, select your specific Droplet or enter the static public IPv4 address of your Droplet or Floating IP (e.g.,
192.0.2.10). - Set the TTL (Time to Live) to the default 3600 seconds (or lower if you plan to make imminent IP changes).
- Click Create Record.
Record Type: A
Hostname: @
Will Direct To: 192.0.2.10
TTL: 3600
Step 4: Configure Floating IPs for High Availability
If you use a DigitalOcean Floating IP to ensure high availability and failover between multiple Droplets, your DNS configuration remains simple, but your workflow changes slightly during an incident.
- Always point your production domain A records (like
api.example.com) to the Floating IP address rather than the static primary IP of an individual Droplet. - When a Droplet fails, you reassign the Floating IP to a standby Droplet via the DigitalOcean control panel or API. Because the DNS A record points to the Floating IP, you do not need to wait for DNS propagation; traffic instantly follows the IP reassignment.
Verifying Your DNS Configuration
Once your records are saved, verify that public DNS resolvers are returning your newly configured IP addresses. You can use command-line utilities like dig or nslookup.
dig A example.com +short
Expected output:
192.0.2.10
To check IPv6 configuration:
dig AAAA example.com +short
Expected output:
2001:db8::10
If you encounter stale answers or incorrect IPs during troubleshooting, flushing your local operating system DNS cache or querying Google (8.8.8.8) or Cloudflare (1.1.1.1) public resolvers directly will help isolate caching issues.
Comparison: Static Droplet IP vs. Floating IP DNS Strategy
| Feature | Static Droplet IP | Floating IP |
|---|---|---|
| IP Persistence | Changes if you destroy and recreate the Droplet. | Remains persistent across Droplet rebuilds. |
| Failover Speed | Slow; requires updating DNS A records and waiting for TTL propagation. | Instant; traffic reroutes immediately upon IP reassignment. |
| Best Used For | Development servers, single-instance web apps, test environments. | Production web clusters, database failovers, high-availability APIs. |
Common Mistakes and How to Fix Them
- Using CNAME on the Root Domain: Setting a CNAME record for
example.comviolates DNS specifications and breaks email or web resolution on many resolvers. Always use an A record for the apex domain, and reserve CNAME records for subdomains likewww.example.com. - Forgetting to Update Registrar Nameservers: Users often create records inside the DigitalOcean control panel but forget to change the nameservers at their domain registrar. DigitalOcean's servers will not answer queries for a domain until the registrar points to them.
- Excessive TTL Values During Migrations: Keeping a high TTL (like 86400 seconds) right before an IP migration means users will hit the old server for up to 24 hours. Lower your TTL to 300 seconds at least 24 hours before making server changes.
- Ignoring IPv6 AAAA Records: Leaving orphan AAAA records pointing to old infrastructure while updating your A records can cause intermittent dual-stack connectivity failures for modern clients.
DigitalOcean DNS Quick Checklist
- Domain purchased and registrar nameservers updated to DigitalOcean.
- Domain added successfully to the DigitalOcean control panel.
- Root A record (
@) pointing to your Droplet or Floating IP. - Subdomain records (
www,mail,api) created properly. - TTL adjusted appropriately for upcoming maintenance or migrations.
- Records verified using command-line tools or online resolvers.