DNS(域名系统(Domain Name System))服务器(Servers)将网站的人性化名称(例如switchingtomac.com)转换为指向托管该网站的特定服务器的IP 地址。
如果您的DNS设置工作不正常,这些DNS查找将不起作用,您将无法访问该网站。如果您在Mac上收到“ DNS服务器未响应”或其他与DNS相关的错误消息,这些可能是该问题的一些修复方法。

重启一切
重新启动事物的标准建议比以往任何时候都更适用于DNS问题,因为它通常是需要解决的 Internet 连接问题。因此,重新启动链中的所有设备。重新启动(Restart)您的调制解调器(例如,您的光纤ONT、有线电视盒等)和您的路由器(如果它是一个单独的设备)。重新启动(Restart)所有卫星网格单元、扩展器和中继器。最后,重新启动Mac本身。
一些互联网服务提供商允许订阅者通过网站或移动应用程序仪表板远程重置ISP连接。(ISP)如果您有此功能,您可能还想远程
重置您的ISP连接。(ISP)
你的 Mac 是问题吗?
在你开始研究你的Mac之前,你必须将问题缩小到你的计算机上,否则你会浪费你的时间并可能会进一步搞砸事情。
检查问题是否出在Mac以外的最快方法是在连接到同一网络的不同设备上打开同一网页。或者,将您的Mac切换到其他连接(例如,您的 iPhone 热点或以太网(Ethernet))并查看问题是否仍然存在。

您可能还想尝试其他网络浏览器,例如如果您一直在使用Safari ,则切换到(Safari)Google Chrome ,反之亦然。
如果问题在您的 macOS 设备之外仍然存在,您最好先遵循我们的通用 DNS 故障排除指南(general DNS troubleshooting guide)。您可能还面临DNS中断,您可以按照下面“(DNS)更改(Change)您的DNS服务器”中
概述的步骤解决该问题。
更新您的浏览器和 macOS
假设(Suppose)您在Chrome、Safari或其他浏览器中有任何待处理的浏览器更新。请先完成(Complete)该更新,然后再进一步解决您的DNS问题。尽管DNS(DNS)中断或其他问题,浏览器应该没有连接问题,因为它直接连接到可用更新服务器的列表。

我们还看到在线论坛帖子表明macOS 计算机上的DNS问题比其他特定版本的 macOS 更熟悉。例如,似乎特别是 macOS Big Sur有一个随机弹出
的DNS问题。(DNS)
无论这是特定版本的 macOS 的问题,最好更新到您正在运行的macOS版本的最新版本。(macOS)或者,如果您准备好进行重大升级,请更新到您的Mac硬件支持的最新版本的 macOS。这应该可以消除由Apple已知的任何错误引起的DNS问题。
重新启动 mDNSResponder
如果您打开 macOS活动监视器(Activity Monitor),您将看到一个名为“mDNSResponder”的进程,它是在操作系统后台运行的众多程序之一。这个小软件有一个重要的工作:它在网络上寻找使用 Apple 的Bonjour零配置网络协议的设备。
数以百计的设备、应用程序和 macOS 功能依赖 m DNS Responder 才能正常运行,但有时该过程会出错。这可能会导致奇怪的网络行为,包括尝试浏览网站时出现
DNS错误。(DNS)
- 通过在Spotlight Search中搜索来打开活动监视器(Activity Monitor)。您可以通过按Command + Space打开Spotlight搜索。

- 使用搜索(Search)功能在正在运行的进程列表中查找 mDNSresponder 。

- 选择它,然后选择 X 图标以终止该进程。

- 确认您要强制退出(Force Quit)mDNSresponder。

