0

I need to change my MAC permanently for wlan0 interface. Macchanger is a pretty good variant but after rebooting wifi card old MAC comes back. So, I don't like to use it.

I found one good solution for changing MAC permanently (but for eth0). Here it is: we open the file /etc/network/interfaces and add two lines:

iface eth0 inet dhcp   
      hwaddress ether NEW_MAC

I've tried to do like this for wlan0 interface but it doesn't work that way.

What I'm doing wrong?

1 Answer 1

0

Create a file called "changeMAC.sh" in /home/yourUser/ [Replacing yourUser accordingly]

In the file, paste this code:

#!/bin/sh
service network-manager stop
ifconfig wlan0 down
# Change to whatever MAC you want
ifconfig wlan0 hw ether 00:11:22:33:44:55
ifconfig wlan0 up
service network-manager start

Then, in terminal (Ctrl+alt+t), run
sudo chmod +x /home/yourUser/changeMAC.sh [Again, replacing yourUser accordingly]

Then run sudo nano /etc/rc.local

At the bottom, add the line sudo /home/yourUser/changeMAC.sh [You know the drill, replace yourUser...]

Exit nano with Ctrl+x, pressing y to write changes to disk.

Finally, run sudo shutdown -r now

7
  • @ZhenyaAfnwefowa - Get root (sudo su) and then try running each of the commands in my answer one by one manually. You must be doing something wrong. I have this working from a .sh file myself. May 18, 2016 at 13:46
  • I tried one more time - nothing. Then I decided to delete two line from script(what are about network-manager restarting). Reboot. While system was strarting up I saw smth like this: due to rc.local Old mAC:my_mac New MAC :********* But when I signed in the system and typed ifconfig wlan0, it shows me the OLD MAC , not the NEW one. Do you know another way how to do it? May 18, 2016 at 13:56
  • How could that work in rc.local if it simply doesn't work the way : sudo /home/USER/changeMAC.sh ? May 18, 2016 at 14:19
  • I've rebooted my laptop so many times, check so many variants and still nothing. May 18, 2016 at 14:26
  • @ZhenyaAfnwefowa "How could that work in rc.local if it simply doesn't work the way : sudo /home/USER/changeMAC.sh" That's why I'm asking muru if he has any insight. May 18, 2016 at 14:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .