Hoppa till innehållet

Dynadot

Från Plutten

Mall:Short description

Dynadot Dynamic DNS (DDNS) Setup

This page documents how to configure Dynamic DNS for Dynadot and automatically update the A record when the public IP address changes.

Requirements

  • Dynadot account
  • Domain using Dynadot DNS
  • DDNS password generated in Dynadot
  • Ubuntu server with outbound HTTPS access

Dynadot configuration

1. Enable Dynadot DNS

  1. Log in to Dynadot
  2. Go to My Domains
  3. Click the domain
  4. Set DNSDynadot DNS

2. Enable Dynamic DNS

  1. Domain settings → Dynamic DNS
  2. Enable DDNS
  3. Generate a DDNS password
  4. Save it securely

3. Required values

Field Example
Domain example.com
Subdomain @ or www
Record type A (IPv4) or AAAA (IPv6)
DDNS password (generated in Dynadot)

Dynadot update endpoint

Dynadot accepts HTTP GET updates:

https://www.dynadot.com/set_ddns

Parameters:

  • domain
  • subDomain
  • type
  • ip
  • pwd
  • ttl (optional)

Ubuntu auto-update script

Script: dynadot-ddns.sh

#!/bin/bash

DOMAIN="example.com"
SUBDOMAIN="@"
TYPE="A"
PASSWORD="YOUR_DDNS_PASSWORD"
TTL="300"

IP_FILE="/tmp/dynadot_last_ip.txt"

CURRENT_IP=$(curl -s https://checkip.amazonaws.com)

if [ -z "$CURRENT_IP" ]; then
    exit 1
fi

if [ -f "$IP_FILE" ]; then
    LAST_IP=$(cat "$IP_FILE")
else
    LAST_IP=""
fi

if [ "$CURRENT_IP" = "$LAST_IP" ]; then
    exit 0
fi

UPDATE_URL="https://www.dynadot.com/set_ddns?containRoot=true&domain=${DOMAIN}&subDomain=${SUBDOMAIN}&type=${TYPE}&ip=${CURRENT_IP}&pwd=${PASSWORD}&ttl=${TTL}"

curl -s "$UPDATE_URL" > /dev/null

echo "$CURRENT_IP" > "$IP_FILE"

Installation

1. Save script

sudo nano /usr/local/bin/dynadot-ddns.sh

Paste script and edit variables.

2. Make executable

sudo chmod +x /usr/local/bin/dynadot-ddns.sh

3. Test manually

/usr/local/bin/dynadot-ddns.sh

4. Add cron job (every 5 minutes)

crontab -e

Add:

*/5 * * * * /usr/local/bin/dynadot-ddns.sh

Security notes

  • Store DDNS password securely
  • Limit file permissions
  • Do not commit the script to public repositories

References

  • Dynadot Help – Dynamic DNS
  • Dynadot API documentation