Win7系统hosts文件内容详解:域名与IP地址的关联数据库

发布时间:2024-02-09 14:06:06编辑:怀航

Win7系统的hosts文件位置及内容详解

一、什么是hosts文件?

hosts是一个没有扩展名的系统文件,它扮演着一个重要的角色,就是将一些常用的网址域名与其对应的IP地址建立一个关联“数据库”。当用户在浏览器中输入一个需要登录的网址时,系统会首先自动从hosts文件中寻找对应的IP地址。如果找到,系统会立即打开对应网页;如果没有找到,则系统再会将网址提交给DNS域名解析服务器进行IP地址的解析。如果发现是被屏蔽的IP或域名,就会禁止打开此网页。

二、Win7系统的hosts默认文件位置

文件地址:C:\WINDOWS\system32\drivers\etc\hosts

三、Win7系统的hosts默认文件内容

这个文件的内容通常如下:

Copyright (c) 1993-2009 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

Win7系统hosts文件内容详解:域名与IP地址的关联数据库

38.25.63.10 x.acme.com # x client host

localhost name resolution is handled within DNS itself.

127.0.0.1 localhost

::1 localhost

  • 声明:本站所有作品图文均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系我们