Do you think your web browser is not so fast as you expected? I decide to write a series of articles to support you speeding up your network. Follow me to tune your settings and get joys surfing the net!
This article is written on Linux, especially I am using Ubuntu 9.04, but I will try to mention notices for other distributions and platforms.
This is the first peice in ‘Boosting network for your PC’, the topic is DNS settings. One question, does your ISP ship low quality DNS service?
At first place, I recommend you to use OpenDNS, whose slogan is ‘Safer, Faster and Smarter’. Let me tell the reason why to turn form your ISP’s service to this one. OpenDNS is a free service, and there is many features other providers cannot give you, such as a smarter site guide, spell checking, and smart cache to keep your query while the requested site’s name server is not working properly, phishing and malware site bloking … Somebody might say we can use client-based tools to do most of them, but do you think it’s a better way to keep the annoyance away from the source? There is more features provided and I haven’t listed one by one, but it worth a try.
It is not difficult to turn to OpenDNS, set main DNS server to 22.214.171.124 and backup server to 126.96.36.199 on your PC’s connection setting or on your router. Generally we can change it in resolv.conf on a Linux machine, but GNOME users should do it on network-manager if you use it because it will rewrite resolv.conf automatically. For those who use xDSL, edit your DSL setting, you can find IPv4 option tab, change the method to PPPoE Address Only, and input the two DNS server addresses in order “main, backup”.
If you have a static IP address, then you should register on https://www.opendns.com, add your network’s IP address to your dashboard, then set your own settings for content filtering, enable the SmartCache, block internal IP addresses to avoid DNS Rebinding Attacks, thus these features are not enabled or can be customized. If you use a dynamic IP address, for example, you are a xDSL user, don’t worry about you cannot have your own account and your custom settings. All you need to do more is install a client to update your address to OpenDNS’s server, and enable the dynamic update feature in you dashboard. On Windows and Mac, they provide their client programs, you can just install can configure it easily according to the guide; on Linux/Unix, you can use ‘ddclient’ which is a free software, you can download it from its homepage on http://ddclient.sourceforge.net, or you may find it just lying in your distribution’s repository. I recommend you to install it as a service, or called daemon. Here is a example for what I have done on my Ubuntu box:
1. Install ddclient using apt, or synaptic, or whatever package manager you like, here is what I ran in a terminal:
sudo aptitude install ddclient
You don’t need to care about what you have chosen on the debconf interface, soon we’ll chage the configuration file.
2. Configure ddclient via editing its configuration file, use whatever editor you like to edit /etc/ddclient.conf first, for example I run this command:
sudo vi /etc/ddclient.conf
Then make your file look like this:
The first line without # at its start intends to tell ddclient refresh information to the server every 600 seconds if it is running as a daemon. This section is not needed for Ubuntu user in fact, because it is configured in the other file we’ll look at, just a note here for others who many use it. I think 600 is a suitable value for most network, or you can adjust it to meet your actual needs. Update the information too frequently is a waste of resource, having a too long interval time may let your service not working so properly sometimes.
The second line intends to make every update logged at syslog, you can delete this line if you don’t want to.
The third line is for turning on ssl support, in other word we can transfer our account information using an encrypted route.
The forth line is the PID file path, don’t change it unless you know what your are doing exactly.
The fifth line tells what protocal you use, OpenDNS requires dyndns2 protocal.
The sixth line is the way you get your current IP address for transferring to the server, the defaut value was “use=if, if=”, than means you can set a net interface such as eth0 here and ddclient will send eth0’s address. When we are using PPPoE or other virtual connection protocal, this configure may be damnned, so we set it using web to check you real IP, whatismyip.com is the host provide such service, you can change it to something you like, but I think copy-and-paste this line to your configuration is the best choice.
The next three lines is the information about the server and your account, you should copy the server address, and fill in your account name and password there. Don’t worry about your account’s security here, the ddclient.conf is only accessable for root user by default, and we have chosen to use ssl at the begging of this configuration.
The last line is the LABLE you have set in your dashboard, they are something might be Home, Office, etc.
Next, we should enable daemon mode for ddclient, edit /etc/default/ddclient.conf with root privilege:
sudo vi /etc/default/ddclient.conf
Make sure the following lines are just look like what have shown below:
The first line is whether ddclient does an update while a new ppp conection is establed, this is useful for those who use a xDSL, or other dial-on-demand connections.
The second line is whether ddclient run as a daemon, we change it to true here. Only run as a daemon, it can perform the set actions automaticlly.
The last line is how long should it takes from one update to another, I was explained before in the first line of previous configuration file.
3. Restart ddclient to make everything into effect.
sudo /etc/init.d/ddclient restart
We have finished configuring OpenDNS till here, visit https://www.opendns.com/welcome/ to check!
Second, use DNS cache to speed up the look up action. This is for Linux/Unix users, I don’t know if there is any good replacement for other platforms. I introduce dnsmasq here to do this task.
1. Install dnsmasq, you can find it in main aspect of distributions‘ repository.
For Ubuntu, perform the following action:
sudo aptitude install dnsmasq
2. Edit /etc/dnsmasq.conf to fit our use:
sudo vi /etc/dnsmasq.conf
And make sure the following line is uncommented:
You can choose to change other settings if you are interested in the file, there is enough comments for you to know what every options sense, but leave it there is a good solution.
3. Restart dnsmasq
sudo /etc/init.d/dnsmasq restart
4. Add 127.0.0.1 to you DNS list. We can edit resolv.conf to make that line at first of ns servers, or change in network-manager.
5. Restart networking, you don’t need to restart your computer.
sudo /etc/init.d/networking restart
So close and re-open your web browser, do you feel web pages load faster?
Third, tune your firefox(if you use it). Input about:config in your firefox location bar, filter the following items and change their values to ‘true’:
And change the following item’s value to 8 or 10:
Add these items to the list via right click and choose ‘Add -> Interger’, note to set the value according to the last number listed below:
If you don’t have IPv6 connection, also change this item’s value to ‘true’:
Restart your firefox will make it effect.
In Ubuntu 9.04, the IPv6 support was built in kernel, if you compile kernel by yourself, you can uncheck this feature if you don’t need it.