If you change the MAC address of your system, you can impersonate other devices on the same network. In this way you can receive data packets that were originally intended for the other device. This process is known as MAC spoofing.

Linux has tons of tools for changing your device's MAC address. But finding a reliable and stable utility that does the job is really complicated given the many choices available to a user.

By the end, you will have a brief understanding of MAC addresses and how to spoof your MAC address on Linux.

What is a MAC address?

A MAC address, or Media Access Control address, is a unique hexadecimal identifier used to identify a device on a network. It is also known as the "physical address" of a computer because it is embedded in the device's network interface card (NIC).

This is what a MAC address looks like:

55: de: bc: 7d: 45: df

Each device is assigned a unique MAC address when it is manufactured. Based on MAC addresses, you can uniquely identify millions of devices connected to the Internet.

In the OSI network model, MAC addresses are responsible for sending data to the correct device in the data link layer.

Change your MAC address on Linux

There are many reasons you might want to change your device's MAC address. You may want to bypass security restrictions on a network or mimick another device on the network to capture packets.

Whatever the reason, Linux tools have you covered. Here's how you can spoof your MAC address on Linux.

Use Macchanger

Macchanger is a terminal-based Linux utility that allows a user to change the default MAC address of their device.

To install it on Debian / Ubuntu:

sudo apt install macchanger

On Fedora, CentOS, or other RHEL-based distributions:

sudo dnf install macchanger
sudo yum install macchanger

Install Macchanger on Arch Linux:

sudo pacman -S macchanger

Every time you restart a network device (including Ethernet and Wi-Fi) you will be asked if you want to change your system's MAC address. Choose no and press Enter keep going.

Before starting the practice, you must first check the names of the network interfaces on your device. To do this, enter the following:

IP address


Get the name of the network interface linux

In the output, the name of the network interface for Ethernet is eth0. Similarly, the interface name for Wi-Fi is either wlan0 or wlp3s0.

You can easily identify the network interface names in case the labels are different for your system. Interface names beginning with "w"connects to Wi-Fi, while the interface names for Ethernet always begin with"e".

To check the current physical address of your computer, enter the following:

macchanger -s interface

…Where interface is the name of the network interface on which you want to obtain information.


Macchanger get Mac details

To assign a random MAC address to your device with macchanger, use the -R Flag:

macchanger -r interface

For example, to get the physical address for the eth0 Interface:

sudo macchanger -r eth0

Macchanger shows the original address and the current (changed) address in the output.

Assign random Mac address to macchanger

In addition to assigning a random address, you can also set a custom MAC address for your device. Just use the -m Flag with the standard command as follows:

sudo macchanger -m Interface for user-defined addresses

…Where custom address is the new MAC address you want to assign and interface is the name of the network interface.

So assign that. a custom MAC address eth0 Interface:

sudo macchanger -m 44: ee: bc: 6c: 76: ba eth0

With macchanger, you don't have to remember the original MAC address of your device for future reference. You can easily reset the changes to the default settings by using the -P Flag:

sudo macchanger -p eth0

Using ip and ifconfig commands

Although macchanger is easy to use and well-suited for beginners, advanced Linux users who want more control over its operation prefer to use the ip Command.

However, first make sure to write down the original MAC address of the interface before changing it. After changing the MAC address using the commands below, there is no way to automatically revert to the original address. You have to manually change the changed address to the original MAC.

Before you can change the MAC address of your device via ip, you must shut down the network interface.

sudo ip link set dev eth0 down

Then change the original MAC to a custom address as follows:

sudo ip link set dev eth0 address 44: ee: bc: 6c: 76: ba

Restart the network interface with IP:

sudo ip link set dev eth0 up

Check if the above command worked by tapping IP address into the terminal.

Change Linux Mac address with IP link

An alternative method of MAC spoofing is to use the ifconfig Command. Ifconfig stands for Interface configuration and is a standard Linux utility for managing network interfaces.

As with the ip command, you must shut down the interface before changing the physical address of your computer with ifconfig.

sudo ifconfig eth0 down

Then assign a custom MAC address to the interface.

sudo ifconfig eth0 hw ether 44: ee: bc: 6c: 76: ba

Restart the network interface with ifconfig as follows:

sudo ifconfig eth0 up

How to change the MAC address of a wireless interface (wlan0), just replace the occurrence of eth0 in the command with the name of the wireless interface.

sudo ifconfig wlan0 hw ether 44: ee: bc: 6c: 76: ba

Related: How to Find the Public IP Address on a Linux System

As with other cybersecurity techniques, MAC spoofing has a very fine line between legal and illegal. This depends heavily on the use case for which you are changing your MAC address.

For educational purposes and for learning? Definitely legal (but only if you try on your own network). To capture data packets and bypass security protocols on another network? Not recommended.

Like Linux, Windows and Mac users can view and change their device's MAC address. The main difference is in the interface that is used to perform the task. Linux users generally prefer the command line approach. On the contrary, most Windows and Mac users would feel at home with an easy-to-use graphical interface.

Change Mac address

How to change your MAC address on Windows

Playing around with network settings is not a favorite thing to do on the PC. Fortunately, some tasks are pretty easy. We'll show you how to change your MAC address on a Windows PC.

Continue reading

About the author

Deepesh Sharma
(80 published articles)

Deepesh is Junior Editor for Linux at MUO. He writes informational guides on Linux with the aim of providing a blissful experience for all newbies. I'm not sure about movies, but if you want to talk about technology, he's your type. In his spare time he can be found reading books, listening to different genres of music, or playing guitar.

From Deepesh Sharma

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive offers!

Click here to subscribe