What is dynamic DNS?
Dynamic DNS keeps a domain name pointing at an IP address that changes from time to time, such as a home or office connection. A small client notices the change and updates the DNS record automatically.
Why do some addresses change?
Because many internet connections receive their public address from the provider's pool, and the provider can hand out a different one after a router restart, a lease expiry or maintenance. That is fine for browsing, but a problem if you want to reach something at that location, such as a home lab, a camera system or a small office server, by name.
How does dynamic DNS work?
A client on the network checks the current public address on a schedule, compares it with the published record, and if they differ, sends an authenticated update to the DNS server. The record's time to live is kept short, often 60 to 300 seconds, so resolvers pick up the change quickly. The client may run on the router, which many models support, or on any always-on machine behind it.
What protocols carry the update?
Two families. The standard one, defined in RFC 2136, sends DNS UPDATE messages signed with a shared TSIG key, accepted by BIND, Knot DNS, PowerDNS and others. The second is the simple HTTP style many dynamic DNS services use: the client calls a URL with the host name and a token. Many DNS hosting providers also offer APIs that clients such as ddclient can call.
nsupdate -k /etc/bind/keys/lab-update.key <<'EOF' server ns1.example.org zone home.example.org update delete lab.home.example.org. A update add lab.home.example.org. 120 A 198.51.100.77 send EOF
Can I run my own dynamic DNS service?
Yes, and a dedicated server is a good place for it. Run an authoritative DNS server such as BIND or Knot for a subdomain, delegate that subdomain from your main zone, and allow signed updates only for the names each client owns. Because the server has a static address, it is a stable anchor for all your changing ones.
key "lab-update" { algorithm hmac-sha256; secret "(generated with tsig-keygen)"; };
zone "home.example.org" {
type primary; file "/var/lib/bind/home.example.org.zone";
update-policy { grant lab-update name lab.home.example.org. A AAAA; };
};
Do rented servers need dynamic DNS?
No. Every machine we rent has a fixed IPv4 address and a fixed IPv6 block for as long as you keep the server, so ordinary static DNS records are the right choice. Reverse DNS for the IPv4 is set in our console. Dynamic DNS becomes relevant when your server needs to reach something at a changing address, for example a WireGuard peer at a home office.
| Situation | Recommended record type |
|---|---|
| Website on a rented server | Static A and AAAA records, TTL 300 to 3,600 |
| Home lab on a residential line | Dynamic DNS, TTL 60 to 300 |
| Office with a changing address connecting to servers | Dynamic DNS name used as the WireGuard endpoint |
| Planned move to another server | Static records, TTL lowered a few days before |
Is dynamic DNS secure?
It is as secure as its update credentials. Use a separate key per client, scoped to its own names, so a leaked key cannot redirect other records. Prefer HMAC-SHA256 TSIG keys or API tokens with limited rights, and rotate them when a device is replaced. Publishing your home address in DNS also makes it discoverable, so keep exposed services behind a firewall or reach them only through a VPN.
Which client software is available?
Several mature options. ddclient supports many providers and the RFC 2136 method; inadyn is a light alternative often used on routers; many routers have dynamic DNS built in for a few services. A short shell script that compares the current address with the last one and calls nsupdate is enough for a single host. Whatever you choose, run it every few minutes, log each change, and alert if updates fail for longer than the record's TTL.
Can a server follow a changing peer automatically?
Partly. WireGuard resolves a peer's endpoint name only when the interface starts, so a home peer whose address changes is lost until the tunnel is restarted. The wireguard-tools package ships a small reresolve-dns script that re-reads endpoint names; run it from a systemd timer every few minutes on the server side. Alternatively, let the home side initiate the connection with a keepalive, so the server learns the new address from incoming packets.
What about IPv6?
Many home connections receive an IPv6 prefix that can also change. Clients can update AAAA records in the same way, but each device usually has its own address within the prefix, so the update must name the right one. Our How DNS works article explains records and resolution, and How VPNs work covers reaching home networks securely.
Related pages
How DNS works
From a typed name to an IP address: resolvers, root and TLD servers, authoritative zones, record types, TTLs and caching, with the commands to watch it happen.
Read moreIPv6 and reverse DNS on your server
Configuring the IPv6 block that comes with every machine and setting the reverse DNS name of its IPv4 address from the console.
Read moreCompany VPN gateways
Small, efficient machines for WireGuard and IPsec gateways that connect staff, offices and servers privately.
Read moreHow VPNs work
What a virtual private network does, the protocols in use today, remote access against site-to-site designs, split tunnelling and hosting your own gateway.
Read moreQuestions and answers
What is dynamic DNS used for?
Keeping a host name pointing at a connection whose public IP address changes, such as a home or small office line.
Do I need dynamic DNS for a dedicated server?
No. Our servers keep a fixed IPv4 address and IPv6 block, so use static DNS records.
Can I host my own dynamic DNS service?
Yes. Run BIND or Knot on a server for a delegated subdomain and accept TSIG-signed updates from your clients.
What is TSIG?
A shared-key signature for DNS messages that authenticates updates and zone transfers between trusted parties.
What TTL should a dynamic DNS record use?
Usually 60 to 300 seconds, so resolvers notice address changes quickly.