Menu Search
Jump to the content X X
Smashing Conf San Francisco

You know, we use ad-blockers as well. We gotta keep those servers running though. Did you know that we publish useful books and run friendly conferences — crafted for pros like yourself? E.g. our upcoming SmashingConf San Francisco, dedicated to smart front-end techniques and design patterns.

Introduction to DNS: Explaining The Dreaded DNS Delay

Imagine that your biggest client calls because they are having trouble retrieving their email. Or they want to know what their best-selling item is right now. Or their most popular blog post. Perhaps their website has suddenly gone down. You can hardly reply, “No problem, I’ll get back to you in 24 to 48 hours.”

And yet DNS gets away with it! If you need to move a website or change the way a domain’s email is handled, you’ll be faced with a vague 24 to 48-hour delay. This is quite an anomaly in a world of ultra-convenience and super-fast everything. This article explains what DNS is, how it works, where that pesky delay comes from, and a couple of ways to work around it.

What Is DNS? Link

DNS is the “domain name system.” It translates human-friendly website addresses like into computer-friendly IP addresses like Try visiting if you’d like to verify this.

Every computer, Web server and networking device on the Internet has one of these numerical IP addresses. In some cases, through a process called “network address translation,” a whole house, office or building shares the same IP address. But the addresses are otherwise unique, and they allow computers to easily route information around the Internet.

DNS is a distributed service. No single computer out there translates domain names to addresses. Instead, the task is shared by millions of name servers (also spelt as one word, “nameserver”), which constantly refer to and update each other.

Your Local Name Server Link

Every computer connected to the Internet has a name server. When you attempt to visit a website like, your computer asks its local name server to go off and find the corresponding IP address, in this case. Your computer’s name server can’t make this translation by itself; it has to keep asking other name servers until something somewhere comes back with a definitive answer.

Your local name server is like the little address book that you kept near the telephone before mobiles were invented. If you hired A1 Triple Glazing to retrofit your windows, you might have copied their phone number into your address book. The next time you had to ring them, the number would be right there, immediately available. Or under the sofa.

Some Name Servers Are Special Link

The name servers just “know.” Every domain name like has at least one name server that authoritatively and definitively knows the correct IP address. The authoritative name servers for are flashily called, and

This is like saying that A1 Triple Glazing’s phone number can definitely be found in the Northampton Yellow Pages. That particular phone book is the authoritative source of information on the whereabouts of A1 Triple Glazing.

Where the Delay Comes From Link

Say A1 Triple Glazing decides to change its phone number. It could take up to 12 months before the 2012 edition of the Northampton Yellow Pages comes out with the updated phone number. And it could take a further 12 to 36 months before you next go up to Northampton, check the Yellow Pages, and copy the new phone number into your personal address book. In the intervening 24 to 48 months, your address book would be out of date. And if you ever rang A1 Triple Glazing, you’d be disconnected instantly… or end up speaking to a hairdresser. Fortunately, new windows generally have a 10-year guarantee. But websites need to be a bit more responsive than that.

Creating A New Website Link

DNS becomes important whenever you need to create a new website or move an existing one. New websites are the simpler case, so we’ll discuss them first. With any new website, you need to do several things:

1. Buy the Domain Name Link

Screenshot of a registrar1
123-reg is a domain name registrar that does hosting on the side.

A company from which you buy and register a domain name is called a registrar. Registrars get a special license from ICANN2 that allows them to sell domain names. The license costs $2500 (US) to apply, plus $4000 per year. Some particularly large registrars are GoDaddy in the US and 123-reg in the UK.

After registering a new domain name, there may be a delay of a few minutes to a few hours before you can log into the registrar’s website to change the domain’s name servers (step 3 below) or point to an IP address (step 4 below). This delay is a result of the registrar processing your payment, adding you to the Whois database3 and updating its records. The delay applies only to brand new domains and so is not part of the DNS delay.

2. Find a Host for the Website Link

Some companies provide only hosting.

The hosting company puts your website on a big powerful server somewhere, provides you with an IP address and charges you monthly. Thousands of big and small companies offer hosting or resell another company’s. Most registrars also offer hosting, and if you buy the domain name and hosting space from the same company, you won’t need to worry at all about DNS.

3. Specify Name Servers for Your Domain Link

Almost all registrars allow you to change name servers. This screenshot is from Fasthosts.

This step is akin to specifying which Yellow Pages your domain name should appear in. Usually you can skip this step and just use the default name servers provide by the registrar.

