共计 816 个字符,预计需要花费 3 分钟才能阅读完成。
using ifconfig to check MAC address
ifconfig -a
ens1f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.124.202.230 netmask 255.255.255.128 broadcast 10.124.202.255
ether 70:ca:9b:ce:67:ae txqueuelen 1000 (Ethernet)
RX packets 12187970 bytes 7390885300 (6.8 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 16813496 bytes 16253942714 (15.1 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xb1960000-b197ffff
Using IP link show to get mac address
ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens1f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 70:ca:9b:ce:67:ae brd ff:ff:ff:ff:ff:ff
from /sys to get mac address
more /sys/class/net/ens1f0/address
70:ca:9b:ce:67:ae
3 ways to get Mac address in Linux
正文完