Error
Error
Error
Subscribed
The request was successfully sent
Error
Message sent
Error
There is "Maxnet" coverage at Your address
The request was successfully sent
No coverage
Error
Feedback sent successfully
Error
Feedback sent successfully
Error
Request sent successfully
Error
CV sent successfully
The request for the domain transfer is successfully sent
Error
02.03.2025
Internet
754
Previously, we told you about the MAC address and how to find it and change it in Windows. In this article, you will learn how to do it in different ways if you have Linux installed on your computer.
How to find the MAC address at the command line
Using the ip command
The ip command in Linux allows you to add or remove a network interface, assign or remove IP addresses, display the status of network interfaces, and perform other useful tasks. You can find out the MAC address of your system by using the following ip command:
This command shows information about all network interfaces, including their MAC addresses, except for the link/ether label, as shown below:
The ip link show command will also help you find out the MAC address of a particular network interface.
Using the ifconfig command
The ifconfig command in Linux allows you to configure and display the status of network interfaces. It also makes it possible to activate and deactivate a network interface.
To find out the MAC addresses of all available network interfaces (even deactivated ones), use the ifconfig command with the -a parameter in this way:
To find out the MAC address of a specific network interface, specify its name as an argument:
To find out the MAC addresses of all active network interfaces, use the ifconfig command without any parameters:
In the raw data, you can find the MAC address of your interface as shown below:
Using the ethtool utility
The ethtool is a Linux utility that allows you to query and configure network drivers and network card settings. With the ethtool utility, you can also query a network interface for its MAC address.
Here is the command to do this:
How to get MAC address from /sys/class/net directory
The /sys/class/net directory contains information about the network devices connected to the system. This directory has a separate subdirectory for each network interface, for example,/sys/class/net/enp0s3 and /sys/class/net/ens37.
Each subdirectory contains a different file for each network attribute: MAC address, the operating state of the network device, its duplex, its MTU, etc. The MAC address information is stored in the address file.
To get a list of interfaces connected to your system, you can use this command:
You can find the MAC address of a particular network interface by using the following command syntax:
For example, to find the MAC address of a network interface (such as enp0s3), the command would look like this:
How to find the MAC address using the GUI
If you prefer a graphical interface, you can find your MAC address graphically using the network manager that comes with the distribution. To do this:
How to find the MAC address of another system on the local network
Similar to the procedure for finding your MAC address, you can also find the MAC addresses of other systems on the local network.
Using the arp command
You can use ARP (Address Resolution Protocol) or Address Resolution Protocol to find out the MAC address for a given IP address. To find the MAC address of another system on the LAN, ping its IP address using the following command:
The ping command will use ARP to obtain the MAC address of the remote system. The information obtained will be stored in an ARP table, which can be viewed using the command below:
Using the arping utility
The arping utility helps to detect and check local systems on the network. It functions similarly to the ping utility, but unlike the ping utility, it operates at layer 2 of the OSI model and uses the ARP protocol.
You can install arping using the following commands:
After installation, find the MAC address of another system on the network by specifying its IP address using the following command:
If your system has multiple network adapters, you can specify from which interface the request should be sent using the -I parameter (capital "i") followed by the interface name:
For example, the following command will send a single ARP request from its enp0s3 interface to the IP address of the remote system 10.0.2.2.
On output, you will receive an ARP response from the target system that contains its MAC address.
Now, knowing the different ways to find a MAC address in Linux, you can choose and use whichever one you like.
Rate
5.0
Share
Comments
0
Еще комментарии