How to Easily Change Your MAC Address: A Step-by-Step Guide


Intro
Each physical device or hardware has its address. Kind of like how each person has their personal ID. Therefore, it's important to know how to change our identification in the virtual world. We will do it in this article.
MAC address
MAC (Medium Access Control) address or HWaddr (HardWare address) is address of physical device, or it’s identification number. So as an ID it is unique for every physical device. It usually uses HEX values which later are translated into Binary by machine.
Checking MAC addresses
Your network technologies such as Ethernet, WIFI and Bluetooth has MAC addresses. We can check them by writing this command:
ifconfig
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 1.2.12.3 netmask 255.255.255.0 broadcast 1.2.3.4
ether 1a:51:80:6t:02:21 txqueuelen 1000 (Ethernet)
RX packets 496143 bytes 598985489 (571.2 MiB)
RX errors 0 dropped 29 overruns 0 frame 0
TX packets 202749 bytes 46107383 (43.9 MiB)
TX errors 0 dropped 4 overruns 0 carrier 0 collisions 0
wlan0 is the wireless connection interface.
MAC address is shown in the ether part. Ether stands for Ethernet. So in our case it’s 1a:51:80:6t:02:21.
To change the MAC address we need to turn off the interface. It's similar to how we put a person to sleep for a surgical operation.
Then we’ll change the hw (MAC) address of the ether part in wlan0 interface.
After that we’ll “wake” the interface up.
ifconfig wlan0 down
ifconfig wlan0 hw ether 00:12:23:43:42
ifconfig wlan0 up
Now we should see the new MAC address in the wlan0 interface.
ifconfig
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 1.2.12.3 netmask 255.255.255.0 broadcast 1.2.3.4
ether 00:12:23:43:42:00 txqueuelen 1000 (Ethernet)
RX packets 496143 bytes 598985489 (571.2 MiB)
RX errors 0 dropped 29 overruns 0 frame 0
TX packets 202749 bytes 46107383 (43.9 MiB)
TX errors 0 dropped 4 overruns 0 carrier 0 collisions 0
And now our ID (identification) is changed.
Bonus
Automating the task
We could create a script to automate our task. You can find information about scripting in this article.
MAC Changer
#! /bin/bash
echo "Before changing the MAC address you should start with ifconfig to choose the interface"
sleep 1
echo "Let's change your MAC address of the desired interface"
echo "Enter the name of the interface"
read interface
echo "Enter the new MAC address"
read MAC
ifconfig $interface down
ifconfig $interface hw ether $MAC
ifconfig $interface up
echo "MAC address succesfully changed"
With this script we can change the MAC address.
Don’t forget to change the permissions so the script would be executable. Use chmod 755 for that.
Outro
It is really important to change your identity before you want to do something impactful.
Subscribe to my newsletter
Read articles from Jonas Satkauskas directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
