局域网通过ip查mac地址、通过mac地址查ip方法

时间:2023-04-15 15:49:19
sh-4.1# which arp #linux主机A
/sbin/arp
sh-4.1# arp -a 192.168.1.10 #主机B的IP
bogon (192.168.1.10) at :8t:8p::: [ether] on br0
h-4.1# ifconfig|egrep "^br0" #主机B
br0 Link encap:Ethernet HWaddr :8T:8P:::

通过MAC查IP

sh-4.1# arp -a |egrep "50:9b:6d:15:68:41"
bogon (192.168.1.10) at :9b:6d::: [ether] on br0
sh-4.1# cat /proc/net/arp|egrep "50:9b:6d:15:68:41"
192.168.1.10 0x1 0x2 :9b:6d::: * br0

注意MAC里的字母都是 用小写的。其实真正的MAC地址是大写的!!!!