5

I've set up my own dynamic DNS service by using a script to automatically update the A record for a subdomain of one of my domains.
The host with the dynamic IP address runs, among other things, a Munin node which I'm reading remotely at five-minute intervals.
Unfortunately, my domain name registrar doesn't allow TTL values less than 3600, so the IP for the remote Munin node is cached for an hour and the connections fail for up to said hour whenever the node's dynamic IP changes.

Is there a way to override the TTL reported by my registrar's DNS server, so the server will re-resolve the IP each time it connects to the Munin node?

5

If the dynamic DNS service you're using only allows TTL's of 3600, then your only option is to switch providers. There really isn't any way to control the TTL unless the DDNS service provider gives you an option to control it.

Checking TTL's

Incidentally to check what the TTL is for a given entry you can use dig with the following switches.

Example

$ dig +nocmd www.google.com +noall +answer | tail -1
www.google.com.     137 IN  A   74.125.225.82

$ dig +nocmd www.google.com +noall +answer | tail -1
www.google.com.     135 IN  A   74.125.225.115

So the TTL for this response is 137 seconds. Waiting ~2 seconds and running it again shows 135 seconds. The TTL means how much time is left until the DNS entry expires, and we need to go query the authoritative server for the domain.

Checking Max TTL's

If we were to query the authoritative server.

$ dig @ns1.google.com +nocmd www.google.com +noall +answer | tail -1
www.google.com.     300 IN  A   74.125.225.210

So the actual TTL for this entry is 300 seconds.

NOTE: The authoritative server is also known as the SOA - Start of Authority.

SOA information

You can query the domain further for SOA information.

$ dig +nocmd dyndns.org any +multiline +noall +answer
dyndns.org.     596 IN SOA ns1.dyndns.org. hostmaster.dyndns.org. (
                863998266  ; serial
                600        ; refresh (10 minutes)
                300        ; retry (5 minutes)
                604800     ; expire (1 week)
                600        ; minimum (10 minutes)
                )
dyndns.org.     85904 IN NS ns5.dyndns.org.
dyndns.org.     85904 IN NS ns1.dyndns.org.
dyndns.org.     85904 IN NS ns2.dyndns.org.
dyndns.org.     85904 IN NS ns3.dyndns.org.
dyndns.org.     85904 IN NS ns4.dyndns.org.
dyndns.org.     12268 IN MX 10 mail.dyndns.com.
dyndns.org.     12268 IN MX 20 mx2.mailhop.org.
dyndns.org.     179 IN A 204.13.248.116

Changing TTLs

The only way to change a DNS entry's TTL (outside of some sort of API that your registrar might provide) is through the server.

Example

Within Bind you could setup your zone file like so:

;Zone file for liquidweb.com
$TTL 14400
@      86400    IN      SOA     ns.liquidweb.com. admin.liquidweb.com. (
2009022402      ; serial, todays date+todays
86400           ; refresh, seconds
7200            ; retry, seconds
3600000         ; expire, seconds
86400 )         ; minimum, seconds
liquidweb.com. 86400 IN NS   ns.liquidweb.com.
liquidweb.com. 86400 IN NS   ns1.liquidweb.com.
liquidweb.com.  IN A   209.59.139.21
localhost  IN A   127.0.0.1
liquidweb.com.  IN MX 0   liquidweb.com.
mail  IN CNAME  liquidweb.com.
www  IN CNAME   liquidweb.com.
ftp  IN A   209.59.139.21
cpanel  IN A   209.59.139.21
webmail  IN A   209.59.139.21

The above macro, $TTL would set the TTL to 14400 seconds for any entries, unless it get's overridden for particular entries.

References

  • Thanks for the detailed explanation. My domain name registrar (and at the same time DNS provider) doesn't allow TTLs lower than 3600 seconds, so I decided to run a DNS server on one of my VPSs to handle only the subdomain with the dynamic IP. – n.st Jan 4 '14 at 2:17
  • @n.st - I run my own Bind servers for similar reasons as well. Glad this resolved your issue, and thanks for the Q. – slm Jan 4 '14 at 2:19
1

You can create your munin host as a CNAME for an external domain so only the munin name uses the dynamic DNS host.

munin.yourdomain.com. CNAME somedynamic.dyndns.org.

So lookups actually go to somedynamic.dyndns.org which has a lower dynamic TTL, the rest of yourdomain.com stays on your DNS.

0

If it's not possible to update the DNS, then you can use a different DNS like DynDNS.org and use a standard update script.

  • I actually migrated away from No-IP because I wanted to make all my server accessible under my own domain, so I want to avoid switching back by (almost) all means. – n.st Jan 3 '14 at 22:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.