- 尝试再次打开该网站。
刷新 DNS 缓存
最常见的问题之一是DNS缓存已损坏或过时。DNS缓存列出网站地址及其相关 IP 地址。
您经常访问或最近访问过的网站会缓存其 IP 地址,以便下次您看到它们时,浏览器会直接访问服务器,而不是先查询DNS服务器。
如果 IP 地址已更改或该特定地址上的服务器已关闭,则您的DNS缓存现在指向错误的位置,并且网站将无法加载。您可以“刷新” DNS缓存,这意味着将其删除。这会强制您的浏览器从DNS服务器获取最新信息:
- 打开终端(Terminal)。您可以通过按Command + Space然后搜索“终端(Terminal)”来找到它。
- 接下来,我们将使用“sudo”或“Super User DO”运行命令。这会将命令提升到最高管理员级别。执行这些命令时
,您可能需要输入Mac的管理员密码。(Mac)
- 在 macOS中刷新DNS的确切终端命令因您运行的版本而异。以下命令特定于每个列出的 macOS 版本。
- 对于Mojave(10.14 版)、High Sierra(10.13 版)、Sierra(10.12 版)、Mountain Lion(10.8 版)和Lion(10.7 版),请使用:
sudo killall -HUP mDNSResponder
- 对于El Capitan(10.11 版)和Mavericks(10.9 版):
sudo dscacheutil -flushcache sudo killall -HUP mDNSResponder
sudo discoveryutil mdnsflushcache sudo discoveryutil udnsflushcaches
- 对于Snow Leopard(10.6 版)和Leopard(10.5 版):
sudo dscacheutil -flushcache
查找 -flushcache
现在您的DNS缓存是空的,任何与缓存相关的问题都应该得到解决。如果您不知道自己拥有的 macOS 版本,请查看我拥有的 macOS版本(Version)是什么?
如果您需要在Windows、iOS 或Android设备上刷新(Android)DNS,请查看我们的DNS 缓存刷新指南(DNS Cache Flushing Guide)。
更改您的 DNS 服务器
一般来说,ISP(ISPs)会维护自己的DNS服务器,以便他们的客户在浏览网站时可以获得很好的响应。您的路由器会自动从您的ISP获取(ISP)DNS服务器地址,并且所有名称服务器请求都会发送到这些服务器。
但是,您不必简单地使用ISP提供的DNS服务器。事实上,许多ISP的(ISPs)DNS服务器都很差,所以你最好切换到通常被认为是顶级的服务器。
- 打开Apple 菜单(Apple Menu)并选择System Preferences。

- 接下来,选择网络。

- 现在选择要为其指定DNS服务器的网络连接。如果您使用的是Wi-Fi,请选择相关的Wi-Fi连接。如果您使用多个网络接口,则必须对所有这些接口重复这些步骤。

- 选择高级(Select Advanced),然后选择DNS选项卡。

- 要添加DNS服务器,请选择(DNS)DNS 服务器(DNS Servers)部分
下的 + 按钮。
您选择哪个DNS服务器取决于您,但强烈推荐使用
Cloudflare DNS和Google DNS 。
一个不错的首选是 Google 快速准确的公共DNS服务器。这些是要输入的详细信息:
- 8.8.8.8
- 8.8.4.4
- 2001:4860:4860::8888
- 2001:4860:4860::8844
这些是要为Cloudflare DNS添加的服务器:
- 1.1.1.1
- 1.0.0.1
- 2606:4700:4700::1111
- 2606:4700:4700::1001
第三个不错的选择是OpenDNS。这些是服务器地址:
- 208.67.222.222
- 208.67.220.220
您甚至可以使用专门的智能 DNS(Smart DNS)服务,对您的互联网体验进行精细控制,甚至可以让您绕过基于位置的内容拦截。但是,大多数智能DNS服务确实需要订阅费。
检查 Mac 防火墙

