Super Fast Internet for Ubuntu

Local DNS Cache for Faster Browsing

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. This will speed up the process of looking up domain names when browsing. The difference is about 30-60 ms for me. Multiply that difference by the number of websites you visit a day for an approximate estimate of the speed improvement. Of course, all this would be worth it if it weren’t for the fact that setting this up is way too easy.

The following instructions are for someone with a cable (broadband) internet connection, where the computer gets it’s local IP address using DHCP from the router in your house/office:

The package we will be using for caching nameserver lookups is called dnsmasq. So first, install it using:

$sudo apt-get install dnsmasq

(If you can’t find then, then you probably haven’t added the Universe repository to your list of repositories.)

No uncomment the following line (that is edit the line to NOT have a “#” in the beginning) in the file


Now edit

and make sure the section below exactly like this, especially the line that says “prepend domain-name-servers;”

#supersede domain-name "fugue.com home.vix.com";
prepend domain-name-servers;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, host-name,
netbios-name-servers, netbios-scope;

Explanation for the above change: In the normal case, when you get a new dhcp lease, the dhcp3 client (tool) on your computer gets a new lease, and updates the

file on your computer with the right values for the DNS servers to use (usually some machine in the network of your hosting provider). Adding the “prepend” option as we did above ensures that “″ will appear on the top of the list of DNS servers. That magic number refers to your own computer. So in the future, whenever your computer needs to resolve a domain name, it will forward that request to dnsmasq (which is running at – your computer). If the details for the domain name are already in you cache, well and good, dnsmasq will serve it up and make the process real fast. If it is not in the cache, then dnsmasq will look at the

file and use the nameservers listed below the “″. I hope that explains things.

Now open the file /etc/resolv.conf in your text editor. It probably looks like:

search yourisp.com

The is missing right now since you haven’t renewed your lease after you edited the /etc/dhcp3/dhclient.conf file. So, let us add that in manually this one time. After you do, your /etc/resolv.conf file will look like the following:

search yourisp.com

Don’t worry if the numbers are different – if they are not, then hey – we must be neighbours ;)

Okay. We are almost done here. All we have to do now is to restart dnsmasq so that the changes we made to the configuration file take effect. You can do that using the command:
$sudo /etc/init.d/dnsmasq restart

Now you are running a local DNS cache. If you want to measure your speed improvement, type the command:
$dig google.com

You will see something like “;; Query time: 38 msec” there.
Now type the command again, and you should see something like:”;; Query time: 2 msec”

See, the first time, since google.com’s details were not in your cache (you are using it for the first time), the query took 38 ms. The second time, the cache speeds up the lookup. I have been using this for over a month now, and haven’t had a problem.

The following is ONLY for dsl customers
Note: If you have a dsl connection, the following may work:
Basically, the differences are in how the “conf” files are edited and used.
Copy the /etc/resolv.conf file to /etc/resolv.dnsmasq.conf
Then, edit the /etc/dnsmasq.conf file as follows:

# Change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf

You also have to uncomment the line that says

Now, edit /etc/resolv.conf to have ONLY the following line in it:

Next, edit /etc/ppp/peers/dsl-provider and change the line:
usepeerdns to

(that is, comment out that line)
The ppp client does not allow you to prepend the entry to your
/etc/resolv.conf file
So what we did in the above was to create a copy of your previous resolv.conf for dnsmasq to use for lookups, update the file to use a local cache, and then prevent the ppp client from overwriting the resolv.conf file the next time. Now you can restart the dnsmasq service as I explained above, and start enjoying faster name resolution.
I don’t have a dsl connection, and so all the above is to the best of my knowledge.

4 komentar :

boenglon mengatakan... [Reply to comment]


azmi mengatakan... [Reply to comment]

mantapz gan, meskipun gak ngerti inggris, tapi coba-coba juga bisa. lebih cepat emang jadinya. tapi apa gak banyak sampah nanti hdnya?.

Gege Dai mengatakan... [Reply to comment]

ray ban glasses
hollister clothing
oakley sunglasses outlet
nike tn pas cher
kate spade uk
true religion jeans
cheap oakleys
michael kors handbag
ed hardy clothing
nike tn
toms shoes outlet
snapback hats wholesale
ralph lauren uk
tory burch shoes
soccer jerseys
burberry outlet online
coach outlet online
replica watches
michael kors uk
pandora jewelry
toms outlet
gucci outlet
oakley sunglasses discount
kate spade bags
coach outlet
ray bans
ralph lauren
jordan pas cher
chaussure louboutin
air max 90
christian louboutin outlet
coach outlet online
michael kors bag
oakley sunglasses wholesale
fitflops outlet
mcm outlet
oakley sunglasses outlet
coach factory outlet
burberry outlet
chanel online shop

chenlina mengatakan... [Reply to comment]

ralph lauren outlet
true religion jeans
michael kors outlet
michael kors
coach outlet
replica rolex watches
michael kors outlet online
michael kors outlet
air max 95
toms promo code
coach outlet
louis vuitton outlet
michael kors outlet online
kobe bryant shoes 2015
michael kors handbags
hollister,hollister co,hollister jeans,hollister.com,hollister ca,hollister clothing
ed hardy clothing
michael kors outlet online
louis vuitton
toms wedges,toms.com,toms promo code,toms shoes outlet,toms canada,toms shoes sale
adidas uk
pandara jewelry
true religion jeans
michael kors handbags
tory burch outlet
polo ralph lauren uk
coach outlet
ray ban sunglasses
coach outlet
hollister uk
christian louboutin outlet
michael kors outlet
football shoes
coach outlet online
jordan 3s
toms shoes
oakley sunglasses sale
oakley sunglasses

Posting Komentar

Silahkan tinggalkan komentar anda disini...

Ujie Caprone | © 2011 Blogger Template by Ujiecaprone.com