刷新电脑本地 DNS 的“大命令”取决于你的操作系统。以下是常见系统中用于刷新 DNS 缓存的命令:
Windows 系统(以管理员身份运行命令提示符)
ipconfig /flushdns
执行后系统会显示:
Successfully flushed the DNS Resolver Cache.
macOS 系统
不同 macOS 版本使用的命令略有不同,以下适用于大多数版本:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
Linux 系统
Linux 不同发行版使用的 DNS 服务不同,一般可以尝试以下命令:
对于使用 systemd-resolved
的系统(如 Ubuntu 20+):
sudo systemd-resolve --flush-caches
或者重启 DNS 服务:
sudo service network-manager restart
或
sudo systemctl restart systemd-resolved