Changing My MAC Address on Linux: What Worked for Me

Quick outline

  • Why I even change my MAC on Linux
  • The gear I used
  • Fast ways that worked (real commands)
  • What broke, and how I fixed it
  • How to make it stick on reboot
  • When I don’t change it
  • Final take

Why I even bother

I like privacy on public Wi-Fi. I also test networks for work. Some portals bind you to your device. Sometimes I need a clean slate. A fresh MAC helps.

Am I hiding? No. I’m just careful, like wearing a hoodie in the rain. Also, a few hotels and coffee shops tie a session to your MAC. If the timer gets stuck, a new MAC can nudge it. Use this only where it’s allowed, please.

When I occasionally check in on location-based classifieds, a fresh address keeps my hardware from being fingerprinted—take a look at Backpage Tyler to see how strongly geo-targeted listings can clue you in to the tracking stakes, and pick up a few practical pointers on staying discreet while you browse.

If you're hungry for more Linux-centric tips beyond MAC shuffling, the no-nonsense guides on Freedom Penguin have helped me level up more than once.

My setup (plain and simple)

  • Main laptop: ThinkPad T480, Intel Wi-Fi (Ubuntu 22.04 LTS)
  • Second box: Fedora 40 on a mini PC (Realtek Ethernet)
  • A Raspberry Pi 4 (Debian 12), headless, lives near my router
  • Networks: my home router, my phone hotspot, and a campus guest net

If you’re shopping for a portable pentesting rig, check out the rundown of the laptops I actually use with Kali Linux—the notes on Wi-Fi chipsets alone can save you hours of driver hunting.

I wrote these steps after I ran them. Coffee in hand. Dog snoring. Nice day.
Sometimes, though, an endless debugging sprint demands more sustained energy than a mug of espresso can deliver; while looking for ways to stay sharp I stumbled across this detailed Choq® Testosterone Daily Booster review that breaks down the ingredients, claimed benefits, and real-world feedback—worth a read if you’re curious about natural focus and stamina aids.

Fast wins that actually worked

Here’s what worked for me, for real. I’ll show Wi-Fi first, then Ethernet.

1) “ip” command (built-in, quick)

This one is my go-to. It’s fast and doesn’t need extra tools.

Wi-Fi on Ubuntu 22.04:

  • Find your device name:

    • ip link show
    • Mine was: wlan0 on the Pi, wlp2s0 on the ThinkPad
  • Down the interface:

    • sudo ip link set dev wlp2s0 down
  • Set a new MAC (use a locally administered one, start with 02):

    • sudo ip link set dev wlp2s0 address 02:11:22:33:44:55
  • Bring it up:

    • sudo ip link set dev wlp2s0 up
  • Check:

    • ip link show wlp2s0

On Fedora for Ethernet (Realtek, name was enp3s0):

  • sudo ip link set dev enp3s0 down
  • sudo ip link set dev enp3s0 address 02:AA:BB:CC:DD:EE
  • sudo ip link set dev enp3s0 up
  • ip -br a | grep enp3s0

It took me maybe 20 seconds. If NetworkManager flips it back, see the nmcli part below. That happened to me once after a suspend.

2) macchanger (friendly and fun)

I like macchanger when I want random, fast.

On Ubuntu:

  • sudo apt install macchanger
  • Bring the device down:
    • sudo ip link set dev wlp2s0 down
  • Random MAC:
    • sudo macchanger -r wlp2s0
  • Or set a fixed one:
    • sudo macchanger -m 02:AB:CD:EF:12:34 wlp2s0
  • Bring it up:
    • sudo ip link set dev wlp2s0 up
  • See it:
    • macchanger -s wlp2s0

On my Pi, “-r” gave me a fresh address every time. Handy for quick tests.

If the syntax ever slips your mind, the succinct man-page style reference on the LinuxCommandLibrary’s macchanger manual is a quick way to jog your memory without scrolling through pages of unrelated output.

3) NetworkManager (nmcli), per network

This is great when I want the change each time I join a certain Wi-Fi. No extra scripts.

  • List connections:

    • nmcli connection show
  • For a saved Wi-Fi named Home Wi-Fi:

    • nmcli connection modify "Home Wi-Fi" 802-11-wireless.cloned-mac-address random
    • Then bounce the connection:
      • nmcli connection down "Home Wi-Fi"
      • nmcli connection up "Home Wi-Fi"
  • For a fixed MAC on Ethernet:

    • nmcli connection modify "Wired connection 1" 802-3-ethernet.cloned-mac-address 02:66:77:88:99:10
    • Then:
      • nmcli connection down "Wired connection 1"
      • nmcli connection up "Wired connection 1"

Need to dive deeper into every knob you can tweak on the wired side? The upstream docs for NetworkManager 802-3 Ethernet settings lay out each property and what it actually does.

Tip: If it doesn’t “take,” disconnect from the network first. Also check that you didn’t lock MAC in your driver or a udev rule. I did that once and felt silly.

Real moments that sold me

  • Campus guest Wi-Fi: It stuck me on a broken session after lunch. I set a new MAC with ip, rejoined, and boom—portal showed up again.
  • Hotel that cached devices: My work laptop got the “already used” screen. I set a random MAC with macchanger and it let me start fresh. Later, I changed it back. I don’t mess with rules.
  • My Pi test bench: I cycle through MACs to test my DHCP pool. macchanger -r on wlan0, then watch my router hand out IPs. Simple and neat.

While you’re poking at connections, remember that spoofing a MAC is only half the story; a quick run of MTR on Linux can pinpoint where the packets are really stalling.

What broke (and how I fixed it)

  • It wouldn’t change while connected:

    • Fix: bring the interface down first. Then change the MAC. Then bring it up.
  • NetworkManager “snapped back” after resume:

    • Fix: set cloned-mac-address on the connection. That held steady across sleep.
  • Driver blocked it on Wi-Fi:

    • My Intel card is fine. A friend’s Broadcom was fussy. Some chips don’t like changes while the radio is on. Down the device, or try Ethernet.
  • Random MAC blocked by a portal:

    • Some captive portals have rules. I saw one that flagged random ranges. A fixed, locally administered MAC (starts with 02) passed.
  • Router locked by MAC filter:

    • My old Netgear had a allow-list. I forgot. The new MAC got no IP. Fix: add the new MAC to the router list, or change it back.

Make it stick on reboot (when I need that)

I don’t always want it to stick. But when I do:

  • With NetworkManager, per Wi-Fi:

    • nmcli connection modify "Cafe Wi-Fi" 802-11-wireless.cloned-mac-address random
  • For Ethernet:

    • nmcli connection modify "Wired connection 1" 802-3-ethernet.cloned-mac-address 02:DE:AD:BE:EF:01
  • With systemd-networkd on the Pi (wired):

    • In /etc/systemd/network/10-wired.network
      • [Link]
      • MACAddress=02:12:34:56:78:9A
    • Then:
      • sudo systemctl restart systemd-networkd
  • Old-school udev rule (works but I use it less now):

    • File: /etc/udev/rules.d/70-mac.rules
    • Line:
      • ACTION=="add", SUBSYSTEM=="net", KERNEL=="wlan0", RUN+="/usr/sbin/ip link set dev wlan0 address 02:FE:ED:FA:CE:01"

Be careful with typos. I once broke my boot by misspelling the device name. Had to plug in a keyboard and fix it. Not my best morning.

House rules I follow

  • I stick to networks I own or can use. No tricks.
  • I keep a note of my real MACs. Just in case I need warranty or vendor support.
  • I use “02:” at the start for a local MAC