Speeding up Internet Surfing (Squid + BIND)

I am not writing something very much ground-breaking, but since friends do ask me how to use their slow internet lines, here is the solution: Web Proxy with Cache and DNS Caching.

You might find exhaustive articles all over the net, this one is which I made from my experience. Getting them to work is so so simple. It isn’t a rocket science as you might be thinking.

You basically need Squid to act as Web Server Proxy and Bind9 as DNS Caching.  The work of Bind9 and squid is not limited just for caching, but you might want to know that Bind powers much of world’s DNS servers. Let’s start

You first need squid and squid-common packages for squid and bind9 and dnsutils for bind.

sudo apt-get install squid bind9

squid-common and dnsutils are dependencies of the the two, so you don’t need to specify

BIND

Just open the file named.conf.options in the folder /etc/bind and change the following section

// forwarders {
// 0.0.0.0;
// }

to

forwarders {
208.67.222.222;
208.67.220.220;
};

Here the two IP addresses are those of the DNS servers (OpenDNS in this case). You can even use the IP address of your router if the latter is configured for DNS.

Now restart bind daemon

sudo /etc/init.d/bind9 restart

Bind can also be used for more than just DNS caching. It can be used for Primary Master Server, Secondary Master Server or mix of all of them. The slightly geekish HOWTO is here. It is written for  Ubuntu, but nearly same for all other distros.

Squid

When you installed squid, it has been auto-configured as a caching proxy server. You just need to point your browser’s proxy settings to it. The best way is to set up Network Proxy so that every application can use it.

System > Preferences > Network Proxy

GNOME Proxy Settings
GNOME Proxy Settings
forwarders {
208.67.222.222;

Squid uses port no 3128 as default. You can change it later.

If you want Squid just to surf the internet, then can just change the proxy settings of Firefox.

Edit > Preferences > Advanced > Network

Choose the Settings Button, set up the proxy settings similar to that shown inthe above figure.

You can check the official docs at squid for configuring squid or use this simplified doc at Ubuntu Wiki. Again, it works on all the distros.

Using squid you can customized error pages, shut down network for specified duration of time, block websites and many more.

Suggested Reading:

Advertisements