在 CentOS 系统中,你可以使用 ifconfig 命令来查看网络接口的详细信息,包括 MAC 地址。以下是具体步骤:
打开终端。
输入以下命令并按下回车键:
ifconfig
在输出的信息中,找到你想要查看 MAC 地址的网络接口。通常,网络接口的名称类似于 eth0、ens33 或 wlan0 等。
在该网络接口的信息部分,查找 ether 字段,其后显示的就是 MAC 地址。例如:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::a00:27ff:fe4e:66a1 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:4e:66:a1 txqueuelen 1000 (Ethernet)
RX packets 123456 bytes 12345678 (11.7 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 654321 bytes 6543210 (6.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
在这个例子中,eth0 接口的 MAC 地址是 08:00:27:4e:66:a1。
如果你只想查看 MAC 地址,可以使用 grep 命令来过滤输出:
ifconfig | grep ether
这将只显示包含 ether 字段及其后 MAC 地址的行。