linux 下查mac

时间:2023-03-09 08:39:33
linux 下查mac
sh-4.1# cat /sys/class/net/eth0/address
4c:cc:6a::9a:
sh-4.1# ifconfig -a |grep 'HWaddr'|awk '{print $5}'
4C:CC:6A::9A:

查看连接到本机的远端ip的mac地址:

sh-4.1# cat /proc/net/arp
IP address HW type Flags HW address Mask Device
10.100.0.195 0x1 0x2 1c:::f3:af:0f * eth0
10.100.0.183 0x1 0x2 ::::: * eth0
10.100.0.235 0x1 0x2 ac:c1:ee:c0:: * eth0
10.100.0.127 0x1 0x2 ::ba:ee:e8:f0 * eth0
10.100.0.50 0x1 0x2 2c:5b:b8:a7:8c: * eth0