为提升您的使用体验,本站正在维护,部分功能暂时无法使用。如果本站文章无法解决您的问题,您想要向社区提问的话,请到 Twitter 上的 @FirefoxSupport 或 Reddit 上的 /r/firefox 提问,我们的支持社区将会很快回复您的疑问。

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

详细了解

Firefox isn't using local DNS (hosts file or next upstream DNS server). How can I make Firefox use local DNS options?

more options

For whatever reason, Firefox refuses to use the local hosts file for DNS queries. Chrome does this just fine.

I even moved the contents of my hosts file into the next upstream DNS server on my network. Again, Chrome picks up on this and properly resolves the website I'm working on, but Firefox does not.

I've seen the internet littered with questions about this behavior in Firefox. Why does this happen and what can I do to resolve it? None of the previous solutions seemed to work or do anything at all. I'm using Windows 10 v1803, no VPN, no proxy, Firefox v62.0.3 (64-bit).

Why is this a problem? I'm working on a website that hasn't launched yet and so I need to specify the new (not yet public) IP address to go to when I access the site by hostname. I feel like this is a really normal thing to do when working on and/or developing websites.

What steps have I tried? Well, I've searched for answers, but none seem to work at all. And there are no options in about:config network.dns that seem to address my issue. But I can confirm that adding the IP/host to my local hosts file causes Chrome to properly resolve the site like I need. I've also confirmed that once I moved the IP/host from my hosts file and into the next upstream DNS server on my network, nslookup reports the correct data from the upstream DNS server - but Firefox continues to use some other DNS server to resolve the hostname. The closest setting in about:config might be netwok.dnsCache* but I'm not sure what to use for those values. I'd rather just turn off DNS caching in Firefox altogether and let it use the TTL values configured in the actual DNS records - since you know, that's what they're there for...

For whatever reason, Firefox refuses to use the local hosts file for DNS queries. Chrome does this just fine. I even moved the contents of my hosts file into the next upstream DNS server on my network. Again, Chrome picks up on this and properly resolves the website I'm working on, but Firefox does not. I've seen the internet littered with questions about this behavior in Firefox. Why does this happen and what can I do to resolve it? None of the previous solutions seemed to work or do anything at all. I'm using Windows 10 v1803, no VPN, no proxy, Firefox v62.0.3 (64-bit). Why is this a problem? I'm working on a website that hasn't launched yet and so I need to specify the new (not yet public) IP address to go to when I access the site by hostname. I feel like this is a really normal thing to do when working on and/or developing websites. What steps have I tried? Well, I've searched for answers, but none seem to work at all. And there are no options in about:config network.dns that seem to address my issue. But I can confirm that adding the IP/host to my local hosts file causes Chrome to properly resolve the site like I need. I've also confirmed that once I moved the IP/host from my hosts file and into the next upstream DNS server on my network, nslookup reports the correct data from the upstream DNS server - but Firefox continues to use some other DNS server to resolve the hostname. The closest setting in about:config might be netwok.dnsCache* but I'm not sure what to use for those values. I'd rather just turn off DNS caching in Firefox altogether and let it use the TTL values configured in the actual DNS records - since you know, that's what they're there for...

所有回复 (1)

more options

Yes, I've seen a couple threads like this.

Did you test in a private window to bypass caches?

And/or clear the disk cache: How to clear the Firefox cache.


By default, Firefox for Windows uses Windows as the DNS resolver, and should therefore also be made aware of hosts file entries.

Could you double-check your connection settings here:

  • Windows: "3-bar" menu button (or Tools menu) > Options
  • Mac: "3-bar" menu button (or Firefox menu) > Preferences
  • Linux: "3-bar" menu button (or Edit menu) > Preferences
  • Any system: type or paste about:preferences into the address bar and press Enter/Return to load it

In the search box at the top of the page, type proxy and Firefox should filter to the "Settings" button, which you can click.

The default of "Use system proxy settings" piggybacks on your Windows/IE "LAN" setting. "Auto-detect" can lead to a flaky connection. You may want to try "No proxy".


You could try reducing the number of cached hosts and cache retention interval to see whether it makes any difference:

(1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button promising to be careful or accepting the risk.

(2) In the search box above the list, type or paste dnsc and pause while the list is filtered

(3) Double-click the network.dnsCacheEntries preference to display a dialog where you can enter the desired value, try 1 (for 1 host name) then click OK

(4) Double-click the network.dnsCacheExpiration preference to display a dialog, try 5 (for 5 seconds) then click OK

(5) Double-click the network.dnsCacheExpirationGracePeriod preference to display a dialog, try 5 (for 5 seconds) then click OK