在 Ubuntu 中,你可以使用 ifconfig
命令來查看網絡接口的 MAC 地址。以下是具體步驟:
打開終端(Terminal)。你可以通過按下 Ctrl + Alt + T
快捷鍵來打開終端。
輸入以下命令并按下回車鍵:
ifconfig
這將顯示所有網絡接口的詳細信息。
在輸出的信息中,找到你想要查看 MAC 地址的網絡接口。通常,以太網接口會命名為 eth0
或 enpXsY
(例如 enp2s0
),而無線網絡接口可能被命名為 wlan0
或 wlpXsY
(例如 wlp3s0
)。
查找該接口的 ether
行,該行顯示的就是 MAC 地址。例如:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.10 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 100341 bytes 12345678 (12.3 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 98765 bytes 87654321 (87.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
在這個例子中,ether 08:00:27:4e:66:a1
就是 MAC 地址。
如果你只想查看特定接口的 MAC 地址,可以使用 grep
命令來過濾輸出。例如,如果你想查看 eth0
接口的 MAC 地址,可以輸入:
ifconfig eth0 | grep ether
這將只顯示 eth0
接口的 MAC 地址信息。