Faster Browsing on Ubuntu [1130]

One of the best things with Ubuntu or any flavour of Linux is that you can basically make it do whatever you want it to as long as you put the time and effort in. There was a recurring argument a couple of years ago between myself and a close friend regarding running a Squid cache server on a clients linux server. I had always argued that you know running a centralised Squid server is really dependent on a lot of traffic going through it on a regular basis to build up the cache reserve to make it a useful investment.

 

However it didn’t matter how much I argued it was never changed, and we just had to put up with it. On a couple occasions I have seen a Squid server slow down the browsing speed on local machines however I have now tested this rigorously on a server within my own personal network to see if it is a worthwhile investment of time and what I found out was that yes for a larger scale distribution this works. You have a lot more traffic going through the server for the Squid system to capture and therefore a much greater amount of data that can be used for calls after the capture time.

 

Now what I did find out is that instead of caching the pages you access, why not just reduce the resolution time and therefore cut down on at least one of the lengthy time variables it takes to launch a page in your own browser.

 

To be able to do this on Linux you will need to get dnsmasq installed.

 

  • sudo apt-get install dnsmasq

 

Then you will need to configure dnsmasq correctly. The most easiest way to do this will be using the terminal and your favourite editor. My command would look something like this:

 

  • sudo nano /etc/dnsmasq.conf

 

You will then need to find the line which says “#listen-address=”. You will need to remove the ‘#’ and add “127.0.0.1” after the ‘=’ to set this variable up correctly. Now make sure you save the changes and exit from the editor you have been using.

 

Now that that is done you will want to open up the dhclient.conf file “sudo nano /etc/dhcp3/dhclient.conf and add in the line “prepend domain-name-servers 127.0.0.1;” to the file to make your other changes work.

 

Next is the changes to your resolv.conf file which you may need to change and you will need to add in an additional line at the top of the file. This line should be nameserver 127.0.0.1, after you have added this line in you will need to save the file and exit out of your editor again.

 

After doing this you will need to restart two services, firstly restart your networking and after that restart dnsmasq to put the new config into use.

 

After you have done this you should have a nice little dnsmasq setup on your own computer caching the name queries removing the time it takes to resolve the name. You should be able to notice a different in which the pages load however please note that this does not “speed up your connection”, your connection, download and upload will all be the same. Just the method in which the pages are resolved.

 

As for seeing that this works, you can quickly test this in the terminal by “digging” a domain and after the initial time you do the request. Further ones should show a “Query Time” of 0ms.