Networking
獲取網路上設備的名稱
我想知道網路上所有設備的名稱。我已經嘗試了很多在網上找到的命令,但都沒有成功,但沒有像我想要的那樣工作。
基本上,當我輸入路由器設置時,我可以獲得連接到我網路的設備名稱。我也可以在某些應用程序上獲得它,所以我想它可以以某種方式完成。
我想要通過命令行連接到我的 Wi-Fi 網路的所有設備的名稱列表。
謝謝
pi@raspberrypi ~ $ nmap -sP 192.168.4.0/24 Starting Nmap 6.00 ( http://nmap.org ) at 2015-03-05 13:55 UTC Nmap scan report for 192.168.4.1 Host is up (0.0055s latency). Nmap scan report for 192.168.4.2 Host is up (0.42s latency). Nmap scan report for 192.168.4.4 Host is up (0.045s latency). Nmap scan report for 192.168.4.5 Host is up (0.47s latency). Nmap scan report for 192.168.4.6 Host is up (0.0032s latency). Nmap scan report for 192.168.4.7 Host is up (0.79s latency). Nmap scan report for 192.168.4.8 Host is up (0.0024s latency). Nmap scan report for 192.168.4.9 Host is up (0.038s latency). Nmap scan report for 192.168.4.10 Host is up (0.034s latency). Nmap scan report for 192.168.4.11 Host is up (0.029s latency). Nmap scan report for 192.168.4.22 Host is up (0.12s latency). Nmap scan report for 192.168.4.27 Host is up (0.031s latency). Nmap scan report for 192.168.4.28 Host is up (0.012s latency). Nmap scan report for 192.168.4.100 Host is up (0.0038s latency). Nmap done: 256 IP addresses (14 hosts up) scanned in 49.30 seconds
我傾向於為此使用fing,它是一個掃描器,可以掃描您所在的子網,它會嘗試提取主機名並將它們與 ip 和 MAC 一起顯示。
前任:
14:19:05 > Discovery profile: Default discovery profile 14:19:05 > Discovery class: data-link (data-link layer) 14:19:05 > Discovery on: 192.168.1.0/24 14:19:05 > Discovery round starting. 14:19:05 > Host is up: 192.168.1.151 HW Address: XX:XX:XX:XX:XX:XX Hostname: My-laptop-hostname 14:19:05 > Host is up: 192.168.1.1 HW Address: YY:YY:YY:YY:YY:YY Hostname: router.asus.com 14:19:06 > Discovery progress 25% 14:19:07 > Discovery progress 50% 14:19:08 > Discovery progress 75% 14:19:05 > Host is up: 192.168.1.10 HW Address: AA:BB:CC:DD:EE:FF (ASUSTek COMPUTER) 14:19:05 > Host is up: 192.168.1.11 HW Address: GG:HH:II:JJ:KK:LL 14:19:06 > Host is up: 192.168.1.99 HW Address: MM:NN:OO:PP:QQ:RR (Apple) Hostname: iPhoneOfSomeone
如您所見,並非所有設備都會給出它們的主機名;例如,一些外圍設備(如列印機)並不總是提供主機名,但大多數設備都提供。它甚至試圖通過分析 MAC 的 id-part 來猜測製造商
它在 Raspberry Pi 上執行,我不久前將它安裝在我的上,它按預期工作。
以上答案都不適合我,所以我開始搞亂arp-scan。所以,我發現有效的是:
arp-scan -I [WIFI INTERFACE] -l
arp-scan 掃描您的網路並列出設備。-I 選擇介面,-l 告訴 arp-scan 查看本地網路。接下來,輸入
arp
這將返回剛剛定位的設備 arp-scan,並列出它們的主機名和 MAC 地址。