How to change your MAC address in Ubuntu 22.04?

Would you like to change the MAC address of your network device in Ubuntu 22.04? Is it even possible? Is it difficult? In this article, I will show you how easy it is to change your MAC address in Ubuntu 22.04. You can use the same instructions on earlier Ubuntu versions as well, but the article has been written and tested while running it on Jammy Jellyfish, that is, Ubuntu 22.04.

First of all, if you wonder which version of Ubuntu you have installed, run the following command.

lsb_release -a

If you run this command, you might see an answer looking something like this.

check my ubuntu version in command line

But, that isn’t really what this article is about. Let us find your current MAC address, and then find out how to change it.

What is a MAC address?
A MAC address is the personal address of any hardware you have connected to a network. This is the personal identifier of this device, and the MAC address is a 12-digit hexadecimal number. It normally looks something like this: 1a:2b:3c:22:33:2d. MAC addresses. As you can see, there are 12 digits, each consisting of 4 bits. As a result, a MAC address is 48-bit address space. This leads to the fact that there are approximately 281 trillion possible MAC addresses in the world. MAC is an abbreviation for Media Access Control.

change mac address in ubuntu 22.04

How to find your present MAC address?

The first thing you should do is find your current MAC address. Run the following command in the Ubuntu command line first.

sudo apt install macchanger

This will install a program named Macchanger making it very easy to change or restore your MAC address at any time. It might be that the application is installed already. If it is, you do not have to run the command above.

Now that you have Macchanger installed, run the following command to see the network devices running on your computer.

ip link show

You will now see information about the network devices running on your computer. It will also show you the MAC address of your device. In my case, the network device is called enp3s0. It might have the same name on your computer, or it might be called ETH0 or something like that.

Now that you know the name of your network device, run the following command. Do not forget to change enp3s0 with the name of your network device.

macchanger -s enp3s0

You will now see the current MAC address of your network device (which should be the same as the permanent address unless you have messed with changing your MAC address already).

In order to change the MAC address of your device, run the following command. Once again, do not forget to swap enp3s0 with the name of your network device on which you want to change the MAC address.

sudo macchanger -r enp3s0

This will give your network device a new random MAC address. If you want to give your network device a fixed MAC address (that you decide), use the following command.

sudo macchanger --mac=aa:bb:cc:dd:11:22 enp3s0

Do not forget to use change the name of the network device, and also to change the MAC address to the one you actually want to use.

Have you been playing around with this for a while? Would you like to get your factory MAC address back? It is very easy to get your permanent MAC address in return.

sudo macchanger -p enp3s0

The -p command will make sure that the permanent address is restored. If you want to check that everything is working properly, run the macchanger -s enp3s0 command once again.

Restart your network device in Ubuntu 22.04.

It might be that it will take some seconds or more for the changes to take place. A quick way to help things happen faster is to stop your network device and then start it again. You can do so using the following commands.

sudo ip link set enp3s0 down
sudo ip link set enp3s0 up

Here you are forcing the device to turn off and then (down command) and then later you turn it on again with the up command.


That’s it. You are now ready to change the MAC address of your network device. Why would anyone do this? That is a brilliant question. It might be that you want to change your MAC address only for fun, or for the sake of curiosity. Or maybe you are locked out of a network and the only way to get access is by using the MAC address of another device of yours (that has access to the network based on the MAC address)?

No matter what, you should now be able to get the job done! Would you like to read more articles dealing with online security, VPN services, and Ubuntu? Look around in our IP Address Guide and you will for sure find lots of interesting content.

Leave a Reply