Windows 7 hosts 檔案是本機 DNS 解析的最高優先級查詢表,修改它可將指定域名導向任意 IP(如 127.0.0.1 封鎖、內網測試伺服器 IP、CDN 節點 IP),實現網址封鎖、開發測試、繞過地理限制等功能。
C:\Windows\System32\drivers\etc\hosts(無副檔名)。hosts。127.0.0.1 example.com ← 封鎖 example.com192.168.1.100 dev.mysite.local ← 將 dev.mysite.local 導向內網測試機ipconfig /flushdns)。

127.0.0.1 或 0.0.0.0,可下載社群維護的大型 hosts 清單(如 StevenBlack/hosts)。若儲存提示「存取被拒絕」:
hosts →「內容」→「安全性」→「編輯」→ 將目前使用者「寫入」權限勾選「允許」。hosts 複製到桌面編輯存檔 → 再複製回原位置覆蓋(需管理員權限)。::1 對應規則。