萬盛學電腦網

您现在的位置: 萬盛學電腦網 >> 程式設計 >  >> 伺服器教學

Mac / Linux / Windows 清除 DNS 快取指令速查

macOS

sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder   # 10.10+ 另需重啟 mDNSResponder

Linux

# systemd 系統
sudo systemctl restart systemd-resolved
# 或傳統 nscd
sudo /etc/init.d/nscd restart
# 或清除特定網域
sudo systemd-resolve --flush-caches

Windows

ipconfig /flushdns

驗證方式

# Linux/macOS
dig example.com
# Windows
nslookup example.com

何時需要清除

  • 更換 DNS 記錄後未生效。
  • 瀏覽器顯示舊 IP 或連線錯誤。
  • 開發測試需強制重新解析。
copyright © 萬盛學電腦網 all rights reserved