Sunday, November 16, 2008

Custom Domains, DNS, And Time To Live

Custom domains, to the typical blogger, should be incredibly simple to setup. Functionally, the setup process is two simple steps.

  • Create a DNS entry for the URL of your choice, pointing to Google.
  • Publish the blog to the URL.
But for all of that simplicity, they are seemingly random in their failures.

Why are custom domains so apparently randomly unreliable?

One example, where we can see random behaviour, is in surgical DNS changes. One of the recent causes of the flood of
Another blog is already hosted at this address.
and
Server Not Found

Error 404
is a reference to a DNS server that isn't in service any more.

Many bloggers, lately, complain of the "Server Not Found Error 404" symptom. I'll look at an HTTP Access Log for the domain, and see
Host IP address = 66.249.81.121
followed by
<h1>Server·Not·Found</h1>(LF)
<h2>Error·404< /h2>(LF)
Next, I look at an excerpted Dig log for the domain, and see

mydomain.com. 3600 IN A 64.233.179.121
mydomain.com. 3600 IN A 66.249.81.121
mydomain.com. 3600 IN A 72.14.207.121
www.mydomain.com. 3600 IN CNAME ghs.google.com.

And the obvious (to me, anyway) advice is
Remove the entry for "66.249.81.121", then republish the blog to the domain.
For all the obvious nature of the problem, the results are just not consistent.
  • Sometimes, I see an immediate reply
    Yay. You're awesome. Thanks. I'll remember you next time I have a problem.
  • Other times, a different answer
    OK, great. Now, I get "Another blog is already hosted at this address." Thanks a lot!
    What is up with that?
The latter result possibly results from one basic mistake, ignoring Time To Live.

The Time To Live (aka "TTL") is a caching factor. A DNS entry with a TTL of 3600 seconds, or 1 hour, requires the local ("non authoritative") DNS server, holding that entry, to keep it in its cache for at least 1 hour.
  • If asked for the IP address of the domain within that hour, the server will re issue the address in cache.
  • If asked for the IP address after that hour has passed, the server will re query the distant ("authoritative") DNS server, for that domain, for a fresh IP address.


If you make a change to the domain DNS setup, maybe remove the entry for "66.249.81.121", then immediately try to republish the blog to the domain, you're asking the Google "server" to ask it's local (non authoritative) DNS server for the domain address. Now TTL becomes relevant.
  • If the DNS entry for "mydomain.com" has been sitting in cache, on the Google (non authoritative) DNS server for over an hour, the server will get a fresh entry from the authoritative server. With "64.233.179.121" or "72.14.207.121" provided by the DNS server, the re publishing script should run successfully, and you'll see "Settings Were Saved Successfully".
  • If the DNS entry for "mydomain.com" was just acquired by the Google DNS server within the past hour, it's going to re issue what it has in cache, and the entry for "66.249.81.121" gets passed back yet again to the Google "server" that's processing the blog republishing. And you're going to see "Another blog is already hosted at this address".


You want to remember an additional detail, and one that's very important. Just because you made the DNS change, maybe refreshed your local DNS cache, and now are able to ping your domain, you're still not guaranteed "Settings Were Saved Successfully" from Blogger.

C:\>ping mydomain.com

Pinging mydomain.com [64.233.179.121] with 32 bytes of data:

Reply from 64.233.179.121: bytes=32 time=221ms TTL=243
Reply from 64.233.179.121: bytes=32 time=212ms TTL=243
Reply from 64.233.179.121: bytes=32 time=204ms TTL=243
Reply from 64.233.179.121: bytes=32 time=208ms TTL=243

Ping statistics for 64.233.179.121:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 204ms, Maximum = 221ms, Average = 211ms

That says that your computer, and maybe your non authoritative DNS server, is getting the right DNS address ("64.233.179.121") from the authoritative DNS server for "mydomain.com". You get DNS information from a server that's local to you. Google gets DNS information from a server that's local to them. Your local DNS server won't be the same as Google's local DNS server.

Even with both your local DNS server, and the Google local DNS server, having the same IP addresses for your domain, they will probably get that information at different time. The cache on one server will expire sooner than the cache on the other. Some time later, the cache on one will expire sooner, and that server will be required to refresh itself. Now the cache on the two servers will possibly be different.

If the DNS entry for "mydomain.com" on the Google non authoritative DNS server is newer than 1 hour, and you try re publishing the blog immediately, the Google "server" will get "66.249.81.121" - and you're still going to see "Another blog is already hosted at this address".

This is one cause of the random nature of the re publishing effort.
Yay. You're awesome. Thanks. I'll remember you next time I have a problem.
or
OK, great. Now, I get "Another blog is already hosted at this address." Thanks a lot!
We simply can't predict which response we'll get, for any problem report, if we don't allow for TTL.

The proper answer, for a TTL of 3600, is
Remove the entry for "66.249.81.121", wait 1 hour, then republish the blog to the domain.
That won't eliminate all observances of "Another blog is already hosted at this address", but it should increase observances of "Settings Were Saved Successfully" to some degree.

And note yet one more caveat - a TTL of "3600" (1 hour) is normal, but some DNS providers have been seen to use a TTL of "86400" (1 day). This is possibly the motivation for the Blogger "In Transition" period for new custom domain setups created by "Buy A Domain".

Also, it's likely that there are as many registrars that use "14400" (3 hours) as use "3600" (1 hour) for default TTL. If your registrar uses "14400" as a default, and you're reading here for advice, use "14400" for your DNS addresses. But remember to wait 3 hours, after making changes!

>> Top

1 comments:

WLC said...

I don't yet know if this will help me fix the problem, but I wanted to say thank you for posting this. You have a good communication style.

Wish me luck! WLC.

Post a Comment

Welcome to Nitecruzr Dot Net, and The Real Blogger Status. If this is your first visit here, please help me to help you, and read my commenting policy.

You can request technical assistance here - but you'll get better help in Blogger Help Forum, or in my personal forum Nitecruzr Dot Net - Blogging, where you benefit from peer support.

Do not post your email address in the body of your comment, unless you wish for it to be visible to the world.

Note if you wish to leave a comment, you'll have to enable third party cookies.