A DNS server resolves domain names into IP addresses. So when you request “yahoo.com” for example, the DNS server finds out the address for the domain, and sends your request the right way.You can run a DNS cache on your computer or network. This will speed up the process of looking up domain names when browsing. The difference is about 30-60 ms. Multiply that difference by the number of websites you visit a day for an approximate estimate of the speed improvement. This can be used to speed up any computer on your network, even an iPhone, iPod, or iPad, if they connect through the router, and you specify the local dns cache in the router that is. But Mac, Windows, and Linux computers can also be told manually to connect to the DNS.
One of the best ways to speed up internet browsing and such is to create a DNS caching server. Now I am a linux administrator, and am familiar with debian based Linux's, specifically my favorite Ubuntu. I tested the query times using a command called "dig" which times only DNS query times. It can be used on Unix based OSes, such as Mac and Linux. I tested from the Company Mac, so it shows as Carlos Navarro, when that's not my name. See below the difference yourself between the first and second queries. The result is dramatic.
Carlos-Navarros-MacBook-Pro:~ carlosnavarro$ dig google.com
; <<>> DiG 9.6.0-APPLE-P2 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46162
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 4, ADDITIONAL: 0
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 300 IN A 74.125.73.106
google.com. 300 IN A 74.125.73.147
google.com. 300 IN A 74.125.73.99
google.com. 300 IN A 74.125.73.103
google.com. 300 IN A 74.125.73.104
google.com. 300 IN A 74.125.73.105
;; AUTHORITY SECTION:
google.com. 93279 IN NS ns2.google.com.
google.com. 93279 IN NS ns4.google.com.
google.com. 93279 IN NS ns1.google.com.
google.com. 93279 IN NS ns3.google.com.
;; Query time: 43 msec
;; SERVER: 192.168.5.1#53(192.168.5.1)
;; WHEN: Mon Sep 19 12:29:23 2011
;; MSG SIZE rcvd: 196
Carlos-Navarros-MacBook-Pro:~ carlosnavarro$ dig google.com
; <<>> DiG 9.6.0-APPLE-P2 <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53783
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 4, ADDITIONAL: 0
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 207 IN A 74.125.73.105
google.com. 207 IN A 74.125.73.106
google.com. 207 IN A 74.125.73.147
google.com. 207 IN A 74.125.73.99
google.com. 207 IN A 74.125.73.103
google.com. 207 IN A 74.125.73.104
;; AUTHORITY SECTION:
google.com. 93186 IN NS ns4.google.com.
google.com. 93186 IN NS ns3.google.com.
google.com. 93186 IN NS ns1.google.com.
google.com. 93186 IN NS ns2.google.com.
;; Query time: 1 msec
;; SERVER: 192.168.5.1#53(192.168.5.1)
;; WHEN: Mon Sep 19 12:30:56 2011
;; MSG SIZE rcvd: 196
Now there are two ways I know of to create a local DNS caching server. One is on a router flashed with DD-WRT firmware (simply go to Router Database | www.dd-wrt.com and see if yours is supported), or build a low-end PC, (or find one tossed on the side of the street as I did) and throw Linux on it. The PC doesn't need much, I have used an old Pentium 3 Machine with 128MB of RAM to do the job (which is far more than you need. I have a buddy that made a media server out of the original Xbox).
To install DD-WRT on a supported router look up the wiki for your router (I prefer the Netgear WNDR3700 aka Netgear N600, it's what I use). Then DNSmasq is already installed on the router so all you have to do is enable it under the services tab.
then
1) SSH into your router and run cat /tmp/resolv.dnsmasq . Save the IP addresses listed somewhere in case you want to revert back
2) Go to the Commands tab under Administration
3) In the Commands box paste the following (I use openDNS, feel free to use whatever servers you like):
echo "nameserver 208.67.222.222
nameserver 208.67.220.220" > /tmp/resolv.dnsmasq
sleep 1
killall -HUP dnsmasq
4) Click Save Firewall (note: your WAN interface will be restarted)
For a Ubuntu linux machine, (similar steps on debian):
Installing Bind9
sudo apt-get install bind9
ConfiguringBIND9
BIND9Configuration files are stored in:
/etc/bind/
Themain configuration is stored in the following files:
/etc/bind/named.conf
/etc/bind/named.conf.options
/etc/bind/named.conf.local
CachingServer configuration
The default configuration is setup to act as a caching server.
All that is required is simply adding the IP numbers of your ISP's DNSservers.
Simply uncomment and edit the following in /etc/bind/named.conf.options (once again I set it to OpenDNS):
[...]
forwarders {
208.67.222.222;
208.67.220.220;
};
[...]
Youmust also edit the /etc/resolv.conf configuration file of all machines on your LAN (including the DNS server itself) topoint to your new DNS server. Open this file
vi/etc/resolv.conf
and add
nameserver xxx.xxx.xxx.xxx
to the top of the file where xxx.xxx.xxx.xxx isthe IP address of your new DNS server. When configuring the DNS server itself, change the nameserver address to 127.0.0.1,which points to localhost.You may delete any additional nameserver linesappearing in the resolv.conf filealthough it may be prudent to leave lines in place that point to yourISP’s DNS server so that client machines continue to function inthe event of your server going offline (just make sure your DNSserver is listed first). *On mac and Windows just simply change the DNS server, there is no resolv.conf, this is for linux only!
Now restart the bind daemon:
sudo /etc/init.d/bind9 restart
Now all that is left is to set the DNS server on the router, or each desktop to connect to the static IP you have set for your caching server. Keep in mind the BIND9 setup is only going to hold the cache of the query for 5 minutes, then dump it and then once it is queried again will cache the new result. This is to make sure the servers are always new, and reduce errors of connecting to a different IP for major sites, that use multiple IP's such as google that switches between a bunch of them.
Any questions let me know. I do this similar setup for my own company I work for.
I referenced the DD-WRT wiki for that one. and some of the Ubuntu community docs