Which DNS resolver is good for you?

Which DNS resolver is better - ISP’s (default) DNS resolver, or Google Public DNS or the pioneer of DNS openDNS or even a local DNS server?

Let’s try to find out! I am sitting on a BSNL data link, and I will try to perform few tests to find that out: Available DNS resolvers to me:

  1. BSNL DNS resolvers - &
  2. Google Public DNS - &
  3. OpenDNS - &
  4. Local DNS Server - BIND running on localhost -

Observing ping time:

BSNL DNS resolver:

--- ping statistics ---

5 packets transmitted, 4 received, 20% packet loss, time 4001ms

rtt min/avg/max/mdev = 26.978/27.754/29.122/0.897 ms

--- ping statistics ---
5 packets transmitted, 4 received, 20% packet loss, time 4001ms
rtt min/avg/max/mdev = 26.978/**27.754**/29.122/0.897 ms

Google Public DNS:

--- ping statistics --- 5 packets transmitted, 
5 received, 0% packet loss, 
time 4001ms rtt min/avg/max/mdev = 121.147/121.878/122.951/0.783 ms


--- ping statistics ---

5 packets transmitted, 5 received, 0% packet loss, time 4005ms

rtt min/avg/max/mdev = 217.678/**219.528**/222.034/1.717 ms

Next, localhost? :)

Pinging local DNS server makes no sense as reply will be in less then 1ms!

Anyways, so here’s ping summary:

  1. BSNL - 28ms
  2. Google Public DNS - 122ms
  3. OpenDNS - 220ms
  4. Local DNS server - N/A

Next, we will try asking IP address of popular site facebook.com to all of these. Here’s a sample query:

;facebook.com. IN A

facebook.com. 1022 IN A
facebook.com. 1022 IN A
facebook.com. 1022 IN A

;; Query time: 28 msec
;; WHEN: Thu Jan 27 13:44:57 2011
;; MSG SIZE  rcvd: 248

We can see, BSNL resolver passed the IP almost instantly for a popular site. Popular here simply means that resolver must be having the record within it’s cache as per TTL of the zone.

Observing resolution time:

Asking for IP of facebook.com to rest of DNS servers, here’s summary:

  1. BSNL resolver took 28ms
  2. Google Public DNS took  125ms
  3. OpenDNS took 219ms
  4. Localhost took 558ms

We see a very big value from local host here. Reason, it had to find the IP via root DNS servers. In my case, this local DNS resolver used - b.gtld-servers.net (closest) to get Authoritative DNS servers of “facebook.com” and next, it asked those DNS servers for the IP of facebook.com Note: Further anymore queries to facebook.com using local DNS will take almost 0ms for next 1022 seconds as defined in DNS zone of facebook. So for a popular site - clearly BSNL DNS resolver is winner based on responce which is 5 times faster then Google Public DNS and almost 10times faster then OpenDNS. Next, we try to find how much time it takes to resolve a less popular domain - crazybeam.com (less popular = no caching of records at resolver)

Time taken by all resolvers:

  1. BSNL took 223ms
  2. Google Public DNS took 398ms
  3. OpenDNS took 487ms
  4. Local DNS server took  667ms

As we can see - BSNL resolver took quite more time here but still very low. Local DNS resolver took almost same time to resolve a less popular domain as it took to resolve a popular domain - reasons remains - no caching. So finally, here’s the summary explaining results and recommendation of which resolver to use:

  1. Google DNS is better then OpenDNS for India since OpenDNS has no mirrors in India. Closest mirror is Singapore, but actually most of data seems being routed from London. Here’s a traceroute for reference.
  2. Running a local DNS server is good if you have mid-size organization where you have atleast 1000+ users. This will help in building a decent DNS cache which will servce queries instantly apart from saving bandwidth used for DNS lookups.
  3. Local ISP DNS servers seems very good in initial testing based on very low latency values they give BUT remember - there’s a big problem associated with BSNL DNS resolvers - they do not store most of records till TTL is complete. That is - they perform very good for cached values as we can see, but they seem discarding cached records well before expiry of TTL. This makes them bit poor in performance as this does not happen with Google or openDNS at all. Hence for popular domains, Google takes ~120ms, while BSNL takes 220ms. OpenDNS remains bit slow for India.
  4. Apart from that, one of other big problems perticularly with BSNL DNS servers is - they constantly time out thus giving high packet loss, and causing “Name not found” errors.

So finally my recommendation - if you are on Indian ISP network, **it’s good to use Google Public DNS.