現在,您的疑惑瞭解到哪裡了?
如果還是有疑惑,建議翻閱 RFC 1700、RFC 3330 等相關文件。懶得看英文,就改看這個很簡略的說明
大家好,Windows 7 的 hosts file 預設值如下:
# 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
照理說,# 號後方的文字,應該是當做註解。
因此最後兩行
# 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
可以麻煩專家們,說明一下原理嗎?
鎖定的問題。 此問題已從 Microsoft 支援服務社群移轉。 您可以對其是否有幫助進行投票,但無法對問題新增註解或回覆,或進行追蹤。
由問題作者接受的回答
另外一個讓人不解的一個結果:
C:>ping localhost
Ping computername [::1] (使用 32 位元組的資料):
回覆自 ::1: time<1ms
::1 的 Ping 統計資料:
封包: 已傳送 = 1,已收到 = 1, 已遺失 = 0 (0% 遺失),
大約的來回時間 (毫秒):
最小值 = 0ms,最大值 = 0ms,平均 = 0ms
正常的應該會進行 4 次,但您的結果卻僅有 1 次
使用 Bing 翻譯 localhost name resolution is handle within DNS itself 的結果為:
本地主機名稱稱解析是在本身的 DNS 內處理
該 Windows 7 電腦沒設定網路卡的 IP 位址、預設閘道、DNS ... 等嗎?
若沒設定 DNS,理論上,執行 nslookup localhost 的結果應該會出現類似下面的結果:
DNS request timed out.
timeout was 2 secondds.
伺服器: UnKnown
Address: fec0:0:0:ffff::1
DNS request timed out.
timeout was 2 secondds.
DNS request timed out.
timeout was 2 secondds.
*** 對 UnKnown 的要求逾時
方便的話,請貼 ipconfig /all 的資料。
Dear Alex ,
這是在下的疑問,
localhost name resolution is handle within DNS itself
這是表示說 DNS server 會負責幫忙解析嗎? 但...就沒有本機就沒架 DNS server 啊... (我沒設定 DNS server 的 IP)
而且網路是未連線的狀態..
這是 ping 及 nslookup
C:>ping localhost
Ping computername [::1] (使用 32 位元組的資料):
回覆自 ::1: time<1ms
::1 的 Ping 統計資料:
封包: 已傳送 = 1,已收到 = 1, 已遺失 = 0 (0% 遺失),
大約的來回時間 (毫秒):
最小值 = 0ms,最大值 = 0ms,平均 = 0ms
C:>nslookup localhost
伺服器: UnKnown
Address: fec0:0:0:ffff::1
*** UnKnown 找不到 localhost: No response from server
這個真的是讓小弟不解的一個結果...
註解已經有說明了:
localhost name resolution is handle within DNS itself您可以開啟「命令提示字元」,輸入下列指令,並按下 Enter 鍵:
nslookup localhost
看看輸出的結果為何