How to change MAC address in Linux
First find the physical MAC address of your machine by running the following command :
$ ifconfig -a | grep HWaddr eth0 Link encap:Ethernet HWaddr 00:80:48:BA:d1:20
The hexadecimal numbers in blue denote my machine's MAC address. Yours will be different. Learn how to use the ifconfig Linux command.
You can also use
ethtool to find the hardware address of your machine.
Next, login as root in Linux and enter the following commands -
# ifconfig eth0 down # ifconfig eth0 hw ether 00:80:48:BA:d1:30 # ifconfig eth0 up # ifconfig eth0 |grep HWaddr
I have changed the MAC address to a different number highlighted in blue.
00:80:48:BA:d1:30 is the new MAC address I have provided for my Linux machine. You can choose any 48 bits hexadecimal address as your MAC address.
Why you should change MAC address of your Linux machine
These are the reasons you should change the MAC address of your machine.
- For privacy - For instance when you are connecting to a Wi-Fi hotspot.
- To ensure interoperability. Some internet service providers bind their service to a specific MAC address; if the user then changes their network card or intends to install a router, the service won't work anymore. Changing the MAC address of the new interface will solve the problem.
Caveats to Changing MAC address
In Linux, Windows, Mac OS X, or a different operating system, changing MAC address is only temporary. Once you reboot your machine, the operating system reflects the physical MAC address burnt in your network card and not the MAC address you set.