How to change the MAC address on Ubuntu 20.04 using Macchanger

Macchanger is an amazing Linux utility that can be used to view as well as to change the MAC address of any desired networking device. This utility can be conveniently installed on any Linux distribution and then you can use it just the way you like. In this article, we will begin with the installation of this utility on a Ubuntu 20.04 or Linux Mint 20 system and then we will teach you how you can change the MAC address with the help of this utility.

Changing the MAC Address on a Ubuntu System using Macchanger

To use the Macchanger utility for changing the MAC address on a Linux Mint 20 machine, you will have to proceed with the followings steps:

Step # 1: Installing Macchanger on Ubuntu

First, we will install the Macchanger utility on our system by running the command shown below:

$ sudo apt install macchanger

Install Macchanger

During the installation of this utility, a dialogue box will be presented to you asking whether you want the MAC address to be changed automatically or not. You can choose any option according to your needs, however, we have chosen the “Yes” option as shown in the following image:

Change MAC automatically

Step # 2: Listing all the Network Interfaces

After successfully installing the Macchanger utility on your system, you need to list down all the network interfaces so that you can pick out the one whose MAC address you want to change. To list down all the network interfaces on your system, you will have to execute the command shown below:

$ ip addr

ip addr command

All the network interfaces of our system along with their relevant information are shown in the following image. We will be attempting to change the MAC address of the highlighted network interface i.e. enp0s3 in the following steps of this procedure.

List of network interfaces

Step # 3: Checking the Current MAC Address of a Specific Network Interface using Macchanger:

Before changing the MAC address of the specified network interface, we will first try to check its current MAC address with the command shown below:

$ macchanger –s enp0s3

Set interface for macchanger

You can replace this interface name with the name of your desired interface. The current MAC address of this interface is highlighted in the following image:

Current MAC and permanent MAC

Step # 4: Randomly Changing the MAC Address of a Specific Network Interface using Macchanger:

Now, we will try to assign a random MAC address to the specified network interface by executing the command shown below:

$ sudo macchanger -r enp0s3

Randomize MAC address

Again, you can replace the interface name in this command with the name of your desired interface. The new MAC address is highlighted in the following image:

New MAC address

You can also confirm that the MAC address of the specified network interface has been changed with the help of the command that we used in step # 3 as shown in the image below:

Current MAC address

Step # 5: Manually Changing the MAC Address of a Specific Network Interface using Macchanger:

We can also assign a MAC address of our choice to the specified network interface manually. For that, we can make use of the following command:

$ sudo macchanger –m c2:43:bc:1c:62:01 enp0s3

Change MAC address manually

In this command, we can have any MAC address of our choice provided that it is in the correct format. Moreover, you can also change the interface name with the name of your desired interface. The newly assigned MAC address is highlighted in the image shown below:

New MAC address

You can also confirm that the MAC address of the specified network interface has been changed manually with the help of the command that we used in step # 3 as shown in the following image:

Current MAC

Step # 6: Restoring the Actual MAC Address of a Specific Network Interface using Macchanger:

Finally, we will attempt to restore the original MAC address of the specified network interface using the command shown below:

$ sudo macchanger –p enp0s3

Restore old MAC address

When you will execute the above-mentioned command, you will notice that now the permanent and the new MAC addresses of the specified network interface are the same which means that the original MAC address of that network interface has been restored successfully as highlighted in the following image:

Permanent MAC address is the new MAC address now

Conclusion

With the help of this tutorial, you can easily install the Macchanger utility on your Ubuntu 20.04 or Linux Mint 20 system and then you can use it for viewing and changing the MAC address of any desired networking device or a network interface.