You might want to change them if, for example, you registered the domain names (step 1 above) with several companies but wanted to manage the DNS (step 4 below) from one place. Or perhaps you used Really Cheap Registrar Plc to register the domain names, but you want to use Really Flexible DNS Plc to manage the DNS. Or perhaps your host (step 2) has a nice DNS interface that you’d like to use.

To change the name servers, log into your registrar (from step 1 above), navigate to the domain name in question, and look for a “Change name servers” option, as in the screenshot above. Really Flexible DNS Plc will tell you what to change them to.

4. Point the Domain Name at the IP Address Link

Using Fasthost’s advanced DNS to add the IP address of a website.

Now you need to log into whichever company is providing the name servers (either the registrar, the host or another) and point to your new IP address. Usually there is an option for “DNS Settings” or “Advanced DNS,” often with a big warning asking whether you’re sure you know what you’re doing. Find the button to add an new “A” record (for “Address”). Enter www as the host name (i.e. the prefix for the domain name) and the IP address given by your host in step 2.

You can use the same process to create other address records, such as Sometimes you can enter * as the host name, and then will point to the IP address. And if you enter @ as the host name, then it will point without any host name.

5. Wait For It to Happen Link

This is the cause of part of the DNS delay. Many companies will process your DNS request immediately. Others process requests only once or twice a day; so, if your company processes changes only at 4:00 am, and you request the change at 4:02 am, then you’ll need to wait almost 24 hours.

123-reg says this7:

Not only do we give you the power to change your DNS settings to whatever you like, but we make those changes instantly! Unfortunately, we can’t make the Internet as efficient as we are?—?other web services may take longer to update. Your changes will go global just as soon as they catch up.

The next section discusses how DNS works in detail, and the final section covers the main part of the DNS delay.

How DNS Works Link

When you visit a website in the browser or ping or FTP or telnet or do any networking operation, your computer needs to convert the (fully qualified) domain name into an IP address. This section shows how that happens, with commands so that you can try it yourself.

For the commands, you’ll need to open up the terminal on Mac or Linux or the command prompt on Windows. To do this on a Mac, go to Applications ? Utilities ? Terminal. In Ubuntu Linux, go to Applications ? Accessories ? Terminal. On Windows, go to Start ? Programs ? Accessories ? Command Prompt.

Note that in DNS, both and can be called “domain names8.” But the latter,, could also be called a “host name” or a “fully qualified domain name” or just a website address. This article mostly uses the term “domain name.”

1. Ask Your Local Name Server Link

Let’s say you want to visit Within its many networking settings, your computer has stored the IP address of a local domain name server. Its first step is to ask this name server for the answer.

On Mac and Linux, you can run the following command to find out what your name server is:

cat /etc/resolv.conf

On Windows, the command is:

ipconfig /all

What the command looks like in Linux.

In this case, my computer sends a request to, something along the lines of, “Oi,! What’s the IP address for”

2. Your Local Name Server Doesn’t Know Link

Let’s say that the local domain name server,, is brand spanking new. It has never been asked anything before, let alone for the IP address of It knows very little. In fact, the only things it knows are the IP addresses of the root name servers9. You can find out everything it knows using the NsLookup command.

On Mac, Linux and Windows, run the command shown below. The -type=ns tells NsLookup to only return information on name servers. And the dot at the end tells it to look up root name servers.

nslookup -type=ns .

This will return the names and IP addresses of a handful of root name servers. If you’d like to see what’s holding the Internet together, Wikipedia has a picture of one of these very important computers10.

A list of the Internet’s very important root name servers.

3. So, It Asks a Top-level Domain Name Server… Link

Your local name server extracts the last part of the requested domain name, which is com in this case. This is called the top-level domain or TLD. Others are net, gov, uk, fr, ie and de.

Your local domain name server picks one of the root name servers listed above and asks it something like, “Excuse me, If you don’t mind, where would I find information about .com domains?”

You can see the sort of answer it would receive by running this command:

nslookup -type=ns com

This is a list of TLD name servers for com domains.

4. … And Gets Redirected to a Lesser Domain Name Server Link

It’s nearly there. Your local name server now asks one of these TLD name servers something like, “Hi, Do you know where I should go for stuff on”

You can see the answer to this question by running NsLookup again:

nslookup -type=ns

This returns a list of name servers for the domain The word authoritative means that these name servers are the definitive place to go for DNS information on

Running the NsLookup command.

5. Get the IP Address Link

