Where are the TTL of dynamically added records configured in bind?

I have a DNS-zone with standart $TTL set to 10 minutes. When the zone is updated, the hosts added get their own TTLs that differ from the zone default. The DHCP lease is configured to 24h.

$TTL 600        ; 10 minutes
example                 IN SOA  firefly.example. postmaster.example. (
                                2013102334 ; serial
                                28800      ; refresh (8 hours)
                                7200       ; retry (2 hours)
                                2419200    ; expire (4 weeks)
                                86400      ; minimum (1 day)
                        NS      firefly.example.
$ORIGIN mqmedia.
$TTL 18000      ; 5 hours
Andreass-MBP            A
                        TXT     "31fdf53482504a9965e4e7a210ebfe6080"
$TTL 600        ; 10 minutes
atom-builder            A
$TTL 86400      ; 1 day
axis-00031c200982       A
                        TXT     "311b67a2c49ae34eb511fa989cb22c9e65"
axis-00031c205143       A
                        TXT     "319dfebd7e94f89fa7ebda8e87d6702499"
axis-00031c2d0067       A
                        TXT     "31f70f97c582af3ace2ec4773a19edd451"
$TTL 18000      ; 5 hours
axis-00408c99d062       A
                        TXT     "3141073fe7f825c3c3a9daa1b864ab6afd"
axis-00408cac034d       A
                        TXT     "317e6bffaf74e74855f944b1e18ba6aac8"
axis-00408cd5b244       A
                        TXT     "31d7bebe14245b2f42f8d601554eb284d5"
axis-00408cdb9d15       A
                        TXT     "31aaa279559559302bf51db4cb8e2b69f8"

The TTL is always configured at the zone file. It may be set as default, using $TTL on the beginning of the file; as individual $TTL statements spread through the file, and influencing the records below it; or even on the record itself.

When the server does a nsupdate to add the record for your host, bind will check to see if there is any TTL already present, marking $TTL 86400, and add the record below it, if not, it will add the $TTL for the specified time and the record below it.

| improve this answer | |
  • But the entries that were added dynamically seem to have totally random TTL which differs from default TTL of 10 minutes. Does it mean that TTL has to be set up on the nodes too? – Pavel Potatis Oct 28 '13 at 7:40
  • Have you changed your DHCP configuration recently? – fboaventura Oct 28 '13 at 11:51
  • Oh, I see, so they are added according to the current DHCP-lease of the entry. Still, if the DNS allows updates from the network, any node can set up its own TTL. – Pavel Potatis Oct 31 '13 at 14:49

Where are the TTL of dynamically added records configured in bind?

The TTL of dynamically added records configured is not configured in bind, you specify the TTL together with the content when you create a record.

These lines as input to the nsupdate command will create three records in the same zone with different TTL values (day, hour, minute).

update add host1.example.com 86400 A
update add host2.example.com  3600 A
update add host3.example.com    60 A

You could even create different records for the same DNS name with different TTL values.

update add host1.example.com 86400 A
update add host1.example.com  3600 A
update add host1.example.com    60 A

If you use other tools to do the dynamic update, whether there is a default value and how to configure it depends on the tools you use. In your case this seems to be the DHCP server.

At the DNS protocol level, the TTL field is not optional, so there is no need to specify a default in BIND, the DNS update packet will always specify the TTL value for the record to be added.

| improve this answer | |

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.