Change MAC Address In Linux Mint With This Command Line Tool


MAC (Media Access Control) address or the hardware address is a 48-bit (12 hexadecimal) unique permanent address for each of the installed network interfaces in a system. There are tools that can temporarily change these addresses. In Linux Mint, there is a simple command-line utility to do so – macchanger.

To install it, open the Terminal and type in:

sudo apt install macchanger

installing macchanger in Linux Mint

During installation, there is an option of automatically changing MAC addresses for interfaces once they are enabled/disabled. Select Yes to change automatically.

enable automatically changing of MAC address using macchanger

Once installed, macchanger can be used to randomize MAC addresses, set a unique address and so on. To get a list of available network interfaces and their MAC addresses from the Terminal, you can use the ip addr command.

using the ip command to list the network interfaces

Listing MAC address for an interface:

First, to display the current MAC address using macchanger, the command uses the -s parameter:

macchanger -s interface-name

displaying the MAC address of an interface using macchanger

The current and permanent MAC addresses listed will initially be the same.

Setting a random MAC address:

Now, to change this to a random MAC address for the specific interface, the command uses the -r parameter:

sudo macchanger -r interface-name

assigning a random MAC address using macchanger

The values of the permanent and the new MAC addresses will be different. In this example, as the permanent MAC address was changed directly to a random MAC address so both the current and permanent MAC addresses are shown as the same.

Suppose, if you are randomizing an already changed MAC address, then the output will show each of the addresses for current, permanent and the new addresses as different:

assigning a random MAC address to an already changed one using macchanger

Restoring the default MAC address:

If you want to switch back to the original MAC address (the permanent address), use the -p parameter:

sudo macchanger -p interface-name

changing back to the actual MAC address using macchanger

The permanent and the new MAC addresses now will be the same again.

Manually setting a MAC address:

Also, if you’d like to manually enter a MAC address on own, use the -m parameter:

sudo macchanger -m MAC ADDRESS

This should be in the format of 6 octets like FF:FF:FF:FF:FF.

setting a manual MAC address using macchanger

Getting vendor based MAC address details:

The format of a MAC address is such that the first three octets out of the six octets are OUI (Organizationally Unique Identifiers) that can identify the manufacturers of the network interface. To get a list of the OUIs, you can use the vendor list option -l :

macchanger -l

displaying the vendor OUIs for MAC addresses with macchanger

This will display a list of the OUIs for different vendors.You can even filter the list using grep to display them from specific vendors:

filtering the vendor list using macchanger

To set a MAC address by a similar vendor, use the -a parameter:

sudo macchanger -a interface-name

assigning a similar vendor based MAC address using macchanger

Also, there is the -A parameter which uses a random vendor for setting the MAC address.

Finally, you can get a list of all the valid parameters that can be used with the -h parameter:

macchanger -h

using the help option in macchangerAlso, there is the man page for it:

man macchanger

macchanger man page

All done.


Leave a Comment