Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Windows 綜合教學 >> Windows 技巧

hosts 檔案被竄改導致特定網站無法訪問?一招恢復正常

編輯:Windows 技巧

徵兆

  • 特定網站無法開啟,其他電腦正常。
  • 關閉防火牆、防毒軟體、換瀏覽器皆無效。
  • Ping 網域名解析到錯誤 IP(如 127.0.0.1 或 0.0.0.0)。

原因

C:\Windows\System32\drivers\etc\hosts 被安全軟體、惡意程式或使用者誤編輯,將目標網域導向本機或錯誤 IP,造成封鎖效果。

修復步驟

  1. 以「系統管理員」身分開啟記事本。
  2. 開啟 C:\Windows\System32\drivers\etc\hosts(檔案類型選「所有檔案」)。
  3. 尋找含目標網域的行(如 127.0.0.1 www.example.com),刪除該行或在行首加 # 註解。
  4. 儲存檔案(若提示權限不足,確認以管理員身分開啟記事本)。
  5. 執行 ipconfig /flushdns 清除 DNS 快取,重新瀏覽測試。

預防建議

  • 將 hosts 檔案設為「唯讀」屬性(右鍵內容 → 勾選唯讀),防止被竄改。
  • 定期檢查 hosts 內容,正常應僅保留 127.0.0.1 localhost 等預設行。
  • 安全軟體若提供「網站封鎖/保護」功能,確認其運作機制是否動用 hosts。

補充知識

hosts 檔案優先順序高於 DNS 伺服器,常用於:
• 區域網域名對應(無 DNS 伺服器環境)
• 封鎖廣告/惡意網站(導向 127.0.0.1)
• 開發測試環境強制解析

善用 hosts 可加速存取、阻擋惡意連線;但若被濫用,反成上網障礙。掌握檢查與修復技巧,讓網路暢通無阻。

Copyright © Windows教程網 All Rights Reserved