本地域名解析–hosts文件
| 2009,6月 8 | Posted by yaozer under Apache |
域名解析一般是通过2个地方设置的,一个是本地的hosts文件,另一个是指定的DNS服务器。在 /etc/nsswitch.conf 指定了两者的解析顺序, 一般是hosts优先, 当hosts找到时, 就停止查找,不会继续去DNS服务器查。这就是本地域名解析的基本知识。
关于hosts文件的相关内容, 见wikipedia : http://en.wikipedia.org/wiki/Hosts_file
The hosts file is a computer file used to store information on where to find a node on a computer network. This file maps hostnames to IP addresses. The hosts file is used as a supplement to (or a replacement of) the Domain Name System (DNS) on networks of varying sizes. Unlike DNS, the hosts file is under the control of the local computer’s administrator.bb
The hosts file has no extension and can be edited using most text editors.
Location and default content
The hosts file is located in different locations in different operating systems and versions.[1]
| Operating System | Version(s) | Location |
|---|---|---|
| Windows | 95, 98, Me | %WinDir%\ |
| Windows | NT, 2000, XP, 2003, Vista, 7 | %SystemRoot%\system32\drivers\etc\ by default. Actual location defined in Registry key \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath |
| Macintosh | 9 and earlier | System Folder: Preferences or System folder |
| Macintosh | X | /private/etc/hosts |
| Linux, BSD based, and similar | /etc/hosts[2] |
|
| Novell NetWare | SYS:etc\hosts |
|
| iPhone and iPod | /private/etc/hosts |
|
| OS/2 and eComStation | "bootdrive":\mptn\etc\ |
|
| Symbian | 1st and 2nd edition phones | C:\system\data\hosts |
| Symbian | 3rd edition phones | C:\private\10000882\hosts (AllFiles capable only) |
最新评论