[PROBLEM]

Open a tab in Chromium web browser and enter the url "elpais.com" (Spanish newspaper). Capture the number of DNS requests with Wireshark. 20 requests for loading the main page. Measure the time of response for a DNS petition to your ISP's DNS server:

inedit@tpad:~$ dig elpais.com @80.58.61.250 | grep Query  
;; Query time: 55 msec

55 milliseconds. If all 20 requests done for loading elpais.com take exactly the same time we need about 55*20=1100ms or 1.1 seconds just waiting for the domain name resolution. If we repeat the same process again in a new tab, another 20 request will be done. I don't know you, but I have better stuff to do than wait.

[SOLUTION]

Easy solution? Caching the DNS responses.

We'll install pdnsd and we will use it as caching DNS.

$ sudo aptitude install pdnsd

During the install a configuration popup will appear asking for the type of configuration. We'll choose the option "Use resolv.conf".

We can chech if the service is up and running just by executing:

$ sudo netstat -tpan | grep pdnsd

tcp        0      0 127.0.0.1:53            0.0.0.0:*              
LISTEN      7143/pdnsd

And we can test that this configuration is working just by executing the follow command. This command make a DNS petition of the domain "4chan.org" to the DNS server located in localhost(127.0.0.1). The result is the response time. As we could expect the first petition needs 706ms because we don't have it cached, but the second petition needs zero miliseconds because is already cached.

inedit@tpad:~$ dig 4chan.org  @127.0.0.1 | grep Query  
;; Query time: 706 msec  
inedit@tpad:~$ dig 4chan.org  @127.0.0.1 | grep Query  
;; Query time: 0 msec

Now we just have to tell to the operating system to use our local DNS instead of the ISP's DNS. We can do that just by editing the file /etc/resolv.conf  (that is autogenerated file with the information that comes from the DHCP process). I've edited the file from:

inedit@tpad:~$ cat /etc/resolv.conf  
# Generated by NetworkManager  
nameserver 80.58.61.250  
nameserver 80.58.61.254

To:

inedit@tpad:~$ cat /etc/resolv.conf  
# Generated by NetworkManager  
#nameserver 80.58.61.250  
#nameserver 80.58.61.254  
nameserver 127.0.0.1

And this is it. All the DNS petitions are cached.

Note/Disclaimer: Every time you reboot you machine or just swtich on/off you wifi device, new DHCP petitions will be made to your router, and the information of /etc/resolv.conf will be overwritten. Is you responsability to configure the network-manager or modify the file  /etc/network/interfaces in order to configure /etc/resolv.conf pointing to localhost. It's easy, don't worry about that, and as soon as I end up with a solution for this problem, I'll post it (it's just that I'm not really interested right now on rebooting my laptop and do all the testing stuff. I'ts boring )

Edit: If you want to automatically configure the /etc/resolv.conf after reboot just follow this steps:

echo '#! /bin/sh' | sudo tee -a /etc/network/if-up.d/90resolv

echo 'echo "nameserver 127.0.0.1" > /etc/resolv.conf' | sudo tee -a
/etc/network/if-up.d/90resolv

sudo chmod u+x /etc/resolv.conf

And we are done ;)