Clear DNS cache in Firefox
During the day I switch my VPN connection on and off several times. When I try to hit a server inside my company’s network while the VPN connection is down, it obviously fails and because I’m using OpenDNS every hostname resolves to an ip-address (in this case an ip-address of a server at OpenDNS). I connect to VPN and then reload the page in Firefox and the same error page shows up. The reason for this behavior is Firefox’s internal DNS cache. The only remedy at that point is to close Firefox and restart it, which clears the in-memory DNS cache.
However, there’s a solution that does not require a restart.
about:configin Firefox’s address bar
- acknowledge the warning that appears next
- find an entry called
network.dnsCacheExpirationand set it’s value to 0
- if there’s no such entry, create a new integer item with the name above and a value of 0
- now go back and change the value to 3600
In step 3 (or 4) we tell Firefox that the expiration time for DNS cache is 0 seconds, which means that cache entries expire immediately, essentially clearing the existing cache. In step 5 we go back to the standard 3600 seconds (1 hr) cache expiration. The net effect of these steps is an empty DNS cache, meaning that the next time you hit the trouble server above, Firefox will attempt to resolve the hostname to an ip-address.