hosts檔案位置

來源:互聯網
上載者:User

  hosts是一個沒有副檔名的系統檔案,可以用記事本等工具開啟,其作用就是將一些常用的網址網域名稱與其對應的IP地址建立一個關聯“資料庫”, 當使用者在瀏覽器中輸入一個需要登入的網址時,系統會首先自動從Hosts檔案中尋找對應的IP地址,一旦找到,系統會立即開啟對應網頁,如果沒有找到,則 系統再會將網址提交DNS網域名稱解析伺服器進行IP地址的解析。

  而簡單的來說,hosts檔案是一個用於儲存電腦網路中節點資訊的檔案,它可以將主機名稱映射到相應的IP地址,從而實現DNS的功能,它可以由電腦的使用者來進行控制。

  但是,hosts檔案的儲存位置在不同的作業系統中也並不相同,甚至不同Windows版本的位置也不大一樣。下面,我們來看下hosts檔案位置。

  在Windows 98系統下該檔案在Windows檔案夾。   

  在Windows 2000/XP/Vista/Seven系統中位於%Systemroot%System32DriversEtc 檔案夾中,其中,%Systemroot%指系統安裝路徑。例如,Windows XP 安裝在C:WINDOWS,那麼Hosts檔案就在C:WINDOWSsystem32driversetc中。

  但hosts檔案具有系統屬性,系統預設是不顯示此檔案的,因此很多朋友雖然找到了相應的檔案夾卻看不到hosts檔案,顯示系統檔案的方法是:

  開啟“我的電腦”→工具→檔案夾選項→查看,然後在進階設定中取消勾選隱藏受保護的系統檔案,確定後就完成了。這時,電腦中的所有系統檔案都會顯示出來,hosts檔案也不會例外。

  hosts檔案一般有如下面的基本內容:

  # 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

  當然,你也可以用windows內建的尋找功能搜尋找到hosts檔案。該檔案其實是一個純文字的檔案,用普通的文本編輯軟體如記事本等都能開啟和編輯。以上便是hosts檔案位置的介紹。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.