温馨提示×

如何通过Ubuntu ifconfig查看MAC地址

小樊
33
2025-12-15 02:35:33
栏目: 智能运维

在 Ubuntu 中,你可以使用 ifconfig 命令来查看网络接口的详细信息,包括 MAC 地址。以下是具体的步骤:

  1. 打开终端。你可以通过按下 Ctrl + Alt + T 快捷键来打开终端。

  2. 输入以下命令并按下回车键:

    ifconfig
    
  3. 这将显示系统中所有网络接口的详细信息。你可以查找类似于 eth0wlan0 的接口名称。

  4. 在接口的详细信息中,找到 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 1003411  bytes 123456789 (117.7 MiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 987654  bytes 987654321 (941.5 MiB)
            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 地址信息。

0