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 liquidweb.com
@ 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 220.127.116.11
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 18.104.22.168
cpanel IN A 22.214.171.124
webmail IN A 126.96.36.199
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
- Edit the zone file with your favorite command line editor.
- Change the value following the $TTL to the desired value.
- Update the Zone’s Serial number.
- Make BIND aware of your DNS changes by reloading the DNS zone.
- Test that your changes worked correctly using ‘dig’.
: vi /var/named/example.com.db
: rndc reload example.com
: dig @localhost example.com
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