Propagate and Refresh DNS Cache Faster

»»»Propagate and Refresh DNS Cache Faster
When moving web host to another hosting service’s server or changing the server’s IP address, one of the important consideration to ensure to continue availability of the websites hosted on the server, minimize the downtime of the web sites, avoid weird problems such as emails get delivered to either server randomly, or browsing at old server, is how fast DNS (Domain Name System) will be able to translate or resolve hostname or domain name into your new IP address, instead of the old IP destination. Unfortunately, webmasters have limited ability to control or override the DNS propagation process. Nonetheless, there are still some tips, tricks and workarounds that ensure DNS cache will reflect the new IP addresses as soon as possible.

DNS works in such as a way that when a request for IP address received by DNS resolver, it will then query the root servers to find the authoritative server with detailed knowledge of the particular domain name. If a valid IP address for the domain is returned by the authoritative server, the DNS resolver will cache the DNS resolution for a given period of time known as TTL (Time To Live) after a successful answer, in what known as DNS caching in order to reduce the load on particular DNS server. DNS caching allows resolution of domain name to IP to take place locally using the cached information instead of querying the remote server for subsequent requests, until the TTL duration expires.

The Time-To-Live (TTL) timer is the trick to ensure that the DNS cache expires quickly and always stays fresh. TTL is defined by domain administrator in the authoritative DNS server for the zone where data originates, and its values instruct DNS caching resolvers to expire and discard the DNS records after TTL seconds. Lowering the TTL value will enable rapid expiration and refreshing of DNS records, causing the new records to propagate faster across the world. However, the trick needs the name resolvers follow the RFC standards, which most do. Beside, you must have full control to modify the name server authoritative for your domains.

The tweaking of TTL in DNS records must be done a few days before it’s about to change (date of server moving or IP change) to ensure that all DNS caching resolvers receives the new TTL value and expires the old longer value. The trick will reduce the TTL in anticipation of the change to minimize inconsistency during the change, according to RCF 1034.

TTL is defined by Minimum field in SOA (Start of Authority) type as default TTL, or individually at each record as TTL. RCF 1912 describes the Minimum field in details as below:

Minimum: The default TTL (time-to-live) for resource records (RR) — how long data will remain in other nameservers’ cache. ([RFC 1035] defines this to be the minimum value, but servers seem to always implement this as the default value) This is by far the most important timer. Set this as large as is comfortable given how often you update your nameserver. If you plan to make major changes, it’s a good idea to turn this value down temporarily beforehand. Then wait the previous minimum value, make your changes, verify their correctness, and turn this value back up. 1-5 days are typical values. Remember this value can be overridden on individual resource records.

If you’re using a web-based or graphical user interface to manage your domain’s DNS records, then login to the system, and edit the SOA records. Inside you will see a field named Minimum, modify the value to as low as possible (in seconds), such as 300 for timeout every 5 minutes. Then modify the TTL for all of the A, AAAA, MX, CNAME, TXT, SOA, PTR and other records, if applicable.

If you are using cPanel WebHost Manager (WHM), login and choose Edit DNS Zone under DNS Functions section. Select the applicable zone (domain name). You will be presented with a list of records. Modify the minimum ttl in SOA, and TTL column of A, MX, CNAME and other records defined.

For those manually configure the authoritative nameserver for a domain zone using BIND, modification has to be done in the zone file. For example, so domain zone example.com, you will see the following resource records in the zone file:

; zone 'example.com'
$TTL 14400

@     IN     SOA     ns1.example.com. host.example.com. (
2007080501      ; Serial
10800           ; Refresh 3 hours
3600            ; Retry 1 hour
604800          ; Expire 1 week
86400          ); Minimum 24 hours

@                       NS      ns1.example.com.
@                       NS      ns2.example.com.

@                       A       192.168.0.1
@                       MX     10 mail.example.com.

; nameservers
ns1                     A       192.168.0.11
ns2                     A       192.168.0.12
; mail servers
mail                    A       192.168.0.10
; web server
www                     CNAME   example.com.

Now change the $TTL 14400 with the value you want (in seconds), such as 300 (5 minutes). This value defines the default TTL of all existing records, and by lowering this value to 300 (for example, you can choose your won value), caching server will be hold this records for more than 5 minutes before querying the authoritative name server which will be the first to reflect the new IP address when change later on again. Another value that you should change is minimum TTL, the last line of SOA type (remarked as minimum 24 hours).

After change, your DNS zone file will probably looks like this:

; zone 'example.com'
$TTL 300

@     IN     SOA     ns1.example.com. host.example.com. (
2007080501      ; Serial
10800           ; Refresh 3 hours
3600            ; Retry 1 hour
604800          ; Expire 1 week
300            ); Minimum 24 hours

@                       NS      ns1.example.com.
@                       NS      ns2.example.com.

@                       A       192.168.0.1
@                       MX     10 mail.example.com.

; nameservers
ns1                     A       192.168.0.11
ns2                     A       192.168.0.12
; mail servers
mail                    A       192.168.0.10
; web server
www                     CNAME   example.com.

Restart the DNS service. The new TTL value will propagate to other DNS nameserver. This process typically takes 48 hours to 72 hours (hence the need to reduce TTL to try to make it faster when changing the critical A and MX records). After waiting for a few days, move your websites to new server or change the IP address, and then update the DNS records to point to the new server or IP.

Once done, you can now revert back the TTL values to reduce the load on your DNS server.

By | 2016-12-09T08:39:39+00:00 December 9th, 2016|Categories: Domains & Hosting|Tags: |10 Comments

About the Author:

LK is a technology writer for Tech Journey with background of system and network administrator. He has be documenting his experiences in digital and technology world for over 15 years.Connect with LK through Tech Journey on Facebook, Twitter or Google+.
  • Great tip. I hope I don't have to wait 72 hours for it to update now!

    A word of warning though… Don't start messing around with the cName settings unless you know what your doing!

  • Very useful information… thanks a lot

  • dananos

    Is there any way to force, or at least notify other DNS servers that records for a particular domain are invalid. It could permit faster propogation of changes…

  • garrett

    i wish i'd have looked for this earlier in the week… DNS has been a nightmare this week

  • Perdre Poids

    That's a great trick, thank you for sharing. So far, I used to pick a low traffic season (like Christmas) to do my hosting moves.

  • Ruben Schouten

    Great tips, thanks! It's also a good idea, as a web-developer, to run your own DNS that contacts the SOA of domains you're working with on a regular basis to ensure you are the first one to arrive at the new server when moving domains.

  • Black Adder

    Thank you, but is there’s away to update the dns servers faster i just moved my site and it’s taking a day so far without dns fullu pdate can we do the update manually like submitting the new ip to the name servers?

    • philNYC

      I normally find (in metro USA East Coast) that a new DNS entry set to 600 seconds, will propagate in about 10 minutes. It’s when you go back and change that same DNS record again that things get hinky as the original record is still propagating.

      It still shouldn’t take more than a few hours if you are located in a dense population or server area. You could try clearing your local DNS cache. That can mess you up sometimes too.

      Ping the domain as you entered it ans see what comes back as the IP assigned.

  • webzoneglobal.com

    Firefox is definetly very developer friendly with such a vast collection of plugins

  • sparkz.co.in

    Useful information. especially the minimum part

Pin It on Pinterest

Share This

Share This

Share this post with your friends!