Have you ever updated your domain’s A record and noticed that, for at least several hours, your domain displayed the new site on one device, such as your smartphone, but the old site on another device, such as your home computer? Have you ever updated your domain’s MX records and found that, for at least several hours, not all new emails were delivering to the new email server you specified?
I cannot count the number of times I have seen these sorts of situations cause website owners to panic, pull their hair out, or get frustrated with their hosting provider. So what exactly is going on, and what can you do about it?
What is happening is that the change you made to your domain’s DNS is propagating throughout the internet. In what follows, I will explain what DNS propagation is, and ways that you can reduce propagation times so that your changes update faster.
What is DNS Propagation?
“Propagation” is a term with several related meanings, but here it simply means the spreading of something from one thing to another. If you read the first article in this series, What is DNS?, you will recall that DNS was devised to be decentralized, so that there is no single, massive file that everyone needs to continuously download in order to have up-to-date records of which domain resolves to which IP. A natural consequence of this decentralized system is that any DNS changes would need to propagate, or spread, to other systems in order for the rest of the internet to see those changes. This is a process that requires time. Fortunately, you do have control over some of that time.
As I discussed in that article, one of the steps of the DNS resolution process is when your ISP (Internet Service Provider) caches, or stores, the looked-up record for a certain period of time. This is done so that the next time that record is requested it can be given automatically, which speeds things up on your end and reduces traffic on the ISP’s end. When you’ve made a change to your domain’s DNS, any nameservers (such as those belonging to your ISP) that have already stored that record in its cache will continue serving it until the record has expired and it has to request an update. That is why on certain networks it can take hours for a DNS change to be seen, while on others it is immediate: one network has a cached result, and one does not.
Fortunately, the length of time that caches are stored before being updated can be determined by you, provided that you have access to edit the TTL, or Time to Live, field of a given DNS record. Doing so is quite straightforward.
How Long Will it Take?
In my article Understanding DNS Records, I discussed the three most common DNS record types with which you ought to be familiar. In one of the screenshots I provided, and which is reproduced below, two of those records (A and CNAME) are shown. You will notice that each record has a TTL field containing a large number. This number is simply time in seconds. A TTL of 14400 means that any nameservers caching results for that record will do so for 14400 seconds, or 4 hours. After 4 hours, the cached record will expire and those nameservers will request an update from your DNS zone.
In general, a TTL value of 14400 is perfectly adequate for anyone’s needs. Lowering that value will only increase the burden on your website’s nameservers by causing it to respond with a greater frequency to any other nameservers who are caching your domain’s records.
But if you are, for example, migrating your website, or you want to change a DNS record for some other reason, then temporarily lowering the TTL value of certain records not only makes sense but can be beneficial to you.
The one caveat that you have to keep in mind before doing so is that you need to plan ahead. So, let’s suppose that I want to change the above A record for blog.example.org to some other IP, and I want that record change to propagate as quickly as possible, minimizing the effects of longer record caching. Because that A record’s current TTL is 14400, or 4 hours, I first need to lower it to, say, 300, or 5 minutes, and then wait for at least 4 hours. This is to give any caching nameservers enough time to expire my record and request a new one with its new TTL value. Once I have done that, I can change the A record to a new IP, and after 5 minutes that change should have propagated to every nameserver caching my DNS records.
You can edit the TTL values for CNAME and MX records as well, though cPanel currently does not offer a way to do so for MX records. In such cases, you’ll need to contact your hosting company’s customer support and have a technician update the TTL value for you, which can be done through WHM (cPanel’s administrative interface).
If you aren’t sure what TTL values are currently set for your domain’s records, you can use a DNS lookup service such as LeafDNS.