摘要
本文可協助您將 Hosts 檔案重設回預設值。
什麼是主機檔案
作業系統會使用主機檔案,將易於操作的主機名稱對應至數值網際網路通訊協定 (IP) 位址,以識別並找出 IP 網路中的主機。 主機檔案是解決電腦網路中網路中網路節點的數種系統資源之一,也是作業系統 IP 實作的常見部分。
[主機] 檔案包含由第一個文字欄位中的 IP 位址所組成的文字行,後面接著一或多個主機名稱。 每個欄位都是以空格分隔 (索引標籤通常是歷史原因,但也會使用空格) 。 批註行可能會包含在內,且會以雜湊字元 (#) 在這類線條的第一個位置表示。 檔案中完全空白的線條會被忽略。
如果 [主辦者] 檔案已從預設變更,重設檔案有助於解決一些連線問題。
解決方案
如果要將 Hosts 檔案重設回預設值,請根據您的作業系統執行下列步驟:
如果要將 Hosts 檔案重設回預設值,請依照下列步驟執行:
1. 開啟 記事本。 若要這麼做,請搜尋「記事本」,然後點選或按一下 [記事本] 圖示。
2. 複製下列文字,然後將文字貼到檔案中:
-
# Copyright (c) 1993-2006 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handle within DNS itself. # 127.0.0.1 localhost # ::1 localhost
3. 在 [ 檔案] 功能表上,選取 [另存新檔],在 [ 檔案名 ] 方塊中輸入「主機」 (如下圖所示) ,然後將檔案儲存到桌面。
4. 關閉記事本。
5. 搜尋 %WinDir%\System32\Drivers\Etc,然後選取 [檔案] 資料夾 圖示。
6. 點選並按住或以滑鼠右鍵按一下 [主辦者] 檔案,選取 [ 重新命名],然後將檔案重新命名為 「Hosts.old」。
7. 將您在步驟 3 中建立的 [主辦者] 檔案從桌面複製或移動到 %WinDir%\System32\Drivers\Etc 資料夾。 如果出現要求您輸入系統管理員密碼的提示,請選取 [繼續]。
如果要將 Hosts 檔案重設回預設值,請依照下列步驟執行:
1. 開啟記事本。 若要這麼做,請使用 Cortana搜尋「記事本」,然後點選或按一下 [記事本 ] 圖示。
2. 複製下列文字,然後將文字貼到檔案中:
-
# Copyright (c) 1993-2006 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handle within DNS itself. # 127.0.0.1 localhost # ::1 localhost
3. 在 [ 檔案] 功能表上,選取 [另存新檔],在 [ 檔案名 ] 方塊中輸入「主機」 (如下圖所示) ,然後將檔案儲存到桌面。
4. 關閉記事本。
5. 使用Cortana搜尋%WinDir%\System32\Drivers\Etc,然後選取[檔案] 資料夾圖示。
6. 點選並按住或以滑鼠右鍵按一下 [主辦者] 檔案,選取 [ 重新命名],然後將檔案重新命名為 「Hosts.old」。
7. 將您在步驟 3 中建立的 [主辦者] 檔案從桌面複製或移動到 %WinDir%\System32\Drivers\Etc 資料夾。 如果出現要求您輸入系統管理員密碼的提示,請選取 [繼續]。
如果要將 Hosts 檔案重設回預設值,請依照下列步驟執行:
1. 開啟記事本。 若要這麼做,請從畫面右邊緣向內撥動、點選 [ 搜尋]、輸入記事本,然後點選 [記事本] 圖示。 或者,如果您使用滑鼠,請指向畫面右上角、將滑鼠指標往下移動、按一下 [搜尋]、輸入記事本,然後按一下 [ 記事本]。
2. 複製下列文字,然後將文字貼到檔案中:
-
# Copyright (c) 1993-2006 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handle within DNS itself. # 127.0.0.1 localhost # ::1 localhost
3. 在 [ 檔案] 功能表上,選取 [另存新檔],在 [ 檔案名 ] 方塊中輸入「主機」 (如下圖所示) ,然後將檔案儲存到桌面。
4. 關閉記事本。
5. 開啟 %WinDir%\System32\Drivers\Etc 資料夾。 如果要執行這項操作,請依照下列步驟執行:
-
a. 從螢幕右邊緣向內撥動、點選 [搜尋]、輸入 [執行],然後點選 [ 執行] 圖示。 或者,如果您使用滑鼠,請指向畫面右上角、將滑鼠指標往下移動、選取 [搜尋]、輸入 [執行],然後選取 [ 執行] 圖示。
-
b. 在 [開啟] 方塊中輸入 %WinDir%\System32\Drivers\Etc,然後選取 [確定]。
6. 選取 [主辦者] 檔案,選取[重新命名],然後將檔案重新命名為 「Hosts.old」。
7. 將您在步驟 3 中建立的 [主辦者] 檔案複製或移動到 %WinDir%\System32\Drivers\Etc 資料夾。 如果收到輸入系統管理員密碼的提示,請點選或按一下 [繼續]。
如果要自行將 Hosts 檔案重設回預設值,請依照下列步驟執行:
-
按一下 [開始],按一下 [ 執行],輸入 [ Notepad],然後按一下 [ 確定]。
-
從下列清單中尋找您的 Windows 版本,然後針對該版本的 Windows 複製下列文字,然後貼到記事本:
-
針對 Windows 7:
- # Copyright (c) 1993-2006 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host # localhost name resolution is handle within DNS itself. # 127.0.0.1 localhost # ::1 localhost
-
適用于 Windows Vista 或 Windows Server 2008:
- # Copyright (c) 1993-2006 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host 127.0.0.1 localhost ::1 localhost
-
適用于 Windows XP 或 Windows Server 2003:
- # Copyright (c) 1993-1999 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # # 102.54.94.97 rhino.acme.com # source server # 38.25.63.10 x.acme.com # x client host 127.0.0.1 localhost
3. 在 [ 檔案] 功能表上,選取 [另存新檔],在 [ 檔案名 ] 方塊中輸入「主機」,然後將檔案儲存到桌面。
4. 選取[開始 >執行],輸入 %WinDir%\System32\Drivers\Etc,然後選取 [確定]。
5. 選取 [主辦者] 檔案,然後將其重新命名為「Hosts.old」。
6. 將您在步驟 3 中建立的 [主辦者] 檔案複製或移動到 %WinDir%\System32\Drivers\Etc 資料夾。 如果出現要求您輸入系統管理員密碼的提示,請選取 [繼續]。
其他相關資訊
Windows XP 的支援已終止
Microsoft 已于 2014 年 4 月 8 日終止對 Windows XP 的支援。 這項變更已經影響到您的軟體更新和安全性選項。 瞭解這對您有什麼意義,以及如何維持受保護狀態。
對 Windows Server 2003 的支援已于 2015 年 7 月 14 日終止
Microsoft 已于 2015 年 7 月 14 日終止對 Windows Server 2003 的支援。 這項變更已經影響到您的軟體更新和安全性選項。 瞭解這對您有什麼意義,以及如何維持受保護狀態。