mk.*_*k.. 31

使用ip命令代替过时的 ifconfig

命令

$ ip addr show

link/ether输出字段是 MAC 地址(对于 Wi-fi 和以太网连接,MAC 地址由 表示link/ether)。大多数情况下,这将出现在第二行中。

例子 :

$ ip addr show
1: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether a0:54:9f:53:b2:6e brd ff:ff:ff:ff:ff:ff
Run Code Online (Sandbox Code Playgroud)

在我的情况下a0:54:9f:53:b2:6e是 MAC 地址。


Bri*_*ntz 21

打开终端并运行 ifconfig:

$ ifconfig | grep HWaddr
Run Code Online (Sandbox Code Playgroud)

  • ifconfig 是“接口配置器”的缩写 (6认同)
  • 顺便问一下,你知道“ifconfig”中的“if”代表什么吗? (2认同)

小智 5

HWaddr在 Ubuntu 20.04.02 LTS 上, 的输出中没有ifconfig. 相反,看看ether

$ ifconfig | grep ether
Run Code Online (Sandbox Code Playgroud)