wlan and macchanger
I was wondering about how to write a script for changing my default MAC address before enabling networking. It happens often, that the MAC address changes to default.
I would like to show the MAC address in conky (or any other graphical desktop interface). This script should also change the MAC address automatically if for any reason the default was restored.
NetworkManager itself can change a network interface MAC address and it will not be changed back to the default one while the connection is established.
Edit the network connection (NetworkManager indicator -> Edit connections -> Wireless tab -> Select a connection -> "Edit" button). In the "Wireless" tab you'll find a "Cloned MAC address" textbox. Type in the new MAC address it should use when the connection is established.
Just make script that will change mac address and make it run whenever you connect to network
#!/bin/sh sudo ifconfig wlan0 down sudo macchanger -a wlan0 sudo ifconfig wlan0 up
How to run cron job when network is up?
EDIT
@n00b, answers to your questions. So as I read here you can set macchanger to change MAC address automatically using
macchanger --mac=01:23:45:67:89:AB wlan0
And other question: "how to make it run automatically". So here it says you to add script to /etc/network/if-up.d/
and make it executable.