User Tools

Site Tools

diy:change-mac

How To Change Your MAC Address

A MAC address (which is short for medium access control address) is the unique identifier assigned to pretty much every network interface controller. The ethernet jack and the wifi adapter on your computer each have their own MAC address.

On networks (such as your home network, or the wifi network at Starbucks) the MAC address is typically used by the network to identify and track individual machines. This means that your machine can be tracked not only every time it logs in to the same network, but it can be tracked across other networks as well. You can hinder this by changing your MAC address, or configuring it to use a random MAC.

There are more than just privacy benefits to changing your MAC address. Some networks which provide only a limited amount of free access for guests, can have the timer reset if you disconnect, clear your browser cookies/cache, and reconnect with a new MAC. This can get you around bans on some services as well. Some ISP's may even reassign you a new IP address if you connect from a new MAC address.

MAC addresses are typically burned into the firmware of the network controller from the factory. In the past, this sometimes made them very hard to change, but this is less of a problem with modern operating systems.

Scroll down for instructions for your particular system.

Linux/BSD/macOS Instructions

Manually, with ifconfig

ifconfig (short for “interface config”) is a command-line network management utility that has been in use on Unix-like systems since 1983. Many alternatives have come and gone, but ifconfig remains the de facto standard on most BSD, MacOS and Linux machines.

Run ifconfig in your shell to find your network adapter name:

$ ifconfig

There is a high chance it will be something like wlan0, but it can be anything. If you want, make note of the current MAC address under the ether line, or just look it up with grep:

$ ifconfig wlan0 | grep ether

And it will output the current address, like ether 00:01:02:03:04:05.

Set the value to any MAC address you want, like so:

$ sudo ifconfig wlan0 ether 00:e2:e3:e4:e5:e6

Use grep again to verify the change went through:

$ ifconfig wlan0 | grep ether

And it should output ether 00:e2:e3:e4:e5:e6 instead of the value before.

Note that this method is not persistent. Reboot to reset.

Manual MAC Generation

If you need help coming up with a random MAC, you can generate a string to use with this command:

$ openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'

Linux Instructions

Automatically, with NetworkManager

Most of you using Linux will likely have NetworkManager installed already. To set-and-forget your machine to automatically generate & provide a random MAC address every time you connect to a network, save the following file to /etc/NetworkManager/conf.d/:

/etc/NetworkManager/conf.d/mac-randomization.conf
#########################################################
## DROP-IN CONFIGURATION FILE FOR NETWORKMANAGER:      ##
##    AUTOMATIC MAC RANDOMIZATION                      ##
## REQUISITIONED FROM THE ANONYMOUS MILITARY INSTITUTE ##
##    HTTPS://BESTPOINT.INSTITUTE/DIY/CHANGE-MAC       ##
#########################################################
 
[device-mac-randomization]
# "yes" is already the default for scanning, but set it anyways.
wifi.scan-rand-mac-address=yes
 
[connection-mac-randomization]
# Randomize MAC for every ethernet connection.
ethernet.cloned-mac-address=random
# Generate a random MAC for each WiFi connection.
wifi.cloned-mac-address=random

Then reboot, or reset NetworkManager:

$ sudo service NetworkManager restart

Automatically, with iwd

If you are using iwd and its built-in network configuration without NetworkManager, set the following two lines under [General] in /etc/iwd/main.conf:

[General]
AddressRandomization=once
AddressRandomizationRange=full

Manually, with GNU MAC Changer

Before NetworkManager had flawless MAC randomization built in, an extremely popular Linux utility was GNU MAC Changer. You can find it at alobbs/macchanger, or for most Debian-based systems with apt install macchanger.

Windows Instructions

Manually, with PowerShell

  1. Open the Command Prompt or PowerShell with administrator privileges.
  2. Use the netsh interface show interface command to get a list of network adapters on your system.
  3. Identify the network adapter for which you want to change the MAC address.
  4. To change the MAC address, use this command: netsh interface set interface <adapter name> newmac=<new MAC address>
  5. Replace <adapter name> with the name of the network adapter, and <new MAC address> with the desired MAC address (in the format xx-xx-xx-xx-xx-xx).
  6. Press Enter to execute the command.
  7. Restart your computer for the changes to take effect.

Android Instructions

Non-persistent MAC randomization can be enabled in Developer Options, without rooting your Android device.

Changing your MAC address on Android is an ordeal which traditionally has involved rooting your phone. This isn't so much a problem anymore, as starting with Android 10, MAC address randomization is enabled by default. (You can double-check this if you hit the gear icon for your current wifi network, and look at the Privacy setting.)

However, these randomized MAC addresses are persistent, meaning they are generated once for each wireless connection, and saved. Starting with Android 11, you can override this behavior, and force it to use non-persistent random addresses which constantly regenerate on a regular basis.

To set-and-forget this option:

  1. In Settings, go to System and then Developer options.
    1. If Developer options is not available, then you must enable developer access first.
    2. Under Settings, go to About phone, and tap on Build number a bunch of times until it says you are a developer.
  2. Find the setting “Wi-Fi non-persistent MAC randomization” and enable it.

More info: source.android.com

diy/change-mac.txt · Last modified: 2024/08/06 01:48 by 127.0.0.1

Find this page online at: https://bestpoint.institute/diy/change-mac