| 作業系統 | 路徑 |
|---|---|
| Windows XP / 2000 / 2003 | C:\WINDOWS\system32\drivers\etc\hosts |
| Windows 9x / Me | C:\WINDOWS\hosts |
| Windows Vista / 7 / 8 / 10 / 11 | C:\Windows\System32\drivers\etc\hosts |
| Linux / macOS / Unix | /etc/hosts |
# 註解行以 # 開頭
# 格式:IP位址 [Tab] 網域名稱 [註解]
127.0.0.1 localhost
192.168.1.100 myserver.local # 內部伺服器
0.0.0.0 ad.doubleclick.net # 封鎖廣告網域
::1 ipv6-localhost
# 可暫時停用該規則。資料夾選項 →「檢視」→ 取消勾選「隱藏受保護的作業系統檔案」→ 確定。
cmd → ipconfig /flushdns。IP位址 + Tab + 網域名稱 + Enter
養成此習慣,格式永遠正確、易維護、不出錯。