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 does Linux check the MAC address

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article is about how to check the MAC address of Linux. The editor thinks it is very practical, so I hope you can get something after reading this article. Let's take a look at it with the editor.

MAC address is used to define the location of network equipment, which is composed of 48 bits long, hexadecimal digits. 0 to 23 digits are the unique identifiers of the organization and the identification of LAN (local area network) nodes.

Linux check the specific method of MAC address

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 addr 1: lo:mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00 link/ether 00 scope host valid_lft forever preferred_lft forever:: 1 eth0:mtu 128 scope host valid_lft forever preferred_lft forever 2: 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 forever2 、 Check the mac address of a network card on this computer For example, eth0,# cat / sys/class/net/eth0/address

[root@cwaf ~] # cat / sys/class/net/eth0/address 00:0c:29:16:e9:853, 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.59 PING 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 ms 64 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 1001ms rtt min/avg/max/mdev = 0.179proc/net/arp 0.191 ether 8c:ec:4b:c3:a3:32 0.012 ms [root@cwaf ~] # [root@cwaf ~] # arp-n 172.18.32.59 Address HWtype HWaddress Flags Mask Iface 172.18.32.59 ether 8c:ec:4b:c3:a3:32 C eth05, view the arp table at # cat / proc/net/arp

[root@cwaf] # cat / proc/net/arp IP address HW type Flags HW address Mask Device 172.18.32.59 0x1 0x2 8c:ec:4b:c3:a3:32 * eth0 172.18.32.76 0x1 0x2 00:0c:29:5a:30:b6 * eth0 and above is how to check the MAC address of Linux. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please 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