In this guide, we will be showing you how to find your Raspberry Pi’s MAC address.
The MAC address is a unique identifier that every network controller has. These unique identifiers are used to identify a given device within a network.
Unlike an IP address, these are not assigned by the router. Instead, they exist as an identifier within the network interface itself.
For example, the modern Raspberry Pi’s that have built-in Wi-Fi feature two MAC addresses. One MAC address for the ethernet interface, and the other address for the Wi-Fi interface.
The address that your network sees is the one associated with the network interface you connected to it with. So, if you are using the ethernet interface, it will see that MAC address. If you are using your Wi-Fi interface, it will see that MAC address.
It is also possible to spoof the MAC address for your Pi’s network interfaces.
Within this guide we are going to show you a couple of ways of getting these MAC addresses by making use of the command line.
Equipment
Below is the equipment that we used when finding the MAC address of our Raspberry Pi.
Recommended
- Raspberry Pi ( Amazon )
- Micro SD Card ( Amazon )
- Ethernet Cable ( Amazon ) or Wi-Fi ( Amazon )
- Power Supply ( Amazon )
Optional
Using the Command-Line to Find the MAC Address
There are a couple of different methods you can use to determine the MAC address of your Raspberry Pi’s network interfaces.
We will be showing you three different methods that you can use to find the MAC address of your Raspberry Pi.
The first two are the easiest methods to use, but we also have an additional method if you run into issues with the first two.
Using the ip Command to Retrieve the MAC Address
The ip
command is the easiest way to find your Raspberry Pi’s MAC address.
1. Before we can find the MAC address, we should list out our available interfaces.
To be able to list all of these, we will be making use of the ip
command.
ip link show
By using “link show
” we are telling the IP tool to list (show
) all of the network devices (link
).
2. From this command you will get a response like we have below
ip link show
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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether dc:a6:32:05:7f:03 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DORMANT group default qlen 1000
link/ether dc:a6:32:05:7f:05 brd ff:ff:ff:ff:ff:ff
In our result you can see that we have three network interfaces back, lo
, eth0
, and wlan0
You can find the mac address for an interface after the link/ether
text.
For example the MAC address for our eth0
connection is, dc:a6:32:05:7f:03
.
Using the iconfig Command
In this section, we will show you how to use the ifconfig
tool to retrieve the Pi’s mac address.
There are two different ways that you can use this command to find your Raspberry Pi MAC address.
Getting the MAC Address for All Network Interfaces
The easiest way to use the ifconfig
command is to use it with the -a
option.
This option allows us to return the details for all our Raspberry Pi’s network interfaces, including the MAC address.
1. To use this option all we need to do is reference ifconfig
followed by the -a
option.
ifconfig -a
2. From this command you should recieve something like we have below.
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.115 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::738f:5408:40c:738c prefixlen 64 scopeid 0x20
ether dc:a6:32:05:7f:03 txqueuelen 1000 (Ethernet)
RX packets 1016123 bytes 166745552 (159.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 125520 bytes 86677269 (82.6 MiB)
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
loop txqueuelen 1000 (Local Loopback)
RX packets 2006342 bytes 137667347 (131.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2006342 bytes 137667347 (131.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether dc:a6:32:05:7f:05 txqueuelen 1000 (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
In this result you can see that each of the available network devices have been dispalyed.
You can identify the MAC address for each of these devices by looking for ether
or HWaddr
.
The value next to these is the MAC address.
For example, the MAC address for our wlan0
connection is dc:a6:32:05:7f:05
.
Getting the MAC Address for a Specific Interface
It is also possible to use the ifconfig
command to show the MAC address of a specific network interface.
1. For this method, all we need to do is specify the ifconfig
command followed by the interface’s name.
Make sure that when you use this command, you replace [NETWORK INTERFACE]
with the interface’s name.
ifconfig [NETWORK INTERFACE]
For example, if we wanted to get the MAC address of our wlan0
connection, we can run the following command.
ifconfig wlan0
2. By using this command, you should get the details of the connection in the terminal.
For example, we got the following back from our wlan0
interface.
wlan0: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether dc:a6:32:05:7f:05 txqueuelen 1000 (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
The value that you are looking for in this result should start with either ether
or HWaddr
Next to these should be a 6-octet value like the following.
dc:a6:32:05:7f:05
This value is the MAC address for the specified Raspberry Pi’s network interface.
Using the cat Command
One of the easiest ways to get information about your Raspberry Pi’s network interfaces is to use the cat
command.
We can use the cat
command to retrieve information from files. These files are located within the /sys/class/net/
directory and store information, such as the devices MAC address.
All we need to know for this method is the name of the interface, for example, wlan0
.
1. Run the following command to find the mac address of the specified network interface.
Before you run the command make sure that you replace [NETWORK INTERFACE]
with the name of the network
cat /sys/class/net/[NETWORK INTERFACE]/address
2. From this, you should end up seeing your Raspberry Pi’s MAC address.
This address will be a six-octet value like we have shown below.
xx:xx:xx:xx:xx:xx
You should now hopefully have found the MAC address for your Raspberry Pi’s network interfaces.
If you have run into any issues with finding the address, leave a comment below.