
我可以連接到網路上的 Windows PC,在 Finder 的「共享」部分或使用「前往 > 連接到伺服器...」進行檔案共享,但如何找到其 IP 位址?
答案1
命令列smbutil
實用程式就是您所追求的:
$ smbutil
usage: smbutil [-hv] subcommand [args]
where subcommands are:
help display help on specified subcommand
lookup resolve NetBIOS name to IP address
status resolve IP address or DNS name to NetBIOS names
view list resources on specified host
dfs list DFS referrals
identity identity of the user as known by the specified host
statshares list the attributes of mounted share(s)
smbutil lookup <name>
您可以在終端機中尋找機器的 IP 位址:
$ smbutil lookup Example-Name
Got response from 192.168.1.110
IP address of Example-Name: 192.168.56.1
IP address of Example-Name: 192.168.1.110
或使用以下命令尋找機器名稱smbutil status <IP>
:
$ smbutil status 192.168.1.110
Using IP address of 192.168.1.110: 192.168.1.110
Workgroup: WORKGROUP
Server: EXAMPLE-NAME
(歸功於11庫姆斯告訴我這件事。
答案2
如果你無法讓 smbutil 工作 - 有時它不能工作並且我對 SMB 的了解不夠好,不知道為什麼,那麼 arp 可能會有用。
例如 [內容僅修剪到相關行]
ol-server 是我目前已連線的 Windows 電腦。我已安裝磁碟機並開啟 RDC 會話。
TetsMac:~ glee$ smbutil lookup ol-server
smbutil: unable to resolve ol-server: No route to host
TetsMac:~ glee$ arp -a
ol-server (192.168.0.3) at 0:21:91:e7:9c:a3 on en1 ifscope [ethernet]
答案3
我知道你可以這麼做ping <pc-name>
。其他解決方案是安裝wireshark
過濾器smb || smb2
並連接到您的 win 電腦。