2015-09-25 233 views
0

我正在尝试从我的wifi网络上的arp -a扫描中显示的设备中查找MAC地址。如何从Mac终端中调用“arp -a”的这些结果获取MAC地址?如何从arp -a扫描中查找MAC地址

? (10.10.40.1) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
us114-appletv.francisparker.org (10.10.40.92) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
03089mac.francisparker.org (10.10.40.236) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
02543mac.francisparker.org (10.10.41.9) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
us113-dwalcott-0.francisparker.org (10.10.41.83) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
meghans-air.francisparker.org (10.10.41.123) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
faiths-mbp-2.francisparker.org (10.10.41.132) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
09150mac.francisparker.org (10.10.41.144) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
02758mac.francisparker.org (10.10.41.219) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
02769mac.francisparker.org (10.10.41.234) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
? (10.10.42.99) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
? (10.10.42.113) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
? (10.10.44.44) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
? (10.10.44.201) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
? (10.10.45.77) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
? (10.10.45.123) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
? (10.10.45.151) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
? (10.10.46.6) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 
? (10.10.46.137) at 0:90:b:2e:bf:ff on en0 ifscope [ethernet] 

谢谢!

回答

1

你的问题有点不清楚; MAC地址清楚地列在上面的输出中。我假设你的意思是“如何将arp输出转换成一个换行符分隔的MAC地址列表?”这只是一个微不足道的cut来获得第四列。

arp -a | cut -d' ' -f 4 
+0

对不清楚的问题。我仍然想知道为什么你的建议的输出为每一行提供相同的MAC地址?另外,当我查找自己的MAC地址时,它的格式不同 – pbullard2017

+0

您可能有一台网络设备(可能是交换机,也可能是一台安全设备),它将自身作为所知道的所有IP的地址返回。看起来这个装备是由Lanner制造的。 http://www.lannerinc.com我不知道你期望的MAC地址格式。那些看起来很正常。八位字节没有前导零(有时工具打印前导零,有时它们没有) –

+0

任何获得设备MAC的方法,而不是所有设备返回的方法?顺带一提,感谢您的帮助。学习了不少! – pbullard2017

0

尝试:

arp -n xxx.xxx.xxx.xxx 

例如我合勤路由器的MAC地址:

arp -n 192.168.1.1 

显示:

? (192.168.1.1)在c8:6c:87:xx:xx:在en0上ifscope [ethernet]