Manipulate your system's MAC address

  12 years ago

I'm always a fan of collecting useful utilities, and I'm proud to say that macchanger is one of them. I've always appreciated the usefulness of this utility that I made it a point to install it when installing a new version of Ubuntu/LinuxMint on my lappy.

Some features that this utility offer are:

- Set a MAC of another vendor
- Set another MAC of the same vendor
- Set specific MAC address of a network interface
- Set the MAC randomly

To install the macchanger utility:

sudo apt-get install macchanger

Here's how I setup macchanger to automatically change my NIC's MAC address to a random MAC address.

Create a file named changemac on your /etc/init.d/ folder with:

gksudo gedit /etc/init.d/changemac

The content of the changemac file would be the text below colored BLUE (copy and paste it).

# Start of script file
# Disable all the network devices
ifconfig eth0 down
ifconfig wlan0 down

# The value for wlan0 (eth1) would change depending on the driver you're using - Be it Broadcom's STA wireless driver or Broadcom's B43 wireless driver
# Spoof the current MAC addresses with a random MAC address

/usr/bin/macchanger -r eth0
/usr/bin/macchanger -r wlan0

# Re-enable all the network devices
ifconfig eth0 up
ifconfig wlan0 up

# End of script file

Save the file and set the file's permission to executable with:

sudo chmod +x /etc/init.d/changemac

Enable the changemac script to execute a startup with:

sudo update-rc.d changemac defaults

Lastly, reboot your system and observe your registered new MAC address.


Note: I copied this from my blog and thought it might be helpful posting it on official tutorial pages.

AndrewB 11 years ago

Excellent article. Solved a specific problem with a motherboard that had an "empty" permanent MAC address.

ianace 12 years ago

It would not be illegal if you are to use imagination for a purpose, like:

- complying to a network requirement.
- debug a MAC-based routes for testing purposes.
- privacy, especially when connecting to public hotspots.

meshsci 12 years ago

Very smart, but wouldn't this be illegal (as in against "The Law of the Land"? For one, it would circumvent pursuit by Law Enforcement Agencies. On the other hand, it can be seen as positive in that it promotes personal privacy. Thanks for an interesting (if not useful) contribution. ~Regards, Aaron