As the name suggests, DNS Prefetching is the process of resolving domain names, in advance.
Suppose a user is reading a web page, he(or she) may or may not visit a link, referenced on that web page but if he(or she) does, the next page can be loaded a lot faster if it uses DNS prefetching – because it won’t have any delay due to DNS lookup (which may takes up few milliseconds to a second or more, depending on lots of factors such as latency and whether the result is locally cached or not).
How to implement it ?
To add DNS prefetching to your website, just add an extra link tag (in head, of course), in the following format :
<link rel="dns-prefetch" href="http://example.com">
You can also control DNS prefetching at page level, using the meta tag (off means no prefetching, change it to on to enable it) :
<meta http-equiv="x-dns-prefetch-control" content="off">
Does any browser support it ?
Mozilla Firefox and Chromium/Google Chrome certainly supports this feature (with compatible syntax, the above style works well for both browsers), I’m not sure about other browsers. (I think Safari and Opera do, but you need to make sure)
Ref : http://www.chromium.org/developers/design-documents/dns-prefetching
DNS – Domain Name System, is one of the core component of web that provides us human friendly domain names, mapped to computer friendly numeric address (called I.P (Internet Protocol) Address). Each time – when you visit a website – your computer/browser performs a DNS query (searching for IP address for the requested domain name (website you visit)).
By default, our computer cache DNS results in order to provide fast lookup in future- and that’s really good (because it’s efficient and saves a lot of resources), but some times it creates a problem specially when a domain gets new IP address(s) (or in other words, the server is changed). In such case the cached result may prevent you from viewing the latest website/app for your domain. So that’s where – flushing the DNS cache results, is mandatory.
There are various ways to clear dns cache in Ubuntu but using nscd (name service cache daemon) is very simple and straightforward (and it works with almost all – commonly used GNU/Linux distributions such as Fedora, Mint, OpenSuse etc).
Install NSCD Daemon in Ubuntu 12.04 LTS
open a terminal and execute –
sudo apt-get install nscd
Clear DNS Cache from terminal
sudo /etc/init.d/nscd restart
That’s All. If you want to know more about the features of nscd then run the command with
-help flag –
DNS i.e Domain Name System is a Naming System responsible for translating the human friendly domain names to I.P address. In most of the cases, by default – you would be using your ISP’s DNS server which may be slow or some geographical restrictions might be there. In such cases, it’s often recommended to use DNS service provided by third party such as OpenDNS (refer to article about setting up OpenDNS in Ubuntu, basically the process are same – only the I.P address of the servers are different) or the Google Public DNS, did I forget to mention that both DNS service are Free! (in general). it supports IPv4 as well as IPv6.
So, if you are not sure where to use ISP DNS server or Google Public DNS then you must know about some additional benefits of using Google Public DNS –
- Faster DNS Lookup
- Improved Security (Protection from phishing sites/domans)
- No redirection (additionally, you can also access the sites blocked from ISP DNS Provider)
Change your Internet Settings to use Google Public DNS
Although the tutorial is primarily targeted for Ubuntu users but it should also work well on similar GNU/Linux distributions such as Debian, Linux Mint, OpenSuse etc. Just follow the simple steps and enjoy faster web surfing with Google Public DNS.
#1. Go to Network -> Edit Network Connections
#2. Select your Network connection, you want to setup with Google Public DNS and click Edit. Then go to IPv4 Settings tab and select “Automatic (DHCP) addresses only ” in the Method section.
#3. Now, specify the IP address in DNS Servers field and click on SAVE. Then restart your Router to start using Google Public DNS servers.
Recommended Reading(s) and Reference(s)
What is OpenDNS ?
OpenDNS is a DNS (Domain Name Resolution, it’s basically a naming system which maps human friendly domain name (e.g sudobits.com) to I.P (Internet Protocol) address e.g 184.108.40.206 ). Each time ( if it’s not cached ) when you visit a website, your browser sends a DNS lookup query to the DNS server, most probably to your ISP DNS but you can configure your computer to use some other DNS servers such as OpenDNS for name resolution purposes, if you want. So in the end of this post you will learn how to use OpenDNS on your Ubuntu 11.04 (Natty Narwhal) or 10.10 (Maverick Meerkat) or 10.04 (Lucid Lynx) or any other Linux based operating systems such as Linux Mint, Fedora, Debian etc (Procedure is almost same).
A typical ISP (Internet Service Provider) DNS server works well in general but there are few extra advantages with OpenDNS, some of the important features are –
- Open DNS is very fast (may not be true for non US users e.g if an Indian users will use OpenDNS instead of the BSNL DNS server, then it will be slow because BSNL DNS servers usually takes 400ms to resolve an I.P address while OpenDNS would take more than 1000ms due to high latency)
- It protects you from the phishing attacks
- Content filtering features are also available which can be used to block unwanted sites
- it’s free for personal use
Setup OpenDNS on Ubuntu 11.04/10.10/10.04 in few simple steps
#1 : Right Click on Network icon -> Edit Connections.
#2 : Then click on Add button to add a network or exist the existing one (Auto eth0) but it’s better to give configure a new one so that you can use both DNS depending on the need.
#3 : Next, click on IPv4 settings and select “Automatic (DHCP) Address only” (DHCP ( Dynamic Host Configuration Protocol) servers are used to allocate I.P address(usually Dynamic I.P Address) to the users) in Method. You can check the box if you want to connect automatically when your computer starts, better leave it uncheck. Give it a human friendly name e.g ‘OpenDNS’.
In ‘DNS servers’ field put these I.P Addresses :
Finally click on Apply button to complete the OpenDNS configuration process.
#4 : Now, left click on the network icon (Top Right of the panel) and select the network (as created in above steps) by clicking on the name of the connection and wait for few seconds. That’s all.. now you are ready to enjoy the surfing with OpenDNS.