TTL

Definition

TTL, or Time to Live, is a mechanism that limits the lifespan or duration of data in a computer or network. It is commonly used in networking to specify the time or number of hops that a packet is allowed to exist before being discarded. In DNS, TTL defines how long a resolver is supposed to cache a query before requesting a new one. Properly configuring TTL can help optimize performance and reduce unnecessary load on servers.

Secure Settings Example

# Example of a secure DNS zone file with a reasonable TTL setting
$TTL 3600  ; 1 hour TTL for DNS records
example.com. IN SOA ns1.example.com. admin.example.com. (
              2023101001 ; Serial
              7200       ; Refresh
              3600       ; Retry
              1209600    ; Expire
              3600 )     ; Negative Cache TTL

Insecure Settings Example

# Example of an insecure DNS zone file with an excessively long TTL
$TTL 86400  ; 24 hours TTL for DNS records
example.com. IN SOA ns1.example.com. admin.example.com. (
              2023101001 ; Serial
              7200       ; Refresh
              3600       ; Retry
              1209600    ; Expire
              86400 )    ; Negative Cache TTL