• Changing the MAC address in Linux may make sense in some special circumstances.
  • What are the steps you have to follow to modify it in all possible ways?

The MAC address is a constant unique identifier assigned to each device connected to a network.. Generally, regardless of the operating system of our equipment, we always use the same unique identifier. Thinking that you want or need to modify it, we teach you how to change the MAC address in Linux temporarily or permanently and what are the steps you have to follow in both cases.

No matter you are a beginner or an experienced Linux user, you will be able to fix the problem in minutes. Meanwhile, If you are not clear about the difference between IP and MAC addresses, we tell you that the first represents the location of the device on the network to receive data, and the second identifies the equipment.

That would mean, under normal conditions, that the MAC address does not change. but you can change if you want. Think for example, modify it so that the networks treat you as a new user, and not the previous one.

The most common is that the MAC address wants to be changed only temporarily, which interests us.

Installing the package to change the MAC address on Linux

There are various Terminal tools such as macchanger, net-tools, etc. that can help you quickly change the MAC address on your Linux PC. These are the commands to install the packages.

To install the macchanger and net-tools packages on a Debian-based system, use the following command:

sudo apt install macchanger net-tools

To install the packages on a CentOS based system, use the following command:

To install CentOS based systems, use the following command to install the packages:

sudo yum install macchanger net-tools

To install Arch-based systems, use the following command to install the packages:

sudo pacman -S macchanger net-tools

When installing macchanger, you will see a message that asks if you want to change the MAC address at system startup. Use the arrow keys to navigate through the options and indicate what you prefer your computer to do. Press Enter to confirm the decision you have made and that’s it you will be ready to change the MAC address.

change mac address linux 2

How to change MAC address temporarily?

Checking network devices

Before changing the MAC address, you need to know what the device name is and your current MAC address.. You can run the command ifconfig, for the system to list the network devices that are enabled. As long as that doesn’t work, pass to command ip addr showespecially on old equipment or systems.

When executing the command, the first part of the output will display Loopback address information. Basically, you will recognize it by the labeland is the one that diagnoses all network problems.

The second part of the output has about the network interface, like eth0. Likewise, it has specific labels with the address of the hardware or MAC address, and you will find everything related to the IP address IPv4 and IP IPv6.

change mac address linux 3

Disable network device

Now that you have noted the name of your network interface, you must first disable the device’s connection to the network. If you don’t, you won’t be able to change the MAC address in Linux. run the command sudo ifconfig down to be able to disconnect from the Internet. If it doesn’t work, you have another command to reinstall the package, sudo ip link set dev down.

Once executed, the computer will be disconnected from the Internet and will be disabled to change the MAC.

Change MAC address

After you have disabled the network connection of the device, now you can change the MAC address. Again, run the command sudo ifconfig down hw ether to change the MAC address in Linux.

You have to re-enable the device after changing the MAC address, with the command sudo ifconfig up. It is important that you perform the steps in the order indicated here. so that you obtain the indicated results.

If any unexpected error appears, don’t worry because you have two commands that will resolve the failures. First, sudo ifconfig down hw ether. Second, ip link set dev up. Running them should fix it.

change mac address linux 4

Verify changes made

To verify that the MAC address of your Linux system has changed correctly, run the following command, ifconfig. And if your system is old or you have a message that something is wrong, use the following command: ip addr show.

Have you managed to change the MAC address temporarily in Linux with this step by step?

Write A Comment