Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've noticed that significant amount of time is spent on initial domain DNS resolve and it works much faster after that. But hey.. 90% of websites have the same IP for many months! Is it possible to make some sort of local cache or at least to to make local cache lifetime longer?

OS:Ubuntu Broswers: Firefox & Google Chrome

share|improve this question
1  
What OS? And what web browser? Some browsers keep their own caches - Firefox can be configured to increase the size and retention size of its cache from the about:config screen. –  DMA57361 Oct 16 '10 at 16:04
    
Ubuntu, Firefox&Chrome. Thanks for the idea! –  user51940 Oct 16 '10 at 16:08

3 Answers 3

up vote 1 down vote accepted

It's fairly simple to set up a local DNS caching server. This does tend to reduce the latency when browsing the web a little. You don't even need to fiddle with IP validity durations (time-to-live): merely refreshing every few hours instead of several times per page visit is an improvement.

Under Debian, Ubuntu and derivatives, first install the resolvconf package. Resolvconf automatically handles all DNS source maintenance, so that whenever you connect to a network, the associated server is registered in /etc/resolv.conf (if you don't have a DNS caching server) or with your DNS caching server (if you have one).

Then, install a DNS caching server such as dnsmasq or pdnsd. Pdnsd is more advanced on the DNS caching front, as it can save its cache to disk whereas dnsmasq's cache doesn't survive across reboots. Pdnsd can also be configured to keep entries longer than they should be (which you do at your own risk).

share|improve this answer

I can't comment on configuring your OS, as I'm not a Linux user. But with Firefox, at least, load up about:config and look for the network.dnsCacheEntries and network.dnsCacheExpiration values.

network.dnsCacheEntries is a measure of how large Firefox's own cache will be, default is 20.

network.dnsCacheExpiration is the time-to-live of each cache entry, in seconds, default us 60.

According to the Mozilla KB neither of these values will appear by default, you'll have to add them manually if they don't exist.

share|improve this answer

For the enthusiast, you can set up your Ubuntu system as a local caching nameserver. This gives you the flexibility of setting your own expiry times, and it works across applications (not just in your Browser).

This caching nameserver guide will get you from start to finish, and it isn't very lengthy as you can see. It was updated for Ubuntu 8.04, but the steps are pretty much the same, even for the current Ubuntu release.

share|improve this answer
    
That guide is more complicated than it should be! I wouldn't recommend bind when smaller, simpler programs exist (see my answer); and installing the resolvconf package automates all the configuration (ditto). –  Gilles Oct 16 '10 at 19:32
1  
@Gilles it's not hard at all. You don't need to advertise your answer in my comments when it's a scroll away... –  John T Oct 16 '10 at 20:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.