![Ping [計算機] 得到奇怪的 IP 位址](https://rvso.com/image/1250551/Ping%20%5B%E8%A8%88%E7%AE%97%E6%A9%9F%5D%20%E5%BE%97%E5%88%B0%E5%A5%87%E6%80%AA%E7%9A%84%20IP%20%E4%BD%8D%E5%9D%80.png)
在我的本機網路上,我連接了多台電腦。我通常不記得 IP 位址,也不關心。今天早上,我去了 RDP 將“Sam”放入字段中並按 Enter。它無法連接,所以我打開命令提示符,看看是否可以 ping 通她的計算機,並獲得一些我以前從未見過的東西。
C:\Documents and Settings\wbeard52>ping sam
Pinging sam.WORKGROUP [67.215.65.132] with 32 bytes of data:
Reply from 67.215.65.132: bytes=32 time=51ms TTL=56
顯然,我在本地網路上有一台名為“sam”的計算機,我透過 RDP 使用她的 IP 位址(不是此處列出的位址)連接到她的計算機。我在路由表中沒有看到任何內容。
wbeard52>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 0e 35 a5 6f b2 ...... Intel(R) PRO/Wireless 2200BG Network Connection
- Packet Scheduler Miniport
===========================================================================
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.52.208 192.168.52.152 10
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
192.168.52.0 255.255.255.0 192.168.52.152 192.168.52.152 10
192.168.52.152 255.255.255.255 127.0.0.1 127.0.0.1 10
192.168.52.255 255.255.255.255 192.168.52.152 192.168.52.152 10
224.0.0.0 240.0.0.0 192.168.52.152 192.168.52.152 10
255.255.255.255 255.255.255.255 192.168.52.152 192.168.52.152 1
Default Gateway: 192.168.52.1
===========================================================================
Persistent Routes:
None
是什麼導致 ping 被發送到舊金山的 IP 位址?
答案1
我很確定@hyperslug 已經擊中了我的要害。當使用 OpenDNS 作為您的 DNS 提供者時,如果您嘗試解析未知名稱,他們將返回 IP 位址,將您的瀏覽器「重定向」到他們的品牌化的“結果”頁面。使用 OpenDNS 時您永遠不會看到「404」頁面。
如果您嘗試使用 ISP DNS 伺服器PING sam
,您將獲得:
C:\>ping sam
Ping request could not find host sam. Please check the name and try again.
要解決此問題(假設您想sam
按名稱解析而不需要輸入 IP 位址),您需要在檔案中新增HOSTS
「sam」條目。
從您的路由表中,我可以看到您位於網路 192.168.52.x 上,而您的電腦是 192.168.52.152。我還可以看到您的預設網關是192.168.52.1。你沒有提到IP位址是什麼sam
。為本練習的目的,我們假設為sam
192.168.52.201。
我假設您的環境是 Windows,如下所示。您需要編輯該文件%windir%\system32\drivers\etc\hosts.
如果您從未使用過該hosts
文件,您可能必須先重新命名%windir%\system32\drivers\etc\hosts.sam
為%windir%\system32\drivers\etc\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
在hosts文件末尾添加一行:
192.168.52.201 sam
儲存文件就完成了。
答案2
您的 WINS 伺服器的設定是什麼? “IPCONFIG /ALL”指令應顯示您的 Windows WINS 設定。我知道“ping sam”會觸發您的 WINS 伺服器而不是 DNS 伺服器。
答案3
pathping 67.215.65.132
並pathping sam
可以幫助您識別資料包採用的網路路由。
nslookup sam
將確定哪個 DNS 伺服器將您指向該 IP 位址。
nslookup 67.215.65.132
檢查 DNS 查找的反向方式(檢查是否符合!)。
nslookup <DNS-server-ip-addres>
並nslookup <DNS-server-name>
檢查假定的 DNS 伺服器。它屬於 OpenDN 嗎?
nbtstat -n
顯示本機 NetBIOS 名稱。
nbtstat -r
顯示透過廣播和/或 WINS 解析的名稱。
nbtstat -S
並nbtstat -s
顯示會話表(帶有目標 IP 位址或名稱)。
nbtstat -RR
透過先釋放名稱來刷新您的 WINS。