So, now your local name server goes to one of these name servers. It has arrived at the first part of the requested domain name, the www, so it no longer needs the name servers; it’s ready for the actual data. Now it can ask one of those name servers, “Hola, Can you tell me the IP address of Cheers!”

Run the NsLookup command again, using the IP address of one of the domain name servers from above, but without the type=ns this time:


Bingo! Now your local name server knows that translates into

6. Remember It For Next Time Link

Your local domain name does not want to have to go through all that rigmarole again any time soon. So, it caches (i.e. stores) everything it has learned, including the IP addresses for TLD servers and the IP address of

So, the next time you ask for a com domain, such as, it needs to repeat only steps four and five above. And the next time you (or anyone else using your local name server) asks for, it doesn’t need to do anything; it just replies with the IP address that it has already remembered.

But it won’t remember that translation forever. Eventually, it will forget and have to repeat some or all of the steps above. You can use the dig command to find out how long it will remember.

On Mac and Linux, run this:


Windows users will need to use an online version of this tool12, because Windows does not come with the dig command.

Digging Smashing Magazine.

In the Answer Section, is a line starting with (the thing you asked about) and ending with the translated IP address. The number in the middle is the number of seconds before your local name server forgets about this domain and has to repeat steps four and five above. In this example, it is 238 seconds:


This caching on your local name server is responsible for part of the DNS delay. In this case, even if Smashing Magazine changed its IP address right now, your computer wouldn’t know about it for at least 238 seconds, when the local name server would have to recheck its sources.

If you use the online tool, then you are not checking your personal local name server, but rather you’re checking that website’s local name server. You can run a slimmer version of this command:

dig +nocmd +noall +answer

Also note that in all of the commands above, you could have provided the name of the name server rather than the IP address. NsLookup would have translated it for you.

7. Send the Answer Back to Your Computer Link

Finally, your local domain name server sends the answer back to you at Your computer and/or browser might also cache this translation, so that the next time you ask for, it doesn’t even need to ask the local name server.

Now your computer will embark on another amazing process to communicate with the computer at the address and ask it for a Web page. Your computer will essentially send a request down its network cable (or over its wireless connection), and ask your broadband router something like, “Can you please ask to send me the home page for”

Your broadband router will send the same request along its network cable to the next router. This process will keep repeating. At some point, some large networking device will have several cables connected to it and will follow a rule like, “Requests for any IP addresses starting with less than 100 should go down cable #1. Everything else down cable #2,” and so on, until the request finally gets to And the reply will be sent back in the same way.

You can follow this journey using the traceroute command on Mac and Linux and tracert on Windows:


Time To Live Link

The caching in step six above is the main cause of the DNS delay. Any given translation (of a Web address into an IP address) has a property called “time to live” or TTL. This tells domain name servers how long they are allowed to cache the translation before having to look it up again.

You can find out what the TTL for a given (fully qualified) domain name is using the dig command, instructing the command to use the domain name’s name server, like so:


Finding out the time to live, which in this case is 1800 seconds, or half an hour.

The Answer Section shows that has a TTL of 1800 seconds:


That is, your local domain name server will remember this for 1800 seconds. If Smashing Magazine suddenly decided to change its IP address, your local domain name server could hang onto the old IP address for up to 30 minutes.

The command also specifies how long to remember that is a name server for


If Smashing Magazine suddenly decides to change its name servers, your local domain name server would hang onto the old name server for up to 86,400 seconds, which is one whole day. Only then would it ask for the new name server, and only then would it ask the new name server for the new translation.

Moving A Website Link

And now for the grand finale! This section ties together all of the above to explain the delay. Three sections ago, we had an in-depth description of how to buy a domain name and set up the DNS. This section looks at what happens when you change the IP address of an existing address.

1. Find Out the Name Servers for the Domain Link

First, you need to know which name servers your domain uses. You can use the nslookup or whois command or an online networking tool15. In this example, I will change the IP address of

nslookup -type=ns

The name servers for this domain are listed as and

2. Change the IP Address Link

Editing a DNS entry
Changing the IP address for an existing address record at Rackspace.

To actually make the change, you will need to log into the website of the company that manages your name servers, as in the section far above. Then find the (fully qualified) domain name that you want to move, and click on something like “Edit DNS Settings” or “Advanced DNS.” Then find the address record you want to change, and edit and save it.

3. Check Whether the Change Has Been Processed Link

