How To: Lowering Your DNS TTLs

Whenever making DNS changes, lowering your TTLs (Time To Live) 24 hours ahead of time will reduce the amount of time that your change takes to propagate.
This article assumes that you are running BIND on a linux server, that you already have an understanding of what DNS is, the different types of DNS entries, and how DNS works. Please note: The incorrect editing of your zone file can take your site offline. All editing must be done on the authoritative nameservers for the given domain.

Why and when to lower your TTL

Typically, DNS changes are quite infrequent. You will normally only make IP address changes when performing a migration of your domain, or moving your domain’s email to another server or service. If you are getting ready to change your domains IP address, you should lower your TTL 24 hours in advance, to allow the TTL change to fully propagate throughout the DNS infrastructure of the internet.

Where to change your TTL, and what to set it to

Below you see a typical zone file:

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

The specific part we are concerned about here is the $TTL 14400. This portion is called your Zone File’s Time To Live, or TTL, and is set in seconds. This indicates to all clients and caching nameservers how often it should check back with the authoritative nameserver for updated information.

Note: Caching nameservers will store the answer they get, and the Serial Number for the zone file. Make sure when you make any changes to your zone file, you increment the serial number.

Leaving this setting at the default of 14400 (4 hours) is fine, but when you are preparing for any event that will require an IP change, you can limit your downtime by lowering that value, so the caching servers will check back more frequently. Typically 300 seconds (5 minutes) is good primary IP address changes.

To lower that value on the Linux Command Line

  1. Edit the zone file with your favorite command line editor.
  2. [benny@host /var/named/]
    : vi /var/named/

  3. Change the value following the $TTL to the desired value.
  4. Update the Zone’s Serial number.
  5. Make BIND aware of your DNS changes by reloading the DNS zone.
  6. [benny@host /var/named/]
    : rndc reload

  7. Test that your changes worked correctly using ‘dig’.
  8. [benny@host /var/named/]
    : dig @localhost

Congratulations! Your TTLs have been lowered and you have taken the first step in preparing for your DNS change. Before making any other changes, or preparing to move your data, it is a good idea to make a backup of your site. Learn how.


Liquid Web’s Heroic Support is always available to assist customers with this or any other issue. If you need our assistance please contact us:
Toll Free 1.800.580.4985
International 517.322.0434

Be Sociable, Share!