Tag Archives: dns

What is DNS Prefetching ?

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

nscd-restart

How to Clear DNS Cache in Ubuntu 12.04

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

nscd-restart

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 –

nscd -help

How to setup Google Public DNS on Ubuntu (11.10/12.04)

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.

network-applet-ubuntu

#1. Go to Network -> Edit Network Connections

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.

google public dns

#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.

8.8.8.8, 8.8.4.4

Recommended Reading(s) and Reference(s)

network-applet-ubuntu

how to setup OpenDNS on ubuntu 11.04/10.10/10.04

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 173.193.206.153 ). 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.

network-applet-ubuntu

#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.

Network connections : open DNS

#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’.

setup-open-dns-in-ubuntu

In ‘DNS servers’ field put these I.P Addresses :

208.67.222.222,208.67.220.220

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.

How to spoof dns cache?dns cache poisoning/hacking

Spoofing DNS Cache:

DNS i.e domain name system is distributed database with a hierarchical structure used to translate the human friendly host names into the IP address,in TCP/IP Network.So when a computer wants to communicate with www.sudobits.com then it first sends a query to the local DNS server and the dns server checks its databases to find the corresponding ip address.If the local server fails then it tries to communicate with the other remote dns servers,and finally
it returns the corresponding IP address to the users computer(If there is no problem on sudobits.com servers).After this events the users computer and local dns server(if failed to resolve) updates its database so that in future it can use that ip address-host name maps without any further queries with the other dns servers.There are many available methods for spoofing the dns cache but the simple concept is to alter the corresponding map between the host name and IP address in the dns cache of the victim computer or dns server.
Two simple methods to poison the dns cache –

1. Hacker sends a dns query to the local dns and before the local dns server gets the true result fr0m the remote server,the local dns server is flooded by the fake reply(By hacker),thus the local dns cache gets spoofed.

2. In this method the hacker poison the host names by their fake website IP address,so when the user sends the request to the infected dns server,then it maps to the fake website.

dns cache spoofing and poisoning
How to protect the dns by spoofing/poisoning
Use Open DNS : It will protect you fr0m the dns cache spoofing as well as other benefits.For more info : http://www.opendns.com/
credit : CpGlobal