Firefox – How does firefox cache DNS requests/replies

browser-cachefirefox

I was wondering how, if it all, does firefox cache say, google.com to its respective IP?

Best Answer

It caches it short-term, but I don't know the particulars of the backend. You can see this when DNS doesn't resolve, and you use the refresh button only to find you quickly land on the Server Not Found page again; but, if you click the "Try Again" button on that page, it re-queries the DNS server. Or, if you close and reopen Firefox, the cache will have cleared.

I've found this out through pure experimentation; I've been doing quite a bit of DNS settings changes lately.

This article claims that "In Firefox, by default, the DNS requests are cached for only 1 minute." but it is dated August 2007, so things may have changed by now. (see below)

To control the cache settings, you might try the DNS Cache extension or the Clear Dns Cache extension.

You can also tweak the about:config setting network.dnsCacheExpiration to manually set the cache time; its default is 60 seconds, confirming the above article. Or network.dnsCacheEntries controls the maximum number of cache entries. You will likely need to add these settings to the about:config page yourself (New > Integer), and setting either one (or both) to 0 should disable the cache.