How to Find your Mac Address on Ubuntu
Media Access Control, commonly known as the MAC address is a unique identifier assigned to network interfaces. MAC addresses plays a crucial role in networking as it allows a device to be identified by other devices in the network.
In this tutorial, we will explore the various methods you can use to find and identify the MAC address of a network interface on Linux devices using native tools.
Using the ifconfig command
The ifconfig
command is a traditional tool for managing network interfaces in Linux systems.
To find the MAC address using ifconfig
, you can run the command:
ifconfig
The command should return an output as shown below:
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:62:2b:12:0f txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.11.129 netmask 255.255.255.0 broadcast 192.168.11.255
inet6 fe80::80cd:f2d3:bb55:29e prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:9d:72:70 txqueuelen 1000 (Ethernet)
RX packets 6412 bytes 8998465 (8.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1426 bytes 117164 (117.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 251 bytes 21543 (21.5 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 251 bytes 21543 (21.5 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Look for the network interface whose MAC address you want to find.
For example, to find mac address of the ethernet interface, locate the eth0
or ens33
or any device in that format.
For wireless devices, locate the interface following the format of wlan0
or similar format.
The MAC address will be listed next to it, consisting of six pairs of hexadecimal numbers separated by colons. For example, the MAC addresses from the above output are:
ens33 -> 00:0c:29:9d:72:70
Using the IP Command
The second and more modern method of finding the mac address of a given interface is using the ip
command. Use the command as shown:
ip link
The command will return an output as shown:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether 00:0c:29:9d:72:70 brd ff:ff:ff:ff:ff:ff
altname enp2s1
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default
link/ether 02:42:62:2b:12:0f brd ff:ff:ff:ff:ff:ff
Locate the network interface you are interested in, which will be displayed as a numbered list
Conclusion
In this tutorial, we explored two main methods you can use to find the mac address of your network interface in a Linux system.