Set Up Simple Dynamic DNS
Last updated
Dynamic DNS (DDNS) lets you keep a DNS record updated automatically when your IP address changes. This is especially useful if your ISP assigns you a dynamic IP, but you still want to reach your home network or server using a fixed domain name.
With DNSimple, you use the DNSimple API to update the record. The quickest option is the official Dynamic IP Updater in Bash. The Tools page also lists community updaters in other languages. To write your own, follow the steps below. For background, see What Is Dynamic DNS?.
Before you begin
You need:
- The domain’s zone in DNSimple, active and delegated to DNSimple’s name servers.
- An API access token.
- Basic familiarity with making HTTP requests (or a tool like
curl).
Note
DNSimple does not support the legacy dyndns API that many consumer routers reference when they mention DDNS. Instead, you must use our API or a compatible client.
Step 1: Create the record you want to update
Decide which DNS record you want to keep updated with your dynamic IP address. Typically, this is an A record for a subdomain like home.example.com. Add the A record in the record editor with your current IP address. A short TTL, such as 1 minute, makes changes reach visitors faster.
Step 2: Find your account ID and record ID
The API needs your account ID and the record’s ID. With your token in the API_TOKEN variable, look up the account ID:
curl -H "Authorization: Bearer $API_TOKEN" https://api.dnsimple.com/v2/whoami
If you use a user token, the response does not include an account; find your account ID in the URL of your DNSimple dashboard (https://app.dnsimple.com/a/<ACCOUNT_ID>/...) instead.
Then list the A records named home to find the record ID:
curl -H "Authorization: Bearer $API_TOKEN" \
"https://api.dnsimple.com/v2/$ACCOUNT_ID/zones/example.com/records?name=home&type=A"
The id field in the response is the record ID.
Step 3: Write the update script
This script looks up your current public IP address and updates the record with it:
#!/bin/sh
API_TOKEN="your-api-token"
ACCOUNT_ID="12345"
RECORD_ID="67890"
CURRENT_IP=$(curl -s https://ifconfig.me)
curl -H "Authorization: Bearer $API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-X PATCH \
-d "{\"content\":\"$CURRENT_IP\"}" \
"https://api.dnsimple.com/v2/$ACCOUNT_ID/zones/example.com/records/$RECORD_ID"
Replace the token, account ID, record ID, and example.com with your own values. Keep the script readable only by you, because it contains your API token.
Step 4: Automate the update
Run your script on a schedule to keep your DNS record synced with your current IP:
- On Linux/macOS: use cron.
- On Windows: use Task Scheduler.
For example, this cron entry runs the script every 5 minutes:
*/5 * * * * /path/to/update-script.sh
Step 5: Verify the record
Check that your DNS record updates correctly by asking DNSimple’s name server directly:
dig @ns1.dnsimple-edge.com home.example.com +short
The returned IP should match your current IP address. Resolvers that cached the old address keep it until the record’s TTL runs out.
Have more questions?
If you have additional questions or need any assistance with Dynamic DNS, just contact support, and we will be happy to help. You can also read more about DNS hosting at DNSimple.