A DNS server resolves domain names into IP addresses. So when you request “google.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 and can speed up the process of looking up domain names when browsing.
Install dnsmasq in Ubuntu
Dnsmasq is a lightweight, easy to configure, DNS forwarder and DHCP server. It is designed to provide DNS and optionally, DHCP, to a small network. It can serve the names of local machines which are not in the global DNS. The DHCP server integrates with the DNS server and allows machines with DHCP-allocated addresses to appear in the DNS with names configured either in each host or in a central configuration file. Dnsmasq supports static and dynamic DHCP leases and BOOTP for network booting of diskless machines.
First you need to make sure that Universe repository is enabled in your sources.list file
Install dnsmasq Using the following command
sudo apt-get install dnsmasq
uncomment the following line (remove “#” in the beginning) in the file /etc/dnsmasq.conf
listen-address=127.0.0.1
Now edit /etc/dhcp3/dhclient.conf and make sure the section below exactly like this, especially the line that says "prepend domain-name-servers 127.0.0.1;" as -
#supersede domain-name fugue.com home.vix.com;
prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope;
prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope;
Now open the file /etc/resolv.conf in your text editor and add "nameserver 127.0.0.1" above the all of the nameserver entries (indicated with bold)
search domainname.com
nameserver 127.0.0.1
nameserver 127.0.0.1
nameserver 217.54.170.023
nameserver 217.54.170.024
nameserver 217.54.170.026
nameserver 217.54.170.024
nameserver 217.54.170.026
Now you need to restart the dnsmasq using the following command
sudo /etc/init.d/dnsmasq restart
Now you are running a local DNS cache.
Testing Your Local DNS Cache
If you want to measure your speed improvement, type the command
dig gmail.com
You will see something like
;; Query time: 38 msec
Now type the command again, and you should see something like:
;; Query time: 2 msec
and its working fine :) . Hope this post will help you for faster browsing...
No comments:
Post a Comment