DNS是一种用于将域名或web地址解析为IP地址的协议。DNS缓存用于存储以前解析的域名-IP地址记录。有时,这些DNS缓存记录可能会产生问题,解决这一问题的最佳和最简单的方法是重置或刷新DNS缓存。刷新DNS将清除所有以前的缓存和有关IP地址和域名解析的条目。
刷新Windows 8、Windows 10和Windows Server的DNS缓存
Windows 8、Windows 10、Windows Server 2012、Windows Server 2016和Windows Server 2019使用相同的基础结构可以使用相同的指令通过ipconfig命令刷新这些操作系统的DNS。刷新或重置DNS缓存是一项管理任务,需要运行 ipconfig /flushdns
MS-DOS或命令行应以如下管理员权限打开。
首先键入“开始”菜单 msdos
或 command line
它将列出命令提示符。在那里你会看到 Run as administrator
以管理员权限打开命令提示符。
![图片[1]-“ipconfig/flushdns”–在Windows、MacOSX和Linux中重置DNS缓存-yiteyi-C++库](https://www.yiteyi.com/wp-content/uploads/2020/10/windowstect_image-7.png)
现在只需键入 ipconfig /flushdns
命令,然后按Enter键执行此命令以刷新或重置DNS缓存。
![图片[2]-“ipconfig/flushdns”–在Windows、MacOSX和Linux中重置DNS缓存-yiteyi-C++库](https://www.yiteyi.com/wp-content/uploads/2020/10/windowstect_image-8.png)
如果没有问题并且DNS缓存已成功刷新 Successfully flushed the DNS Resolver Cache .
消息将打印到命令行。
刷新Windows 7、Windows XP、Windows Server 2003和Windows Server 2008的DNS缓存
Windows 7和Windows Server 2008 DNS缓存刷新与Windows 10、Windows 8非常相同。我们将以管理员权限打开MS-DOS或命令行。第一类 msdos
或 command line
进入“开始”菜单,右键单击 Command Prompt
然后选择 Run as administrator
.
![图片[3]-“ipconfig/flushdns”–在Windows、MacOSX和Linux中重置DNS缓存-yiteyi-C++库](https://www.yiteyi.com/wp-content/uploads/2020/10/windowstect_image-10.png)
我们将键入 ipconfig /flushdns
命令,然后按enter键重置或刷新DNS缓存。
![图片[4]-“ipconfig/flushdns”–在Windows、MacOSX和Linux中重置DNS缓存-yiteyi-C++库](https://www.yiteyi.com/wp-content/uploads/2020/10/windowstect_image-11.png)
刷新MacOSX的DNS
MacOSX还提供刷新DNS缓存的功能。首先,您必须关闭所有浏览器,然后单击 Applications
-> Utilities
-> Terminal
. 然后对相关的MacOSX版本使用以下命令。
相关文章: “ipconfig/registerdns”-将主机名注册到Active Directory(AD)
OS X 10.10及更高版本
sudo discoveryutil mdnsflushcache
苹果操作系统10.7–10.9
sudo killall -HUP mDNSResponder
OS X 10.6及以前版本
sudo dscacheutil -flushcache
Linux、Debian、Ubuntu、Mint、CentOS、RHEL的刷新DNS
实际上,Linux发行版在默认情况下没有DNS缓存机制,但是不同的发行版可能会将DNS信息存储在不同的应用程序中,比如nscd、pdnsd、dnsmasq。基本上重新启动相关服务将重置或刷新DNS缓存。
dnsmasq公司
$ sudo /etc/init.d/dnsmasq restart
pdnsd公司
$ sudo pdnsd-ctl empty-cache
nscd公司
$ sudo /etc/init.d/nscd restart
dns清除
$ sudo /etc/init.d/dns-clean restart