Earlier than I present you the best way to change the MAC deal with in Linux, let’s first focus on why you’d change it within the first place.

You possibly can have many causes. Perhaps you do not need to expose your actual MAC deal with (also called bodily deal with) to a public community? The opposite case could also be that the community administrator has blocked a selected MAC deal with within the router or firewall.

A sensible ‘benefit’ is that some public networks (corresponding to AirPort WiFi) permit free web for a restricted time period. If you wish to entry the Web past that, spoofing your MAC deal with can trick the community into believing it’s a new system. It is usually a well-known meme.

airport wifi meme
airport wifi meme

I’m going to indicate the steps to alter MAC deal with (also called spoofing/faking MAC deal with).

Change MAC Tackle in Linux

Let’s undergo every step:

Step 1: Discover Your MAC Tackle and Community Interface

Let’s examine some particulars about community card in Linux. Use this command to get community interface particulars:

ip hyperlink present

Within the output, you will note a number of particulars together with the MAC deal with:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    hyperlink/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
    hyperlink/ether 94:c6:f8:a7:d7:30 brd ff:ff:ff:ff:ff:ff
3: enp0s31f6: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000
    hyperlink/ether 38:42:f8:8b:a7:68 brd ff:ff:ff:ff:ff:ff
4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default 
    hyperlink/ether 42:02:07:8f:a7:38 brd ff:ff:ff:ff:ff:ff

As you may see, on this case, my community interface known as enp0s31f6 and its MAC deal with is 38:42:f8:8b:a7:68,

You could need to observe this down in a protected place to revert to this unique MAC deal with later.

Now you may proceed to alter MAC deal with.

Should you do that on a community interface that’s at the moment in use, your community connection will most likely be terminated. So both do that methodology on a spare card or be ready to restart your community.

Methodology 1: Change MAC Tackle Utilizing Macchanger

change mac address linux

MacChanger is easy utility to view, modify and manipulate MAC deal with on your community interface card. It’s out there in virtually all GNU/Linux working programs and you may set up utilizing your distribution’s package deal installer.

On Arch Linux or Manjaro:

sudo pacman -S macchanger

On Fedora, CentOS, RHEL:

sudo dnf set up macchanger

On Debian, Ubuntu, Linux Mint, Kali Linux:

sudo apt set up macchanger

vital! You’ll be requested to specify whether or not MacChanger must be set to run mechanically each time a community system is introduced up or down. Everytime you connect an ethernet cable or re-enable WiFi it offers a brand new MAC deal with.

configuring macchanger
It is not a good suggestion to run it mechanically

I like to recommend not working it mechanically, except you really want to alter your MAC deal with each time. So, choose No (by urgent the Tab key) and press the Enter key to proceed.

Methods to Use MacChanger to Change MAC Tackle

Do you keep in mind your community interface identify? You bought it earlier in step 1.

Now, to assign any random MAC deal with to this community card, use:

sudo macchanger -r enp0s31f6

After altering MAC ID, confirm it utilizing the command:

ip addr

Now you will note that the MAC has been spoofed.

To transform the MAC deal with to a selected worth, specify any customized MAC deal with utilizing the command:

macchanger --mac=XX:XX:XX:XX:XX:XX 

The place XX:XX:XX:XX:XX:XX is the brand new MAC ID you need to change.

Lastly, to revert the MAC deal with to its unique {hardware} worth, run the next command:

macchanger -p enp0s31f6

Nevertheless, you do not have to do that. When you reboot the system, the modifications will probably be misplaced mechanically, and the unique MAC deal with will probably be restored once more.

You possibly can all the time test the person web page for extra particulars.

Methodology 2: Altering MAC Tackle Utilizing iproute2 [intermediate knowledge]

I might suggest utilizing macchanger however in case you do not need to use it, there’s one other strategy to change mac deal with in linux.

First, flip off the community card utilizing the command:

sudo ip hyperlink set dev enp0s31f6 down

Subsequent, arrange the brand new Mac utilizing the command:

sudo ip hyperlink set dev enp0s31f6 deal with XX:XX:XX:XX:XX:XX

Lastly, flip the community again on with this command:

sudo ip hyperlink set dev enp0s31f6 up

Now, confirm the brand new MAC deal with:

ip hyperlink present enp0s31f6

That is it. You might have efficiently modified the MAC deal with to the proper Linux fashion. Keep tuned with It is FOSS for extra Linux tutorials and suggestions.


Dimitrios Savopoulos

Dimitrios is an MSc Mechanical Engineer however a Linux fanatic at coronary heart. He’s effectively put in in Solus OS however curiosity drives him to check different distros always. Problem is a part of his persona and his passion is competing in distances from 5k to marathon.

Supply hyperlink