How one can Change MAC Deal with in Linux [Easily]

Earlier than I present you learn how to change the MAC tackle in Linux, let’s first talk about why you’ll change it within the first place.

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

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

airport wifi meme
airport wifi meme

I’m going to indicate the steps to vary MAC tackle (also referred to as spoofing/faking MAC tackle).

Change MAC Deal with in Linux

Let’s undergo every step:

Step 1: Discover Your MAC Deal with and Community Interface

Let’s have a look at some particulars about community card in Linux. Use this command to get community interface particulars:

ip hyperlink present

Within the output, you will notice a number of particulars together with the MAC tackle:

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 possibly can see, on this case, my community interface is named enp0s31f6 and its MAC tackle is 38:42:f8:8b:a7:68,

You might wish to observe this down in a protected place to revert to this authentic MAC tackle later.

Now you possibly can proceed to vary MAC tackle.

In case you do that on a community interface that’s at present 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.

Technique 1: Change MAC Deal with Utilizing Macchanger

change mac address linux

MacChanger is straightforward utility to view, modify and manipulate MAC tackle in your community interface card. It’s out there in nearly 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

essential! You’ll be requested to specify whether or not MacChanger must be set to run routinely each time a community machine is introduced up or down. Everytime you connect an ethernet cable or re-enable WiFi it provides a brand new MAC tackle.

configuring macchanger
It isn’t a good suggestion to run it routinely

I like to recommend not operating it routinely, until you actually need to vary your MAC tackle each time. So, choose No (by urgent the Tab key) and press the Enter key to proceed.

How one can Use MacChanger to Change MAC Deal with

Do you bear in mind your community interface title? You bought it earlier in step 1.

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

sudo macchanger -r enp0s31f6

After altering MAC ID, confirm it utilizing the command:

ip addr

Now you will notice that the MAC has been spoofed.

To transform the MAC tackle to a selected worth, specify any customized MAC tackle 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 wish to change.

Lastly, to revert the MAC tackle to its authentic {hardware} worth, run the next command:

macchanger -p enp0s31f6

Nonetheless, you do not have to do that. When you reboot the system, the modifications can be misplaced routinely, and the unique MAC tackle can be restored once more.

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

Technique 2: Altering MAC Deal with Utilizing iproute2 [intermediate knowledge]

I might advocate utilizing macchanger however in case you do not wish to use it, there’s one other solution to change mac tackle 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 tackle 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 tackle:

ip hyperlink present enp0s31f6

That is it. You have got efficiently modified the MAC tackle to the right Linux model. Keep tuned with It is FOSS for extra Linux tutorials and ideas.


Dimitrios Savopoulos

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

Supply hyperlink