Your DNS change will be processed after a few minutes or hours, depending on the company. To check if and when the change has been processed, you can use the nslookup command to query the name server directly. This bypasses your own local name server and gets the information straight from the horse’s mouth. You can also use an online tool16, submitting the domain ( in this case) and server (


Keep running this command until it comes back with the new IP address. This particular change with Rackspace took 10 to 20 minutes. This is the first part of the DNS delay, and it could take anywhere from 0 to 24 hours.

4. Check How Long You Have to Wait Link

Eventually, the authoritative name servers for your domain will be changed, and it will return the new IP address. Then you can use the dig command to find out how long until your own name server reflects the change:


Look in the Answer Section. It will give you the IP address that it thinks is correct (ending in 33 in this case), and the number of seconds until this expires (91).

;; ANSWER SECTION:    91    IN    A

After the 91 seconds have passed (which felt a lot longer than 91 seconds as I was actually doing it), the answer will suddenly change. The IP address will be the new one (ending in 34), and the number of seconds will reset back to about the time to live (1799 in this case, or 30 minutes).

;; ANSWER SECTION:  1799    IN    A

Now you can restart your browser (to clear its internal cache) and visit the address. Your browser should go to the new IP address and the moved website.

You can also use an online dig17 to test this, although you will be using its name servers instead of your own; so even if it returns the correct IP address, you (or your client) may have to wait a bit longer.

Most DNS entries have a time to live of 86,400 seconds, which is 24 hours. This will add another 0 to 24 hours of delay, with an average of 12 hours. So, the total delay could be between 0 and 48 hours.

Note that the process is similar when changing the name servers for a domain. You can use nslookup or dig to keep track of the changes.

Minimizing The Delay When Moving A Website Link

There are a few techniques for shrinking the delay, or eliminating it entirely. Please comment if you have any other suggestions.

1. Make the Delay Immaterial Link

If the website is static and never changes, then having an exact copy on both the old and new hosts will be sufficient. Visitors won’t be able to tell whether they are seeing the old or new one. Or, if you are in a position to shut down dynamic content (such as turning off the comments on a blog for a weekend), then you can make your website static for the duration of the transfer period.

2. Update the Database Across the Internet Link

All big websites use a database that updates frequently based on user events, such as blog comments and items in shopping baskets. When moving this kind of website, it is possible to subject only the files (HTML, PHP, ASP, etc.) to the DNS delay, and not the data. As above, make an exact copy of the website’s files on the new host. Then configure the new host to access the database still residing on the old host (which may require some firewall configuration). Then make the DNS changes and wait out the delay. Then, at a convenient time, when few people are using the website, transfer the database.

3. Change the TTL Link

An alternative is to lower the time to live for the transfer. The TTL is usually set to a day to avoid a lot of unnecessary Internet traffic, and many registrars and hosting companies do not let you change the TTL. But some do, such as Rackspace (as seen above), and this alone could be the deciding factor for your choice of a DNS.

You can change the TTL from 86,400 seconds to 300 seconds (5 minutes), and then wait a day for all name servers around the world to learn about this change. Then copy the website and database across as quickly as possible, make the DNS change, and everyone should know about it within five minutes. Then change it back to 86,400 seconds. (Some hosts, like Rackspace, do this automatically after a few days.)

Email Link

If you have to transfer email accounts along with the website, the easiest way to do this is to set up the email addresses on the new mail server (i.e. the server that stores the emails, which is usually the same as the Web server), and then change the DNS MX record (which specifies which server handles the email for the domain) on a Friday afternoon. By Monday morning, everyone will know about the change, and you can download all of your email one last time from the old mail server, change your email preferences to reflect the new mail server (and your passwords, if they have changed), and then start checking your email on the new server.

This only applies to POP accounts on which no mail is left on the server. IMAP accounts are more difficult; you’ll have to copy all of your emails off the old server first, and then reupload them to the new server. There are other more immediate methods as well, such as changing the TTL or specifying MX records for both the old and new mail servers at the same time.

Conclusion Link

The 24 to 48-hour DNS delay is caused by two main factors:

  1. The time it takes your registrar or host (or other company) to process your DNS request, which could be anywhere from a few minutes to 24 hours. Before this happens, nobody anywhere has any chance whatsoever of knowing about the change.
  2. The time it takes for your personal name server to learn about the change, which can vary from instantly to the time to live (usually 24 hours). The delay from this will be different for everyone.

Hopefully this article has given you a solid understanding of the basics. Please feel free to comment if you have anything to add or suggest.

(al) (il)

Footnotes Link

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17

↑ Back to top Tweet itShare on Facebook


Paul Tero is an experienced PHP programmer and server administrator. He developed the Stockashop ecommerce system in 2005 for Sensable Media. He now works part-time maintaining and developing Stockashop, and the rest of the time freelancing from a corner of his living room, and sleeping, eating, having fun, etc. He has also written numerous other open sourcish scripts and programs.

  1. 1

    useful, thanks.

  2. 2

    Thank you for sharing. This is very useful.

  3. 3

    Roderik van der Veer

    May 25, 2011 6:31 am

    Regarding the TTL, not all ISP adhere to the TTL provided. Telenet, one of the largest ISP in Belgium does not do low TTL. So while reducing the TTL is a very good tip, it’s not a sure fix for the delay.

  4. 4

    Bruce Sackett

    May 25, 2011 6:40 am

    Another tip – if you do change the TTL, keep in mind that the suggestion above to change it back eventually is important too. It is a very small amount of overall net traffic, afaik, but it still counts, and we can all be fair about it.

    This is a GREAT article to share with clients that are having any type of DNS issues. I often end up assisting clients with outside hosts and web design firms that just bring me in to help ease them through the angst, and I will be adding this article to my stable.

  5. 5

    Great article! As it is something fairly hard to explain to clients I will probably use this as a guide for them!

    On a sidenote I have had incredibly bad service from 123-reg regarding DNS in the past… including a 2 week propogation period :/

  6. 6

    matt parsons

    May 25, 2011 7:25 am

    wow…just what I need. Thanks for the brilliant post!

  7. 7

    Really interesting post.

  8. 8

    Very nice article…

    Minor typo in: 5. Get the IP Address, shouldn’t it say –

    “Hola” instead of “Hola”
    nslookup instead of nslookup

  9. 9

    ohh man, i could really use this article a few months ago :))
    it is really important to understand how DNS works, therefore i think this article is a must!

  10. 10

    Tracy Dryden

    May 25, 2011 8:32 am

    Outstanding article! Clear and easy to understand. I’ll be bookmarking it for reference if any of our clients have questions about DNS. Thanks!

  11. 11

    nicefull article for an messy issue. thanks for that!

    best regards

  12. 12

    I have learned this the hard way and the easy way. As a developer I dread when a client tells me they want a CMS system and then tell me they use GoDaddy. They are just too slow for the simplest of systems. A sigh of relief is shown when I see they don’t use their e-mail. Changing the NS is an easy process that way. But when they do use that as their E-Mail. Boy….that just sucks…I have found a fairly simple system that I use.

    Before I do anything I e-mail the client and explain everything to them. I let them know their e-mail may go down, there is no way around it, but that they have 2 choices.

    1. They can allow me to set them up temporary e-mails on the new host.
    2. They can have to deal with the downtime

    Depending on the choice I find as long as they are warned they seem to understand. From this point I get the MX records, add them to the new hosting, wait about 2-3 hours, then switch the NS. Last time I did this it went flawlessly. Either way, I find that the best way to avoid anything is to just hope they choose our hosting provider and we don’t have to deal with awful hosts.

    Great article, this is an incredibly annoying issue that we all have to deal with at times. Great to see that the way I’ve been doing things isn’t right or wrong and that there are many ways to deal with it.

  13. 13

    Good article. I thought I was at the end an the it just kept going with more useful information!

    Question on TTL. Is there any reason not to set your TTL really high, say 2 days to a couple weeks and then just set it back before you transfer?

  14. 14

    Nice use of the Northampon Yellow Pages! I got mine through the post the other day.

    Are you from Northampton by any chance?

  15. 15

    Windows users needn’t go online to find an alternative to the dig command.

    You can use ipconfig /displaydns on windows to view your local DNS cache.

  16. 16

    Underground Media

    May 25, 2011 12:43 pm

    You nailed this, what a great article. I will definitely share this with everyone that assumes that web development and hosting is simply a case of cut and paste.

  17. 17

    You might want to mention how users can override DNS with their local hosts file. This is very helpful in development environments.

  18. 18

    Very useful and detailed article.
    It is also useful to remind users that they can change DNS server on their local machine to speed up the process and/or avoid disruptions of their local provider.
    My article about this:

  19. 19

    Couldn’t formulate it better. It’s informative, easy to understand and yet it is complete enough to grasp the full picture! Respect for the author.

  20. 20

    Great article, thanks for the in-depth info RE: DNS. It’s always a hard thing to get your head around let alone explain to someone!


↑ Back to top