55

I was too quick about visiting a site I set up on a customer server, and Firefox now remembers, that the default site for (example)

testsite.mycompanyname.com (non existing subdomain, same as *.mycompanyname.com)

is

www.mycompanyname.dk - or rather the IP of the default server

I have then later set up the public DNS (a-record) to redirect to another server, but Firefox remembers the default IP adress.

Chrome/IE/Safari - no problem, as they have not visited that site before DNS kicked in...

I have set these in about:config:

network.dns.disablePrefetch = true
network.dnsCacheExpiration = 0

Anything else?

I really need firebug to debug the frontend on that site....

Cheers

4
  • Ahhh.... stupid me.... did try that, but ticked everything off but the websitespecific settings, as I wanted to keep cookies/history for everything else......did not notice the cache one. All clear now. Add answer if you want accept of answer Commented Oct 25, 2012 at 7:25
  • If you've edited the DNS settings locally and the result in the browser doesn't correspond to the result from nslookup, make sure that you've changed the DNS settings in the right place. In my case, I was connected to the Internet through a PPPoE connection, the wireless router was in bridge mode, I've set the DNS servers in the wireless connection settings, nslookup started to use new servers, but the browser ignored them and continued to use the DNS from the ISP until I changed the DNS servers in the PPPoE connection settings. Commented May 29, 2017 at 9:23
  • btw, Firefox doesn't cache DNS resolutions to disk, and there's a menu to inspect the in-memory cache: support.mozilla.org/en-US/questions/1258756 Commented Dec 25, 2020 at 18:16
  • You can clear the cache in Firefox here: about:networking#dns Commented Dec 16, 2021 at 8:25

5 Answers 5

77

DNS caching occurs at multiple levels: Application asks local system, which asks locally configured resolving DNS server, which asks authoritative DNS servers.

Caching by Application varies.

  • I've found for Firefox that quitting and restarting works. The relevant settings in about:config are network.dnsCacheEntries and network.dnsCacheExpiration, which can be set to 0 in order to disable caching.

Caching by local system is typically 1 hour.

  • Diagnostic: ping, like other applications, uses local system DNS cache
  • Flush MacOsX 10.8: sudo killall -HUP mDNSResponder (reference)
    (May vary for other versions)
  • Flush Windows: ipconfig /flushdns (only if the DNS caching service, HKLM\SYSTEM\CurrentControlSet\Services\Dnscache, is enabled; check with net start|findstr /i dns or compmgmt.msc)
  • Linux/Unix may use nscd (name services caching daemon), or dnsmasq, or both ...

Caching by local resolving DNS server may run to several days, depending on TTL associated with DNS record.

  • Diagnostic: nslookup first reports address of resolving server, then address requested.
  • Flush BIND: rndc flush or rndc flushname DOMAIN.NAME

TTL stands for "time to live" a term used to describe how long a DNS record is to be deemed valid by the requesting client or server. A short TTL means that the requester is told not to cache a DNS lookup for too long. The TTL can range from mere seconds (e.g. for DynDNS and similar) to days or weeks.

Sign up to request clarification or add additional context in comments.

3 Comments

Just closing and opening Firefox helped for me, thanks
@jaywink: not useful. Sure it may help, but if that's the cure, I'd rather move on to another browser.
As of at least Firefox Quantum 69.0, there is now an option to use DNS over HTTPS. If this is enabled, it will override any cache flushing you do on your system, any cache flushing you do in Firefox, & any settings you change in about:config. Option > General > Network Settings > Enable DNS over HTTPS.
24

I've been using the "Clear Recent History\cache" solution for a while now, but I've noticed that it stopped working after one of firefox updates (probably 20.0.1). Because of that I've switched to https://addons.mozilla.org/en-US/firefox/addon/dns-cache/ add-on to do the DNS clearing. I hope this will help someone with the same problem.

Edit: Changed the url as suggested by Haozhun.

Edit2: Unfortunately as of FireFox 32, this plugin is no longer compatible and cannot be used. Possibly https://addons.mozilla.org/en-US/firefox/addon/dns-flusher/ might be able to replace it.

7 Comments

I've also tried “Clear Recent History” → “☑ Cache”, and I can confirm that Firefox 20.0 fails to actually respond with regard to DNS. I flush all caches along the way (refresh OpenDNS CacheCheck, restart dnsmasq on my OpenWrt router), and I know for sure that the correct DNS resolution has propagated all the way to the last hop, because dig [hostname] returns the correct answer. I'm pretty sure it used to work, so maybe it's a regression, or just another ‘good idea’ from Mozilla. Either way – one should not need an addon to flush DNS.
P.s. Thanks for finding the addon, but I do hope that there is a built-in way of flushing the DNS cache in Firefox 20.0 and above.
Thank you for sharing an up-to-date solution. Can you please substitute pl with en-US in the url you provided? I believe such a modification would be helpful.
Clearing just "cache" flushed DNS for me, so this may be the best solution again. Of course, we're on version 42 now.
DNS Flusher is not compatible w/ Firefox Quantum
|
6

Install the addon DNS Flusher, which works for me.

3 Comments

@user1981275 Actually it does provide a work around for the problem mentioned in the question, so I see no reason to delete it.
It's a little ridiculous that we have to install an Add-On just to flush the DNS cache.. The clear cache function should do that.. :(
@JamesTheAwesomeDude: disable the FF-internal DNS cache by setting network.dnsCacheExpiration=0 ... I am unsure whether this helps with my issue, but so far I didn't encounter it again.
6

I found that network.dnsCacheExpiration = 0 alone did not quite do the trick, but if you also set network.dnsCacheEntries = 0 then the DNS cache gets disabled for good. So:

network.dnsCacheEntries = 0
network.dnsCacheExpiration = 0

2 Comments

can I know where to put or set this value ? Is it in my front end code or in browser ?
@bathulahmahir in the browser, specifically about:config
5

The following methods, which worked at some point, do not work presently (doing all of them doesn't work):

  • Restarting the browser
  • Clearing the browser cache
  • Setting network.dnsCacheExpiration=0
  • ipconfig /flushdns

However, you can open a new private window, private windows evidently don't use the same DNS cache as the regular windows (which is comforting).

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.