在某些情况下,您的DNS问题可能是由 Mac 的防火墙问题引起的。防火墙是一种软件或硬件网络过滤器,用于阻止未经授权的流量。您的防火墙可能会出于某种原因阻止您与DNS服务器的连接。(DNS)查看Mac 防火墙配置指南(Mac firewall configuration guide),了解有关启用、禁用和配置防火墙的详细信息。
(Set Up Custom Routing)使用主机文件(File)设置自定义路由
现代操作系统有一个称为Hosts文件的本地路由表。这是一个简单的文本文档,您的浏览器将始终在DNS缓存或DNS服务器之前对其进行检查。
如果您只遇到特定网站的问题,您可以通过编辑 hosts 文件为该网站设置自定义路由。该文件包含一个“主机名”列表,它只是一个 IP 地址和与之
相关的网站URL 。
就像添加 IP 地址和站点URL一样简单。您可以将URL重定向到您喜欢的任何 IP 地址,该地址有其用途,但在这里我们希望它指向我们要访问的网站。
您可以为最重要的网站设置永久重定向列表,这样DNS问题就不会影响它们。查看我们的macOS 主机文件编辑指南(macOS Host file editing guide)以获取确切说明。
How to Resolve DNS Issues on macOS
DNS (Domain Name System) Servers translate the human-friendly name of a website (e.g., switchingtomac.com) into an IP addresѕ that points to thе specific server that hosts that website.
If your DNS setup isn’t working correctly, these DNS lookups won’t work, and you won’t reach the website. If you’re getting “DNS server not responding” or other error messages related to DNS on your Mac, these are some likely fixes for the issue.

Restart Everything
The standard advice to reboot things applies more than ever to DNS issues since often it’s a problem with the internet connection that needs to be resolved. As such, restart all of the devices in the chain. Restart your modem (e.g., your fiber ONT, cable box, etc.) and your router (if it’s a separate device). Restart any satellite mesh units, extenders, and repeaters. Finally, restart the Mac itself.
Some internet service providers allow subscribers to reset the ISP connection remotely through a website or mobile app dashboard. If you have this feature, you may also want to reset your ISP connection remotely.
Is Your Mac the Problem?
Before you start poking around your Mac, you must narrow the problem down to your computer, or you’ll waste your time and potentially mess things up further.
The fastest way to check if the problem is with something other than your Mac is to open the same web page on a different device connected to the same network. Alternatively, switch your Mac to a different connection (e.g., your iPhone hotspot or Ethernet) and see if the problem persists.

You may also want to try a different web browser, such as switching to Google Chrome if you’ve been using Safari or vice versa.
If the problem persists beyond your macOS device, you’re better off following our general DNS troubleshooting guide first. You may also be facing a DNS outage, which you can resolve by following the steps outlined under “Change Your DNS Server” below.
Update Your Browser and macOS
Suppose you have any pending browser updates in Chrome, Safari, or another browser. Complete that update first before troubleshooting your DNS issue further. The browser should have no issues connecting despite a DNS outage or other problem since it connects directly to a list of available update servers.

We’ve also seen online forum posts indicating that DNS issues on macOS computers are more familiar with a specific version of macOS than others. For example, it seems that macOS Big Sur, in particular, has a DNS issue that pops up randomly.
Whether this is an issue with specific versions of macOS, it’s a good idea to update to the latest version of the macOS edition you’re running. Alternatively, if you’re ready for a significant upgrade, update to the newest version of macOS that your Mac hardware supports. This should eliminate DNS issues caused by any bugs known to Apple.
Restart mDNSResponder
If you open the macOS Activity Monitor, you’ll see a process called “mDNSResponder” as one of the many programs running in the operating system’s background. This little piece of software has an important job: it looks for devices on the network that use Apple’s Bonjour zero-configuration network protocol.
Hundreds of devices, apps, and macOS features rely on mDNSResponder to function correctly, but sometimes the process goes wrong. This can lead to weird network behavior, which includes DNS errors when trying to browse websites.
- Open the Activity Monitor by searching for it in Spotlight Search. You can open Spotlight search by pressing Command + Space.

- Look for mDNSresponder in the list of running processes using the Search function.

- Select it, and then select the X icon to kill the process.

- Confirm that you would like to Force Quit mDNSresponder.

