Powered By

Powered by Blogger

Minggu, 26 September 2010

Determine The DNS Query Duration [Quick Linux Tip]

There are 2 applications you can use to see which DNS is the fastest for you (Namebench and Domain Name Speed Benchmark) but for a quick way to do this (without actually setting your computer to use new DNS), you can use the following command:

x=0; server=8.8.8.8; host="yahoo.com"; queries=128; for i in `seq $queries`; do let x+=`dig @${server} $host | grep "Query time" | cut -f 4 -d " "`; done && echo "scale=3;($x/${queries})" | bc

The command uses "dig" (which you can install in Ubuntu/Debian with: sudo apt-get install dnsutils) and you can specify the server (DNS to test), host (I've used Yahoo but you can use any other website) and number of queries (the number of requests).

In the above example, 8.8.8.8 is one of the Google DNS (the other one is 8.8.4.4). You can replace it with other DNS to test their speed (like OpenDNS: 208.67.222.222 and 208.67.220.220 or your ISP DNS and so on).

For me, Google DNS was a lot faster (13.351) then OpenDNS (49.460). But then again, Google already knows almost everything about us, so should we use its DNS services too?


Thanks to Debiania for the command!

Tidak ada komentar:

Posting Komentar