Skip to Content

Find MAC address in Ubuntu

A Media Access Control (MAC) address is a unique identifier assigned to most network adapters or Network Interface Card (NIC) by the manufacturer. The MAC address consists of 6 byte hexadecimal numbers, and can be used to uniquely identify the NIC on a network.

Example of MAC address: a0:b1:c2:d3:e4:f5

How does MAC address work in Ubuntu?

You might wonder what is the MAC address used for. Let’s figure it out.

In Ubuntu, the MAC address can be used to configure networking. For instance, if an administrator needs to specify which computer or device should have access to the network, they often use the MAC address of that machine as a way of granting it permission.

The MAC address can also be used in DHCP environment.  DHCP or Dynamic Host Configuration Protocol is a protocol used for assigning IP addresses to devices on a network. The DHCP server uses the MAC address of each device to uniquely identify it and then assigns it an IP address from a pool of available addresses.

How to find the MAC address of your Ubuntu system?

You can use ip link show command to find your MAC address. This command will list all network devices with their type and MAC addresses.

You can also view the MAC address of a specific interface using the ip link show interface_name command.

For example:

ip link show enp0s3

This will show all information about this device enp0s3, including its MAC address. The output should look something like this:

2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT qlen 1000
link/ether a0:b1:c2:d3:e4:f5 brd ff:ff:ff:ff:ff:ff

The “link/ether” field contains the MAC address. In this example, it is a0:b1:c2:d3:e4:f5. You can use this information to identify and configure the network on your Linux system.

You can also easily find the MAC address of your Ubuntu system using the command line tool ifconfig. Type the following command in a terminal window:

ifconfig -a

This will display all network interfaces configured on your system, including their MAC addresses. The output should look something like this:

eth0 Link encap: Ethernet HWaddr a0:b1:c2:d3:e4:f5

The “HWaddr” field contains the MAC address of your network adapter.

If you need to find the MAC address of a specific adapter, you can use the ifconfig interface_name command.

We can also get MAC information about the network interface using this command cat /sys/class/net/*/address in Ubuntu.

sysfs is a virtual filesystem in Ubuntu that provides a way to access and manipulate the parameters of devices. sysfs is mounted on /sys when your system boots. 

# cat /sys/class/net/ens1f0/address
70:ca:9b:ce:67:ae

$ cat /sys/class/net/*/address
02:01:e4:a2:3a:31
00:00:00:00:00:00

MAC address vs. IP address: What’s the difference and why it matters in Ubuntu?

The MAC address and IP address are two different types of addresses used in networking.

The MAC address, also known as the hardware or physical address, is a unique identifier assigned to each network adapter present on a device. It is usually written in hexadecimal form, consisting of 12 digits (e.g. a0:b1:c2:d3:e4:f5). The MAC address is used to identify a specific device on the network, and it can’t be changed or altered.

The IP address is an identifier that is assigned to each device connected to a network. It consists of four groups of numbers separated by periods (e.g. 192.168.1.2). Unlike the MAC address, it can be changed or altered depending on the network setup and configuration.

With these details in mind, you can now easily configure your Linux system to use both addresses correctly. This will ensure that all of your network connections are secure and reliable.