Windows 7 的 hosts file 為何 localhost 變為註解狀態,卻還是能使用?

匿名
2010-04-26T06:35:14+00:00

大家好,Windows 7 的 hosts file 預設值如下:

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

#       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

照理說,# 號後方的文字,應該是當做註解。

因此最後兩行

#    127.0.0.1       localhost

#    ::1             localhost

應該是沒效的,但為在命令提示字元中 ping localhost 但仍可以得到下面的結果:

C:>ping localhost

Ping computername [::1] (使用 32 位元組的資料):

回覆自 ::1: time<1ms

回覆自 ::1: time<1ms

回覆自 ::1: time<1ms

回覆自 ::1: time<1ms

可以麻煩專家們,說明一下原理嗎?

Windows for home | 舊版 Windows 版本 | Windows Update

鎖定的問題。 此問題已從 Microsoft 支援服務社群移轉。 您可以對其是否有幫助進行投票,但無法對問題新增註解或回覆,或進行追蹤。

0 則留言 沒有留言

9 個其他答案

排序依據: 最實用
  1. 匿名
    2010-04-28T01:24:38+00:00

    恩...感謝

    簡略說明有清楚,

    本來以為和 Linux 一樣,可以刪掉 Hosts 對映的記錄,

    看來 Windows 有自己的做法。

    此回答有幫助嗎?

    0 則留言 沒有留言