Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to check the MAC address under Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to check MAC address under Linux". The content is simple and clear. I hope it can help you solve your doubts. Let me lead you to study and learn this article "how to check MAC address under Linux".

The MAC in the MAC address is the abbreviation of the English name MediaAccess Control, which is translated into media access control. People used to call it the network card address, the hardware address and the adapter address. The MAC address is like the ID card number on our ID card and has global uniqueness.

The following command is tested in a centos7 environment:

1. Check the MAC address of this machine. If you are above centos7, you can use # ip addr (use # ifconfig below centos7)

[root@cwaf ~] # ip addr1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 0012 qdisc pfifo_fast state UP group default qlen 0000 scope host lo valid_lft forever preferred_lft forever inet6:: 1 scope host valid_lft forever preferred_lft forever2: eth0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:16 : e9:85 brd ff:ff:ff:ff:ff:ff inet 172.18.32.62/24 brd 172.18.32.255 scope global eth0 valid_lft forever preferred_lft forever inet6 fe80::20c:29ff:fe16:e985/64 scope link valid_lft forever preferred_lft forever

2. Check the mac address of a network card on this machine, such as eth0,# cat / sys/class/net/eth0/address

[root@cwaf ~] # cat / sys/class/net/eth0/address00:0c:29:16:e9:85

3. Check the mac address of a network card on this machine, such as eth0

You can view the HWADDR=, through # cat / etc/sysconfig/network-scripts/ifcfg-eth0 if this field exists

4. Check the MAC address of a known IP address: use the ping command plus the arp command

The ping command is used to ensure that the arp information of the ip must exist in the arp cache.

[root@cwaf] # ping 172.18.32.59PING 172.18.32.59 (172.18.32.59) 56 (84) bytes of data.64 bytes from 172.18.32.59: icmp_seq=1 ttl=64 time=0.203 ms64 bytes from 172.18.32.59: icmp_seq=2 ttl=64 time=0.179 Ms ^ C-172.18.32.59 ping statistics-2 packets transmitted, 2 received, 0 packet loss Time 1001msrtt min/avg/max/mdev = 0.179 arp 0.191 to 0.203 0.012 ms [root@cwaf ~] # [root@cwaf ~] # arp-n 172.18.32.59Address HWtype HWaddress Flags Mask Iface172.18.32.59 ether 8c:ec:4b:c3:a3:32 C eth0

5. View the arp table through # cat / proc/net/arp

[root@cwaf] # cat / proc/net/arpIP address HW type Flags HW address Mask Device172.18.32.59 0x1 0x2 8c:ec:4b:c3:a3:32 * eth0172.18.32.76 0x1 0x2 00:0c:29:5a:30:b6 * eth0 above is "how to check under Linux" Read all the contents of the article "MAC address" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report