Tuesday, 16 March 2010

The truth about changing DNS entries

Whenever I come across a customer wishing to change where their website is hosted, make changes to their email delivery or even transfer their domain name to another provider I hear gulps and gasps followed by 'they say my site will be down for 24-72 hours' or 'my emails will get lost in a big black hole somewhere.'

This does not have to be the case..

What is DNS? DNS is like a big online directory of all internet domain names. This directory holds all of the necessary details that 'the audience/viewing public' need to know to find your web page. All web pages are stored on a server somewhere connected to the Internet. Whether it is in a datacentre or someone's home or office. Each server will have its own Internet Address (IP Address) - a little like you have a home telephone number unique to you.

When you make a change to a DNS entry a record is being updated with a new Internet address - usually when you have changed over to another server. When the update is made people will either see the old address or the new address presented over the next 24-72 hours. Think of this similar to mail redirection. When you move house you go to the post office and redirect mail to a new address - your post will either arrive to your old or new address - not disappear in to a black hole!

So as long as you do not cancel your account or delete files from your old server, some traffic will go there and new traffic will arrive at the new server and voila - no server downtime!

The same applies with email delivery. An MX record can point to any destination and you can specify more than one MX record. An MX record points somewhere so as long as the old system is kept running during the transition then it can be logged in to and mail received.

Why is there a delay after DNS entries are updated?

The DNS servers do present the correct and current IP address when queried but often to improve performance the IP address returned by this request is remembered often by your Internet Provider and possibly again by your in house company server and often for a 24 hour period. This means that you visit the site 23 hours later and your Internet provider still remembers the old IP address and then your office server then decides to remember that DNS entry for a further 24 hours. Because your office server knows the results and although the Internet provider obtains the correct information an hour later you will continue to point towards the older system for a further 23 hours.

More advanced DNS entries can be preset with TTL (time to live) information and this information is passed on to DNS caches. For example, a large site may have multiple web servers and wish to rotate traffic between them (load balance). A shorter TTL value allows the DNS information to be requested more frequently but allows rotation of addresses presented. This creates a bigger load on the DNS servers as data is requested more frequently. Most businesses usually opt for more basic DNS settings and the 24 hour defaults are used as standard.