Start your computer with a random mac address
Step 1: Generate a random mac address:
MAC=`echo -n 00; hexdump -n 5 -v -e '/1 ":%02X"' /dev/urandom;`
Step 2 : Bring up the network card with the mac address:
(Here I’m using my wireless card so the interface would be
wlan0 but the command works for pretty much any interface).
ifconfig wlan0 down
ifconfig wlan0 hw ether $MAC
ifconfig wlan0 up
That will bring up your network interface with the new mac address.
For those of you that are using Network Manager (nm-applet on your gnome-desktop), you will have to restart the network manager service reconnect to your wireless network.
Ubuntu 9.10 and higher :
service network-manager restart
Ubuntu 9.04 and lower :
Fedora / CentOS :
service NetworkManager restart
Now, to get that setup on boot, add the commands to
/etc/rc.local , and you’ll have something like this :
MAC=`echo -n 00; hexdump -n 5 -v -e '/1 ":%02X"' /dev/urandom;` ifconfig wlan0 down ifconfig wlan0 hw ether $MAC ifconfig wlan0 up service network-manager stop service network-manager start
You can modify that script to fit your Linux distribution.