How to find your MAC address on Linux

If you’re managing a Linux system, you’ll probably occasionally need to know your system’s MAC address. You may need this information for a number of reasons. You might want DHCP to assign you a fixed IP address. To do this, you will need the MAC address so that you can add IP and MAC address mapping to your DHCP server configurations.


You may also need this information for MAC address filtering to allow or block specific devices on your network. Or maybe you want to set up Wake-on-LAN. Whatever the reason, here are a few different ways to find the MAC address on your Linux system.


What is a MAC address?

A MAC address, also known as a physical or hardware address, is a unique identifier associated with a network interface card on pretty much any device connected to a network.

The MAC address operates on the second layer (data link layer) of the OSI model and is 48 bits long, with the first 24 bits representing the Vendor ID and the last 24 bits representing the unique ID for that NIC. Like IP addresses, you can also change the MAC address of your network card.

Find MAC address on Linux from command line

Here are some of the quickest and easiest ways to find your MAC address on Linux:

With the ip command

You can use the ip command in Linux to view and configure physical and virtual network interfaces, routing, policy routing, and tunnels. It can add or delete a network interface, assign/remove IP addresses, view network interface status and perform many other useful tasks.

You can find your system’s MAC address with the following ip command:

 ip link show 

This command will show the details of all network interfaces including their MAC addresses next to the label link/ether as highlighted below:

To find the MAC address of a specific network interface, use the following syntax:

 ip link show dev 

Using the ifconfig command

You can use the ifconfig command in Linux to configure and view the status of network interfaces. In addition, it can also enable and disable a network interface.

To find the MAC address of all available network interfaces (even if they are disabled), use the ifconfig command with the -a flag as follows:

 ifconfig -a 

To find the MAC address of a specific network interface, provide its name as an argument:

 ifconfig interface_name 

To find the MAC address of all currently active network interfaces, use the ifconfig command with no flags:

 ifconfig 

In the output you will find the MAC address of your interface next to the label ether as highlighted below:

Find Mac address using ifconfig command

Using the ethtool utility

ethtool is a Linux utility that allows you to query and configure network drivers and network card settings. You can also use the ethtool utility to query a network interface for its MAC address.

Here is the command to do this:

 ethtool -P interface_name
find mac address with ethtool

Get the MAC address from the /sys/class/net directory

That /sys/class/net The directory contains information about the network devices connected to the system. This directory maintains a separate subdirectory for each of the network interfaces such as /sys/class/net/ens33 and /sys/class/net/ens37.

Each subdirectory contains different files for each network attribute such as MAC address, network device operating status, duplex, MTU, etc. The MAC address information is stored in address File.

Use the following command to list the network interfaces attached to your system:

 ls /sys/class/net
List directory contents

To find the MAC address of a specific network interface, use the following command syntax:

 cat /sys/class/net/interface_name/address 

For example, let’s say to find the MAC address of a network interface ens33the command would be:

 cat /sys/class/net/ens33/address 
Locate the Mac address in the /sys/class/net directory

How to find MAC address on Linux via GUI

If you prefer GUI for your routine tasks, you can find your MAC address graphically with the network manager provided by your distribution. As in Ubuntu, you can use the network connection settings.

Open settings in your Linux distribution either by right-clicking on your desktop or via the application menu. In the left pane, go to network Tab. This will display all network interfaces connected to your system.

To find the MAC address of a network interface, click Tooth (Settings) icon in front of it.

Locate the MAC address using the GUI

This will open a new window with the details of your network interface. Here you will find the MAC address next to the label hardware address.

Find the MAC address using the network connection settings

For this guide, we’ve used GNOME for the images, but other desktop environments would also have similar settings, just with different names.

Find the MAC address of another system on a local network

Similar to finding your own MAC address, you can also find the MAC address of other systems on a local network. Here’s how:

Using the arp command

You can use ARP or Address Resolution Protocol to find out the MAC address for a specific IP address. To find the MAC address of another system on a local network, ping its IP address with:

 ping -c1 <IP address> 

The ping command uses ARP to learn the MAC address of the remote system. Once it gets this information, it is stored in the ARP table, which you can view with:

 arp -n | grep <IP address> 

This command prints the MAC address for the specified IP address.

find mac address with arp

Using the Arping utility

The Arping utility helps you discover and probe local systems on a network. It works on the second layer in the OSI model and sends the ARP request to the system to see if it is up and responding. It differs from the ping utility, which works at the third level.

You can install Arping with the following commands:

On Debian-based distributions:

 sudo apt install arping 

On RHEL-based distributions:

 sudo yum install arping 

After installation, find the MAC address of another system on a network by providing its IP address as an argument with the following command:

 sudo arping -c 1 <IP address> 

If your system has multiple NICs, you can use to specify which interface to send a request from -I Flag (uppercase “i”) followed by the name of the interface:

 sudo arping -c 1 -I interface_name <IP address> 

For example, the following command sends an ARP request from its ens33 Interface to the IP address of the remote system 192.168.42.133.

 sudo arping -c 1 -I ens33 192.168.42.133 

In the output you get the ARP response of the target system with its MAC address.

find mac address with arping

It’s easy to find your MAC address on Linux

Given the various methods of finding MAC address on Linux, you can choose one that you find convenient.

Similar to Linux, you can also find the MAC address in Windows and macOS; However, they have different command sets and GUIs.

Leave a Reply

Your email address will not be published. Required fields are marked *