#author("2019-03-02T16:49:15+00:00","","") #author("2019-04-03T00:54:47+00:00","","") #topicpath ///////////////////////////////////////////////////////////////////////////// * 目次 [#z19ec9e5] #contents(); ///////////////////////////////////////////////////////////////////////////// * ルータに繋がっている全ての機器の IP を調べる [#e042d1c4] //--------------------------------------------------------------------------- ** 手順1 : arp-scan を使う [#wc2f4b7e] - arp-scan のコマンド書式(要root権限) arp-scan -I <interface> -l - 実行例 # arp-scan -I wlp4s0 -l Interface: wlp4s0, datalink type: EN10MB (Ethernet) Starting arp-scan 1.9 with 256 hosts (http://www.nta-monitor.com/tools/arp-scan/) 192.168.1.1 0b:1a:3b:d5:fe:f6 NEC AccessTechnica, Ltd. 192.168.1.2 32:85:95:7a:1e:7c Intel Corporate 2 packets received by filter, 0 packets dropped by kernel Ending arp-scan 1.9: 256 hosts scanned in 2.265 seconds (113.02 hosts/sec). 2 responded //--------------------------------------------------------------------------- ** 手順2 : netdiscover を使う [#ve906030] - コマンド書式 # netdiscover -r 192.168.1.0/24 -- オプション -r の引数はレンジで指定しないとエラーになる - 出力例 Currently scanning: Finished! | Screen View: Unique Hosts 2 Captured ARP Req/Rep packets, from 2 hosts. Total size: 102 _____________________________________________________________________________ IP At MAC Address Count Len MAC Vendor / Hostname ----------------------------------------------------------------------------- 192.168.1.1 0b:1a:3b:d5:fe:f6 1 60 NEC Platforms, Ltd. 192.168.1.2 32:85:95:7a:1e:7c 1 42 Intel Corporate -- 自機の IP はこのリストには表示されない //--------------------------------------------------------------------------- ** 手順3 : ifconfig / ping / arp を使う [#gc509bfb] + ifconfig で broadcast address を調べる $ /sbin/ifconfig <interface-name> 0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 240d::69ff:9f00:cc21:ff25:aa05:311b prefixlen 64 scopeid 0x0<global> inet6 fe80::d469:8fb1:6fd2:9a08 prefixlen 64 scopeid 0x20<link> ether 22:80:99:5a:1c:b0 txqueuelen 1000 (イーサネット) RX packets 746385 bytes 793514361 (756.7 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 593509 bytes 85367822 (81.4 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 -- この結果より、 --- IP address: 192.168.1.2 --- broadcast address: 192.168.1.255 + broadcast address に ping を投げる $ ping -b 192.168.1.255 # 意図的に broadcast address に ping を投げる場合は、 -b が必要になる WARNING: pinging broadcast address PING 192.168.1.255 (192.168.1.255) 56(84) bytes of data. 64 bytes from 192.168.1.1: icmp_seq=1 ttl=255 time=3.02 ms 64 bytes from 192.168.1.3: icmp_seq=1 ttl=64 time=42.7 ms (DUP!) 64 bytes from 192.168.1.1: icmp_seq=2 ttl=255 time=2.97 ms 64 bytes from 192.168.1.3: icmp_seq=2 ttl=64 time=61.2 ms (DUP!) ^C + root で arp コマンドを投げる # arp -a ? (192.168.1.3) at 88:95:ad:45:aa:83 [ether] on enp0s25 ? (192.168.1.6) at <不完全> on wlp3s0 hoge.fuga (192.168.1.1) at 00:f5:88:95:be:76 [ether] on enp0s25 ? (192.168.1.4) at <不完全> on wlp3s0 ? (192.168.1.7) at <不完全> on wlp3s0 ? (192.168.1.5) at <不完全> on wlp3s0 -- これより、ルータ(192.168.1.1)、コマンド発行元(192.168.1.2)以外に繋がっている機器が1台(192.168.1.3)あることが分かる。 ///////////////////////////////////////////////////////////////////////////// * ツール [#fce7742d] //--------------------------------------------------------------------------- ** pktstat [#oe1b5a59] - [[Debian6>Debian/ver6]]に入っている - iptables によるフィルタリングの状況を、topコマンド風に表示する - Debianでは、実行にroot権限が必要。 //--------------------------------------------------------------------------- ** iptstate [#g1dac294] - iptables によるフィルタリングの状況を、topコマンド風に表示する - Debianでは、実行にroot権限が必要。 - [[Debian6>Debian/ver6]]には入っていない