- Try opening the website again.
Flush DNS Caches
One of the most common issues is a DNS cache that’s become corrupted or outdated. The DNS cache lists website addresses and their related IP addresses.
Websites you visit often or have visited recently have their IP addresses cached so that the next time you see them, the browser goes straight to the server instead of querying the DNS server first.
If the IP address has changed or the server on that specific address is down, your DNS cache now points to the wrong place, and the website won’t load. You can “flush” the DNS cache, which means erasing it. This forces your browser to get fresh information from the DNS server:
- Open Terminal. You can find it by pressing Command + Space and then searching for “Terminal”.
- Next, we will run a command using “sudo” or “Super User DO.” This elevates the command to the highest administrator level. You may have to enter the administrator password for your Mac when executing these commands.
- The exact terminal command to flush the DNS in macOS differs depending on your running version. The following commands are specific to each listed version of macOS.
- For Mojave (version 10.14), High Sierra (version 10.13), Sierra (version 10.12), Mountain Lion (version 10.8), and Lion (version 10.7) use:
sudo killall -HUP mDNSResponder
- For El Capitan (version 10.11) and Mavericks (version 10.9):
sudo dscacheutil -flushcache sudo killall -HUP mDNSResponder
- For Yosemite (version 10.10):
sudo discoveryutil mdnsflushcache sudo discoveryutil udnsflushcaches
- For Snow Leopard (version 10.6) and Leopard (version 10.5):
sudo dscacheutil -flushcache
- For Tiger (version 10.4):
lookupd -flushcache
Now your DNS cache is empty, and any cache-related issues should be solved. If you don’t know what version of macOS you have, check out What Version of macOS Do I Have?
If you need to flush the DNS on Windows, iOS, or Android devices, check out our DNS Cache Flushing Guide.
Change Your DNS Server
In general, ISPs maintain their own DNS servers so that their customers can get great responsiveness when browsing websites. Your router automatically gets the DNS server addresses from your ISP, and all name server requests go to those servers.
However, you don’t simply have to use the DNS server that your ISP provides. In fact, many ISPs have rather poor DNS servers, so you’re better off switching to ones generally regarded as top-class.
- Open the Apple Menu and select System Preferences.

- Next, select Network.

- Now choose the network connection you want to specify a DNS server for. If you’re using Wi-Fi, then select the relevant Wi-Fi connection. If you use multiple network interfaces, you’ll have to repeat these steps for all of them.

- Select Advanced and then select the DNS tab.

- To add a DNS server, select the + button under the DNS Servers section.
Which DNS server you choose is up to you, but Cloudflare DNS and Google DNS are highly-recommended.
A good first choice is Google’s fast and accurate public DNS server. These are the details to enter:
- 8.8.8.8
- 8.8.4.4
- 2001:4860:4860::8888
- 2001:4860:4860::8844
These are the servers to add for Cloudflare DNS:
- 1.1.1.1
- 1.0.0.1
- 2606:4700:4700::1111
- 2606:4700:4700::1001
A third good alternative is OpenDNS. These are the server addresses:
- 208.67.222.222
- 208.67.220.220
You can even use specialized Smart DNS services that give you finely-grained control of your internet experience and can even let you get around location-based content blocking. However, most smart DNS services do require a subscription fee.
Check the Mac Firewall

In some cases, your DNS issues might result from a problem with your Mac’s firewall. A firewall is a software or hardware network filter that blocks unauthorized traffic. Your firewall might block your connection to the DNS server for some reason. Check out the Mac firewall configuration guide for details on enabling, disabling, and configuring the firewall.
Set Up Custom Routing Using the Hosts File
Modern operating systems have a local routing table known as the Hosts file. This is a simple text document that your browser will always check before the DNS cache or a DNS server.
If you are having problems with only specific websites, you can set up a custom route for that website by editing the hosts file. This file contains a list of “hostnames,” which is just an IP address and the website URL that goes with it.
It’s as simple as adding an IP address and the URL of the site. You can redirect the URL to any IP address you like, which has its uses, but here we want it to point to the website we want to visit.
You can set up a list of permanent redirects for your most critical websites so that no DNS issue can ever affect them. Check out our macOS Host file editing guide for exact instructions.