How to Find Your MAC Address on Linux
As a Linux user, you may need to know the MAC address of your network interface card (NIC) for various reasons, such as troubleshooting network issues, setting up static IP addresses, or configuring firewall rules. The MAC address, also known as the physical address or hardware address, is a unique identifier assigned to each NIC by the manufacturer. In this article, we will discuss how to find your MAC address on Linux.
Method 1: Using the ifconfig Command
The easiest way to find your MAC address on Linux is to use the ifconfig command. Ifconfig is a command-line utility that displays network interface configuration information, including the MAC address. Here is how you can use it:
1. Open the terminal on your Linux system by pressing Ctrl+Alt+T.
2. Type the following command and press Enter to view the network interfaces on your system:
ifconfig
3. Locate the network interface for which you want to find the MAC address. The interface names can be eth0, eth1, enp3s0, wlo1, etc. depending on your system and the NIC type.
4. Once you have identified the interface, look for the “HWaddr” field in the output. This field displays the MAC address of the interface in the format xx:xx:xx:xx:xx:xx. For example, if the interface is eth0, the output will look like this:
eth0: flags=4163 mtu 1500
inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::3e97:eff:fe74:1c07 prefixlen 64 scopeid 0x20
ether 3c:97:0e:74:1c:07 txqueuelen 1000 (Ethernet)
RX packets 34165 bytes 32898208 (31.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 15507 bytes 3889195 (3.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
In the above output, the MAC address of eth0 is 3c:97:0e:74:1c:07.
Method 2: Using the ip Command
Another way to find your MAC address on Linux is to use the ip command. Ip is a replacement for the older ifconfig command and provides more detailed network information. Here are the steps:
1. Open the terminal on your Linux system by pressing Ctrl+Alt+T.
2. Type the following command and press Enter to view the network interfaces on your system:
ip link
3. Identify the network interface for which you want to find the MAC address. The interface names can be similar to those in ifconfig output.
4. Once you have identified the interface, look for the “link/ether” field in the output. This field displays the MAC address of the interface in the format xx:xx:xx:xx:xx:xx. For example, if the interface is enp3s0, the output will look like this:
2: enp3s0: mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 3c:97:0e:74:1c:07 brd ff:ff:ff:ff:ff:ff
In the above output, the MAC address of enp3s0 is 3c:97:0e:74:1c:07.
Conclusion
Whether you prefer using ifconfig or ip command, finding your MAC address on Linux is a straightforward process. Knowing your MAC address can be very helpful in troubleshooting network issues, identifying devices on a network, and configuring your system for optimal performance.