How to Find the MAC Address of Your Network Interface in Ubuntu

Every network interface card (NIC)—whether it’s an Ethernet port or a Wi-Fi adapter—possesses a unique hardware identifier known as a Media Access Control (MAC) address. Unlike IP addresses, which can change frequently based on your router’s DHCP settings, a MAC address is permanently burned into the hardware at the factory.

You may need to find your Ubuntu server’s MAC address to configure a static IP reservation on your router, troubleshoot network connectivity issues, or implement MAC filtering on a secure enterprise switch.

This guide explains how to quickly find the MAC address of any network interface in Ubuntu Linux using the terminal.

Method 1: Using the ‘ip link’ Command (Recommended)

The ip command is the modern, standard networking tool in all contemporary Linux distributions, completely replacing older, deprecated tools.

  1. Open your Ubuntu terminal or connect via SSH.
  2. Type the following command:
    ip link
  3. Press Enter.

The terminal will output a list of all your network interfaces (e.g., lo for loopback, eth0 or enp3s0 for Ethernet, and wlan0 for Wi-Fi).

Look at the specific interface you are interested in (usually the one starting with ‘e’ or ‘w’). Right beneath its name, look for the line starting with link/ether. The six pairs of hexadecimal digits following that (e.g., 00:1A:2B:3C:4D:5E) is your MAC address.

Method 2: Reading the Sysfs Files directly

In Linux, “everything is a file,” including hardware configuration. You can read the MAC address directly from the kernel’s virtual file system without needing to parse the output of a networking command. This method is incredibly useful if you are writing a bash script.

  1. First, run ls /sys/class/net/ to see a list of your interface names (e.g., enp3s0).
  2. Use the cat command to read the address file for that specific interface. For example:
    cat /sys/class/net/enp3s0/address
  3. Press Enter.

The terminal will print nothing but the MAC address string, making it perfectly clean for variable assignment in a script.

What About ifconfig?

You may see older tutorials telling you to run ifconfig to find your MAC address (listed as “HWaddr”). While this works perfectly fine on legacy systems, the net-tools package that provides ifconfig is deprecated and is no longer installed by default on fresh installations of Ubuntu 20.04 LTS and later. It is highly recommended that you learn to use ip link instead.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.