RaspBerry Pi命令行/应用程序 - 列出IP设备

时间:2015-12-18 02:02:06

标签: java linux networking ip raspberry-pi2

我正在尝试制作一个非常简单的Raspberry Pi应用程序,该应用程序将自动更新所有IP地址,Mac地址以及它们各自的设备名称都在同一网络上。我完全不知道从哪里开始,有关如何完成这项工作的任何建议?

我玩连接LCD并将其安装在路由器旁边,这样我就可以轻松访问连接到网络的所有设备。

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

“arp-scan”命令怎么样?

$ sudo apt-get install arp-scan
$ sudo arp-scan -l --interface wlan0
Interface: wlan0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.0.211   14:da:e9:XX:YY:ZZ       (Unknown)
192.168.0.1     1c:b1:7f:XX:YY:ZZ       (Unknown)
192.168.0.201   1c:ba:8c:XX:YY:ZZ       (Unknown)
192.168.0.202   e8:9d:87:XX:YY:ZZ       Toshiba
192.168.0.203   00:25:dc:XX:YY:ZZ       Sumitomo Electric Networks, Inc
192.168.0.210   fc:c2:de:XX:YY:ZZ       (Unknown)
192.168.0.212   64:bc:0c:XX:YY:ZZ       (Unknown)
192.168.0.207   10:6f:3f:XX:YY:ZZ       (Unknown)
192.168.0.208   90:a2:da:XX:YY:ZZ       GHEO SA
192.168.0.205   48:5d:60:XX:YY:ZZ       Azurewave Technologies, Inc.
192.168.0.210   fc:c2:de:XX:YY:ZZ       (Unknown) (DUP: 2)

12 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.8.1: 256 hosts scanned in 5.247 seconds (48.79 hosts/sec). 11 responded

您的界面可能是eth0而不是wlan0。

(新增) 由于arp-scan软件包包含旧的供应商列表文件,因此许多设备无法获取其名称(表示为“(未知)”)。 纠正这个:

$ git clone https://github.com/royhills/arp-scan.git
$ sudo cp /usr/share/arp-scan/ieee-oui.txt{,.org}
$ sudo cp arp-scan/ieee-oui.txt /usr/share/arp-scan/

刷新文件后,我们可以得到如下输出:

$ sudo arp-scan -l --interface wlan0
Interface: wlan0, datalink type: EN10MB (Ethernet)
Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/)
192.168.0.211   14:da:e9:XX:YY:ZZ       ASUSTek COMPUTER INC.
192.168.0.1     1c:b1:7f:XX:YY:ZZ       NEC Platforms, Ltd.
192.168.0.201   1c:ba:8c:XX:YY:ZZ       Texas Instruments
192.168.0.202   e8:9d:87:XX:YY:ZZ       Toshiba
192.168.0.203   00:25:dc:XX:YY:ZZ       Sumitomo Electric Industries,Ltd
192.168.0.205   48:5d:60:XX:YY:ZZ       AzureWave Technology Inc.
192.168.0.210   fc:c2:de:XX:YY:ZZ       Murata Manufacturing Co., Ltd.
192.168.0.212   64:bc:0c:XX:YY:ZZ       LG Electronics
192.168.0.208   90:a2:da:XX:YY:ZZ       GHEO SA
192.168.0.207   10:6f:3f:XX:YY:ZZ       BUFFALO.INC

11 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.8.1: 256 hosts scanned in 5.750 seconds (44.52 hosts/sec). 10 responded

所有设备都正确获得了(供应商)名称。