钟二网络头像

钟二网络

探索SQL查询技巧、Linux系统运维以及Web开发前沿技术,提供一站式的学习体验

  • 文章92531
  • 阅读1015145
首页 Linux 正文内容

linux看mac地址

钟逸 Linux 2025-05-01 03:19:38 20

MAC 地址(媒体访问控制地址)是分配给网络设备(如网卡)的唯一标识符。在 Linux 系统中,有多种 可以查看 MAC 地址。

使用 ip 命令

ip 命令是 Linux 中用于管理网络接口和配置的强大工具。要使用 ip 命令查看 MAC 地址,请运行以下命令:

ip addr show

此命令将显示所有网络接口的详细配置,包括它们的 MAC 地址。在输出中,您会看到类似以下内容的行:

3: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

link/ether 12:34:56:78:9a:bc brd ff:ff:ff:ff:ff:ff

其中,"12:34:56:78:9a:bc" 是 eth0 接口的 MAC 地址。

使用 ifconfig 命令

ifconfig 命令是另一个常用的 Linux 工具,用于管理网络接口。要使用 ifconfig 命令查看 MAC 地址,请运行以下命令:

ifconfig

此命令将显示所有网络接口的当前状态,包括它们的 MAC 地址。在输出中,您会看到类似以下内容的行:

eth0: flags=4163 mtu 1500

inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255

inet6 fe80::219:2bff:fe0e:918c prefixlen 64 scopeid 0x20

ether 12:34:56:78:9a:bc txqueuelen 1000 (Ethernet)

RX packets 1013916 bytes 211096313 (211.0 MB)

RX errors 0 dropped 0 overruns 0 frame 0

TX packets 915516 bytes 79005208 (79.0 MB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

其中,"12:34:56:78:9a:bc" 是 eth0 接口的 MAC 地址。

使用 ethtool 命令

ethtool 命令用于管理和诊断以太网设备。要使用 ethtool 命令查看 MAC 地址,请运行以下命令:

ethtool -i eth0

此命令将显示有关 eth0 接口的详细信息,包括其 MAC 地址。在输出中,您会看到类似以下内容的行:

driver: tg3

version: 3.152.04-lkml

firmware-version: N/A

bus-info: 0000:01:00.0

supports-statistics: yes

supports-test: no

supports-eeprom-access: yes

supports-register-dump: yes

supports-priv-flags: no

Link detected: yes

EEPROM-version: N/A

driver name: tg3

module: tg3

version: 3.152.04-lkml

firmware-version: N/A

expansion-rom-version: N/A

bus-info: 0000:01:00.0

supports-statistics: yes

supports-test: no

supports-eeprom-access: yes

supports-register-dump: yes

supports-priv-flags: no

Link detected: yes

Link fiber: no

Speed: 1000Mb/s

Duplex: full

Port: MDI

PHYAD: 1

Transceiver: internal

Auto-negotiation: on

MDI-X: on

Supports Wake-on: pumbg

Wake-on: d

Current message level: 0x00000007 (7)

Link down: 0

Link up: 100000

RS-ERR: 0

RX-ERR: 0

RX-NOBUF: 0

TX-ERR: 0

TX-ABORT: 0

TX-CARR: 0

TX-FIFO: 0

RX-FIFO: 0

RX-LENGTH: 0

RX-OVERSIZE: 0

RX-JABBER: 0

RX-ALIGN: 0

RX-BADSIZE: 0

RX-CRC: 0

RX-NOALIGN: 0

TX-ABORT: 0

TX-UNDERRUN: 0

PCS: 0

FC: 0

MAC address: 12:34:56:78:9a:bc

Max speed: 1000Mb/s

Min speed: 10Mb/s

Real Port: MDI

Transceiver: internal

Supported Ports: [ TP MII ]

Supported link modes: 10baseT/Half 10baseT/Full

100baseT/Half 100baseT/Full

1000baseT/Half 1000baseT/Full

Supported pause frames: no

Supports auto-MDIX: yes

Supports TP-MDI-X: no

Supports Wake-on: pumbg

Wake-on: d

Link status: up

PHY type: internal

其中,"12:34:56:78:9a:bc" 是 eth0 接口的 MAC 地址。

文章目录
    搜索