当您浏览互联网时,域名系统 (DNS) 服务(Domain Name System (DNS) service)会主动将您遇到的各种网址转换或“解析”为您的Windows、Mac、Android或 iOS 设备可以理解的格式。然后将这些地址缓存在本地以帮助加快速度。
但是,如果在此期间发生了一些变化,您的网络浏览器可能会遇到连接问题并且无法正确加载某些网站。在这种情况下,您必须摆脱DNS缓存以强制您的设备再次查找每个网址。
在Windows和 macOS 上,您可以使用(Windows)命令提示符(Command Prompt)、Windows PowerShell和终端(Terminal)控制台快速清除DNS缓存。然而,在Android和 iOS 上,该过程并不那么简单,您必须一次尝试几种方法。
清除 Windows 上的 DNS 缓存
如果您的 PC 安装了Windows 7、Windows 8、Windows 8.1 或 Windows 10,则可以使用命令提示符(Command Prompt)控制台清除DNS缓存。
或者,您可以使用Windows 8/8.1/10Windows PowerShell控制台来获得相同的结果。
使用命令提示符清除 DNS 缓存(Use Command Prompt to Clear DNS Cache)
1. 按Windows + R打开运行框。然后,键入cmd并选择OK。
2. 在命令提示符(Command Prompt)控制台中键入以下内容:
ipconfig /flushdns
3. 按回车(Enter)。
使用 Windows PowerShell 清除 DNS 缓存(Use Windows PowerShell to Clear DNS Cache)
1. 右键单击开始(Start )按钮并选择Windows PowerShell。或者,按Windows + R,键入powershell.exe,然后选择OK。
2. 在Windows PowerShell(Windows PowerShell)控制台中键入以下内容:
清除-DnsClientCache(Clear-DnsClientCache)
3. 按回车(Enter)。
在 Mac 上清除 DNS 缓存
您可以使用终端(Terminal)清除Mac上的(Mac)DNS缓存。这适用于 macOS Big Sur 11.0、macOS Catalina 10.15和 macOS Mojave 10.14,包括可追溯到OS X Mavericks 10.9的早期版本的 macOS 。
1. 转到Finder >应用程序(Applications )>实用程序(Utilities )并启动终端(Terminal)。
2. 复制并粘贴以下命令:
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder
注意:(Note:)在从 10.10.0 到 10.10.3 的OS X Yosemite版本中,您必须改用以下命令:
sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches
3. 按回车(Enter)。当终端(Terminal)提示您输入管理员密码时,键入它并再次按Enter。
清除 Android 上的 DNS 缓存
在Android上,打开/关闭飞行模式(Airplane Mode)或执行硬重启通常会清除DNS缓存。此外,您可以查看刷新 Google Chrome 的内部DNS缓存是否有帮助。如果没有任何效果,您必须执行网络设置重置。
Enable/Disable Airplane Mode on Android
您可以通过Android设备的快速设置(Quick Settings)窗格启用/禁用飞行模式。(Airplane Mode)只需(Just)从屏幕顶部向下滑动一次或两次即可显示飞行模式(Airplane Mode)图标。然后,点击它以启用飞行模式(Airplane Mode)。等待(Wait)几秒钟,然后再次点击以禁用飞行模式(Airplane Mode)。
硬重启 Android 设备(Hard-Reboot Android Device)
如果打开/关闭飞行模式(Airplane Mode)没有帮助,请尝试硬重启您的 Android 设备。通常,这涉及按住电源(Power )按钮 10-20 秒。如果您无法以这种方式进行硬重启,最好使用您的 Android 型号名称执行Google搜索以获取具体说明。
清除 Chrome 的内部 DNS 缓存(Clear Chrome’s Internal DNS Cache)
Google Chrome是 Android 的内置原生网络浏览器,具有内部DNS缓存。尝试清除它。
1. 打开谷歌浏览器(Google Chrome)。然后,在地址栏中输入以下路径并点击Enter:
chrome://net-internals/#DNS
2. 选择DNS侧选项卡并点击清除主机缓存(Clear host cache)。
3. 选择Sockets侧选项卡并点击Close idle sockets,然后点击Flush socket pools。
重置安卓网络设置(Reset Android Network Settings)
网络设置重置需要您深入了解Android智能手机上的“设置”(Settings)应用程序。下面的步骤在您看来可能不一样,但您应该明白这一点。
注意:(Note:)重置过程将删除您Android设备上所有已保存(Android)的 Wi-Fi(Wi-Fi)连接和密码,因此请准备好重新从头开始设置所有内容。
1.在您的Android设备上打开设置(Settings)应用程序。
2. 点击系统(System)。
3. 点击重置(Reset)。
4. 点击网络设置重置(Network Settings Reset)。
5. 再次点击网络设置重置(Network Settings Reset)进行确认。
清除 iPhone 上的 DNS 缓存
如果您使用 iPhone,启用/禁用飞行(Airplane)模式、强制重启设备或重置网络设置应该可以帮助您清除DNS缓存。
Enable/Disable Airplane Mode on iPhone
(Swipe)从 iPhone 屏幕右上方向下滑动以打开控制中心(Control Center)。如果您的设备使用Touch ID,请改为从屏幕底部向上滑动。
然后,点击飞行模式(Airplane Mode)图标。等待(Wait)几秒钟,然后再次点击飞行模式(Airplane Mode)图标。
强制重启 iPhone(Force-Restart iPhone)
强制重启 iPhone 需要按下特定的按钮组合,这些组合会根据设备的品牌和型号而变化。
iPhone 8 及更新版本:(iPhone 8 and newer:)快速按下释放音量调高(Volume Up )按钮,按下并释放音量调低(Volume Down )按钮,并按住侧边(Side )按钮,直到屏幕上出现Apple标志
iPhone 7:同时按住降低音量(Volume Down)和侧边(Side )按钮,直到您在屏幕上看到Apple标志。(Apple)
iPhone 6s 及更早机型:(iPhone 6s and earlier:)同时按住侧边(Side)/顶部(Top)和主页(Home )按钮,直到Apple标志出现在屏幕上。
重置 iPhone 网络设置(Reset iPhone Network Settings)
iPhone 网络设置重置不仅会清除DNS缓存,还会清除所有已保存的 Wi-Fi(Wi-Fi)网络和密码。除非您完全依赖蜂窝数据,否则您必须在之后手动重新连接到每个Wi-Fi网络。仅当其他方法无效时才尝试此操作。
1. 打开 iPhone 的设置应用程序。
2. 点击常规(General)。
3. 点击重置(Reset)。
4. 点击重置网络设置(Reset Network Settings)。
5. 再次点击重置网络设置(Reset Network Settings)进行确认。
不要忘记浏览器缓存
仅刷新DNS缓存可能还不够。Web浏览器在本地缓存各种其他 Web 内容,这也可能导致很多问题。如果您在加载网站时仍然遇到问题,请尝试清除浏览器缓存(clearing the browser cache)。此外,不要忘记解决其他与网络相关的问题(troubleshoot other network-related issues)。
How to Clear DNS Cache on Windows, Mac, Android & iOS
When you browse the internet, a Domain Name System (DNS) service will actively translate, or “resolve,” the various web addresses that you come across into a format that your Windows, Mac, Android, or iOS device understands. These addresses are then cached locally to help speed things up.
But if something changes in the meantime, your web browser may run into connectivity issues and fail to load some websites properly. In that case, you must get rid of the DNS cache to force your device to look up each web address again.
On Windows and macOS, you can clear the DNS cache quickly using the Command Prompt, Windows PowerShell, and Terminal consoles. On Android and iOS, however, the procedure isn’t as straightforward and you’ll have to try a few methods one at a time.
Clear DNS Cache on Windows
If you have a PC with Windows 7, Windows 8, Windows 8.1, or Windows 10 installed, you can use the Command Prompt console to clear the DNS cache.
Alternatively, you can use the Windows PowerShell console in Windows 8/8.1/10 to get the same result.
Use Command Prompt to Clear DNS Cache
1. Press Windows+R to open the Run box. Then, type cmd and select OK.
2. Type the following into the Command Prompt console:
ipconfig /flushdns
3. Press Enter.
Use Windows PowerShell to Clear DNS Cache
1. Right-click the Start button and select Windows PowerShell. Or, press Windows+R, type powershell.exe, and select OK.
2. Type the following into the Windows PowerShell console:
Clear-DnsClientCache
3. Press Enter.
Clear DNS Cache on Mac
You can clear the DNS cache on a Mac using Terminal. This applies to macOS Big Sur 11.0, macOS Catalina 10.15, and macOS Mojave 10.14, including earlier versions of macOS dating back to OS X Mavericks 10.9.
1. Go to Finder > Applications > Utilities and launch Terminal.
2. Copy and paste the following command:
sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder
Note: In OS X Yosemite versions starting 10.10.0 through 10.10.3, you must use the following command instead:
sudo discoveryutil mdnsflushcache;sudo discoveryutil udnsflushcaches
3. Press Enter. When Terminal prompts you for an administrator password, type it and press Enter again.
Clear DNS Cache on Android
On Android, either toggling Airplane Mode on/off or performing a hard reboot usually clears the DNS cache. Additionally, you can see if flushing Google Chrome’s internal DNS cache can help. If nothing works, you must perform a network settings reset.
Enable/Disable Airplane Mode on Android
You can enable/disable Airplane Mode via your Android device’s Quick Settings pane. Just swipe down from the top of the screen once or twice to reveal the Airplane Mode icon. Then, tap it to enable Airplane Mode. Wait for a few seconds and tap it again to disable Airplane Mode.
Hard-Reboot Android Device
If turning Airplane Mode on/off didn’t help, try hard-rebooting your Android device. Usually, that involves pressing and holding the Power button for 10-20 seconds. If you can’t do a hard-reboot that way, it’s best to perform a Google search with your Android’s model name for specific instructions.
Clear Chrome’s Internal DNS Cache
Google Chrome, Android’s built-in native web browser, features an internal DNS cache. Try clearing it out.
1. Open Google Chrome. Then, type the following path into the address bar and tap Enter:
chrome://net-internals/#DNS
2. Select the DNS side-tab and tap Clear host cache.
3. Select the Sockets side-tab and tap Close idle sockets, followed by Flush socket pools.
Reset Android Network Settings
A network settings reset requires you to dig into the Settings app on your Android smartphone. The steps below may not appear the same on your end, but you should get the idea.
Note: The reset procedure will delete all saved Wi-Fi connections and passwords on your Android device, so do be prepared to set up everything from scratch again.
1. Open the Settings app on your Android device.
2. Tap System.
3. Tap Reset.
4. Tap Network Settings Reset.
5. Tap Network Settings Reset again to confirm.
Clear DNS Cache on iPhone
If you use an iPhone, enabling/disabling Airplane mode, force-restarting the device, or resetting the network settings should help you clear the DNS cache.
Enable/Disable Airplane Mode on iPhone
Swipe down from the top right of the iPhone’s screen to open the Control Center. If your device uses Touch ID, swipe up from the bottom of the screen instead.
Then, tap the Airplane Mode icon. Wait for a few seconds and tap the Airplane Mode icon again.
Force-Restart iPhone
Force-restarting an iPhone requires pressing specific button combinations that change depending on the make and model of your device.
iPhone 8 and newer: Quickly press the release the Volume Up button, press and release Volume Down button, and press and hold the Side button until the Apple logo shows up on the screen
iPhone 7: Press and hold both the Volume Down and Side buttons at the same time until you see the Apple logo on the screen.
iPhone 6s and earlier: Hold down both the Side/Top and Home buttons together until the Apple logo shows up on the screen.
Reset iPhone Network Settings
An iPhone network settings reset will not only clear the DNS cache, but also all saved Wi-Fi networks and passwords. Unless you rely solely on cellular data, you must manually reconnect to each Wi-Fi network afterward. Only try this if the other methods failed to work.
1. Open your iPhone’s Settings app.
2. Tap General.
3. Tap Reset.
4. Tap Reset Network Settings.
5. Tap Reset Network Settings again to confirm.
Don’t Forget the Browser Cache
Flushing out the DNS cache alone may not be enough. Web browsers cache all sorts of other web content locally, and that can cause lots of issues as well. If you continue to experience problems while loading websites, try clearing the browser cache. Also, don’t forget to troubleshoot other network-related issues.