Using free public DNS servers

Posted by Fred C (W6BSD) on Jan 05 2013

Why choose to use a public DNS Server

The DNS is an essential part of the internet, it translates hostnames such as 0x9900.com into IP addresses 149.20.56.139. DNS also plays an important role for routing emails.

A fast and reliable DNS Service is important when surfing the web. Every time you load a complex web pages containing dozens of images and links, your web browser sends a request to translate these machine names into IP addresses, before the pages are loaded.

These big Public DNS services use a network routing mechanism called anycast to send your requests to a server close to you, lowering the latency of the responses. A DNS with a lower latency can cut your page download by a few seconds.

Some services offer filtered DNS services restricting access to pornographic and malicious web sites, offering a safer internet experience for your family. Check the DNS service website for more details on these features. Also by using a public DNS you take advantage of the cache. For popular sites, chances are that someone has made a request before you and the information that is served to you comes directly from the cache.

For all these reasons it is important that you run your own tests to choose the best based on your location and needs.

Free public DNS list

You can find the code I used to collect these data on Github
ProviderIP addressesAvg. Speed
Google 8.8.8.8, 8.8.4.40.454
OpenDNS208.67.222.222, 208.67.220.2200.301
Norton198.153.192.1, 198.153.194.10.320
Verizon4.2.2.1, 4.2.2.2, 4.2.2.3, 4.2.2.4, 4.2.2.5, 4.2.2.60.516
Level3209.244.0.3, 209.244.0.40.333
Securly184.169.143.224, 184.169.161.1550.389
Comodo Secure DNS8.26.56.26, 8.20.247.200.593
DNS Advantage156.154.70.1, 156.154.71.10.614
Norton ConnectSafe198.153.192.40, 198.153.194.400.273
OpenNIC74.207.247.4, 64.0.55.2010.631
SmartViper208.76.50.50, 208.76.51.511.586

Setting up your host.

Posix systems.

Here are the steps to configure any POSIX operating systems such as BSD like systems or Linux. Login as root and follow the instructions below.

Open the file /etc/resolv.conf and replace the IP addresses of the DNS servers by the IP addresses of the service you wish to use.

# vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

Note: If you add more than three nameserver only the first three will be used.

Home Routers

Your machine is most likely connected to the internet through a router. In that case you need to configure your router to use a public DNS.

If you are using an Apple AirPort use the AirPort Utility tool to configure the DNS servers you want to use.

  1. start AirPort Utility
  2. select the AirPort
  3. click edit
  4. click on the tab Internet
  5. enter the two IP addresses of the DNS server of your choice.

AirPort DNS configuration

To configure other routers you can go visit the great OpenDNS setup page. There you will find hundreds of different routers and how to configure them. Just replace the IP addresses from these examples with the IPs of the provider you wish to use.

Tests

You can test your configuration using the command host or dig, for example:

fred$ dig ebay.com

; <<>> DiG 9.7.6-P1 <<>> ebay.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20404
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;ebay.com.          IN  A

;; ANSWER SECTION:
ebay.com.       1405    IN  A   66.135.205.14
ebay.com.       1405    IN  A   66.211.160.87
ebay.com.       1405    IN  A   66.211.160.88
ebay.com.       1405    IN  A   66.135.205.13

;; Query time: 53 msec
;; SERVER: 8.8.4.4#53(8.8.4.4)
;; WHEN: Thu Jan  3 23:54:56 2013
;; MSG SIZE  rcvd: 90

 Network      DNS