UbuntuでローカルIPに接続中の機器を調べる。
- サーバーの固定IPを設定するために現在利用されているIPを確認したかった。
- いろいろな方法があるようだがarp-scanが簡単そうだった。
- aptで提供されるパッケージは古い(ver.1.8.1)、gitからソース(ver.1.9.5)を入手した。
実行環境
Ubuntu 16.04.6 LTS
実行内容
aptでインストールしてみた。
sudo apt install arp-scan
使用方法
arp-scan -I "NIC名" -l
NICはifconfigで確認する。
実行結果
Interface: enp0s25, datalink type: EN10MB (Ethernet) Starting arp-scan 1.8.1 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/) 192.168.1.1 xx:xx:xx:xx:xx:xx (Unknown) 192.168.1.3 xx:xx:xx:xx:xx:xx (Unknown) 192.168.1.14 xx:xx:xx:xx:xx:xx (Unknown) 192.168.1.4 xx:xx:xx:xx:xx:xx (Unknown) 192.168.1.6 xx:xx:xx:xx:xx:xx (Unknown) 192.168.1.12 xx:xx:xx:xx:xx:xx (Unknown) 192.168.1.11 xx:xx:xx:xx:xx:xx (Unknown) 192.168.1.9 xx:xx:xx:xx:xx:xx (Unknown) 192.168.1.13 xx:xx:xx:xx:xx:xx (Unknown) 9 packets received by filter, 0 packets dropped by kernel Ending arp-scan 1.8.1: 256 hosts scanned in 1.328 seconds (192.77 hosts/sec). 9 responded
左からIPアドレス、MACアドレス、NICの製造ベンダーとなっている。
製造ベンダーはすべて(Unknown)となった。
最新のarp-scanをインストールしてみた。
- 古いarp-scanの削除
sudo apt remove --purge arp-scan
- 必須パッケージのインストール
sudo apt install git autoconf libpcap-dev
- 最新のソースをコピー
git clone https://github.com/royhills/arp-scan.git
- インストール
cd arp-scan autoreconf --install ./configure make sudo make install reboot
実行結果
Interface: enp0s25, datalink type: EN10MB (Ethernet) Starting arp-scan 1.9.5 with 256 hosts (https://github.com/royhills/arp-scan) 192.168.1.1 xx:xx:xx:xx:xx:xx NEC Platforms, Ltd. 192.168.1.3 xx:xx:xx:xx:xx:xx BUFFALO.INC 192.168.1.14 xx:xx:xx:xx:xx:xx (Unknown: locally administered) 192.168.1.4 xx:xx:xx:xx:xx:xx AzureWave Technology Inc. 192.168.1.6 xx:xx:xx:xx:xx:xx HUAWEI TECHNOLOGIES CO.,LTD 192.168.1.12 xx:xx:xx:xx:xx:xx HUAWEI TECHNOLOGIES CO.,LTD 192.168.1.10 xx:xx:xx:xx:xx:xx Apple, Inc. 192.168.1.11 xx:xx:xx:xx:xx:xx Nintendo Co.,Ltd 192.168.1.9 xx:xx:xx:xx:xx:xx Murata Manufacturing Co., Ltd. 9 packets received by filter, 0 packets dropped by kernel Ending arp-scan 1.9.5: 256 hosts scanned in 2.191 seconds (116.84 hosts/sec). 9 responded
ベンダーが表示されるようになりました。
以上。