How to Change MAC Address in Linux

MAC (Media Access Control Address) Address is one of the most physical identifiers assigned to your network interface controller. Every device has its unique mac address, which is set at manufacturing but can be changed using a few tools.

Sometimes you want to change this mac (also known as physical address) for various reasons. Like you are connected with Airport or Railway wifi, they have a limit cap. When your data usage hits that cap, you may face slow internet speed. To avoid spoofing your mac address, trick them into believing it’s a different device.

One example is you using someone’s wifi, and then suddenly you cannot connect to that wifi. There is a chance that they have blocked you on their network at that time change mac address can help you avoid a router firewall and access the internet.

Let’s see how we can change or spoof our mac address using one simple and best freeware utility in Linux Operating System.

Find your Physical MAC Address

Let’s check out our network interface to lookup which mac address we must take a backup before changing.

$ ip link show

The above code list all of the network interface attached to your laptop or desktop system.

List of all network interface
List of all network interface

In my case, I am connected with my wifi using the wlxd46e0e157248 network adapter. You can see 48 bits mac address of that adapter after link/ether d4:6e:0e:15:74:42.

Don’t forget to note your original mac address and store it in a secure and safe place in case to revert to your original.

Macchanger Utility

Macchanger is a simple freeware utility to view, modify and replace the mac address of your network interface. It is available in almost all popular Linux distribution repositories.

Installation

on Debian/Ubuntu/PopOS/Linux Mint/Kali Linux/Parrot

$ sudo apt install macchanger

on Fedora/CentOS/RHEL/Alma/Rocky Linux

$ sudo dnf install macchanger

on Arch/Manjaro/EndeavourOS

$ sudo pacman -S macchanger

Note while installing macchanger, it will prompt to ask whether assign new mac address automatically whenever network brought up or down. I recommend not using this in several cases. If you are required not to show your real mac address, go with it.

macchanger

Changing to Random Mac Address

I hope you remember the network interface name we noted in step one. Once we get that, we can easily assign a random mac address to that network interface using the below command.

$ sudo macchanger -r 

After changing mac address, you can verify it using the same step one command.

$ ip link show

https://trendoceans.com/how-to-configure-static-local-ip-address-in-ubuntu/

Changing to Custom Mac Address

Instead of a random mac address, you can go with a specific address in your mind. To with custom follow below command.

$ macchanger --mac=XX:XX:XX:XX:XX:XX 

Replace XX:XX:XX:XX:XX:XX with your new custom mac address.

Revert Back to Original Mac Address

Going back to the original mac address is pretty easy. There are two steps to follow. First, if you noted your actual mac address, you can set it as a custom mac address. Otherwise, go with the below command, which automatically changes your new generated mac address into your original OEM given address.

$ macchanger -p wlxd46e0e157248

Final Thought

Changing or spoofing mac addresses is a life savior many times. But it is strictly prohibited to use it for a non-ethical activities like card*** and hacking. Stick with us to learn more useful technology and Linux tips.

Leave a Reply