我似乎使用nmap或arp-scan从特定的机器获得IP / MAC地址的variables和不一致的结果。
机器有3个接口,这就是它显示的内容:
$ uname -a Linux showstore-81 2.6.35.13 #1 SMP PREEMPT Thu Feb 9 12:20:36 PST 2012 i686 GNU/Linux $ LC_ALL=C /sbin/ifconfig eth0 Link encap:Ethernet HWaddr 00:1b:21:ac:17:19 inet addr:192.168.81.54 Bcast:192.168.81.255 Mask:255.255.255.0 ... eth1 Link encap:Ethernet HWaddr 00:25:90:25:d0:4e inet addr:192.168.81.129 Bcast:192.168.81.255 Mask:255.255.255.128 ... eth2 Link encap:Ethernet HWaddr 00:25:90:25:d0:4f inet addr:169.254.1.1 Bcast:169.254.255.255 Mask:255.255.0.0 ...
所以无论使用什么工具和选项,我都会期望:
但是nmap -n -sP 192.168.81.0/24 v。5.00)报告颠倒了 :
Host 192.168.81.54 is up (0.000078s latency). MAC Address: 00:25:90:25:D0:4E (Super Micro Computer) Host 192.168.81.129 is up (0.000058s latency). MAC Address: 00:1B:21:AC:17:19 (Intel Corporate)
而nmap -n -sP -PR 192.168.81/24只报告两个IP上的一个MAC地址 :
Host 192.168.81.54 is up (0.000081s latency). MAC Address: 00:1B:21:AC:17:19 (Intel Corporate) Host 192.168.81.129 is up (0.00011s latency). MAC Address: 00:1B:21:AC:17:19 (Intel Corporate)
最后, arp-scan -l (v。1.8.1)报告两个MAC地址的两个IP地址 :
192.168.81.54 00:1b:21:ac:17:19 Intel Corporate 192.168.81.54 00:25:90:25:d0:4e Super Micro Computer, Inc. 192.168.81.129 00:1b:21:ac:17:19 Intel Corporate 192.168.81.129 00:25:90:25:d0:4e Super Micro Computer, Inc.
我怎样才能做出正确结果的扫描? (我只需要IP和MAC,没有端口扫描。)
那么,首先,你使用的是不一致/重叠的子网。 192.168.81.129/25是192.168.81.54/24的一部分。 所以,首先做ifconfig eth0 netmask 255.255.255.128。 接下来,因为我只能想象eth0插入eth1所在的networking中,所以您需要限制计算机对ARP的反应。
您将需要手动或在/etc/sysctl.conf中设置以下sysctl条目:
net.ipv4.conf.all.rp_filter=1 net.ipv4.conf.all.arp_filter=1 net.ipv4.conf.all.arp_announce=1 net.ipv4.conf.all.arp_ignore=2 net.ipv4.conf.all.shared_media=0
更新这个以包含更多信息。 通常情况下,无论是否在响应的NIC上configuration了请求的IP,Linux都会响应一个分配给该计算机的IP地址的ARP请求和它接收请求的NIC的MAC地址。 此外,Linux默认情况下会接受任何目标为本地在计算机上configuration的IP地址的网卡上的IP数据包。 所以,
上面的sysctl设置限制了这样的行为,使得Linux只会响应IP地址的ARP请求(如果IP地址被分配给该NIC),并且该请求来自通过该NIC可访问的IP地址。 这些可调参数logging在内核源代码发行版的文件ip-sysctl.txt中。
你所看到的是有意的行为,而我所build议的就是改变事情的行动,因为你看起来渴望更多。 祝你好运。