0

The problem I’m running into is randomizing my MAC address which is tied to my Ethernet interface name (enx503eaa292ae3; just an example address btw). Whenever I type macchange -r , I get “interface not found”.

*substitute interface with actual network interface name

ip a

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 100.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 181: enx00e00c000d0f: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:e0:4c:68:0d:0f brd ff:ff:ff:ff:ff:ff inet 100.108.0.01/24 brd 100.108.0.205 scope global dynamic noprefixroute enx00e00c000d0f valid_lft 85828sec preferred_lft 85828sec inet6 fe80::3d24:a2de:493e:1cab/64 scope link noprefixroute valid_lft forever preferred_lft forever

After entering macchanger -r {interface}. this is what i got:

[ERROR] Could not change MAC: interface up or insufficient permissions: Operation not permitted

4
  • Can you update your question to include the output of ip a? This really should be a simple matter of macchanger -r {interface} unless your hardware rejects attempts to override the MAC 🤔
    – user1091774
    Jan 11 '21 at 0:09
  • macchange is rarely needed nowadays, both network manager and systemd have functions for randomizing mac addresses
    – bac0n
    Jan 11 '21 at 10:51
  • please see the edit
    – Joshua
    Jan 12 '21 at 7:12
  • You probably have to use macchanger with sudo.
    – muru
    Jan 12 '21 at 8:03
0

In Terminal to generate random mac address try this:

macaddress=$(echo $FQDN|md5sum|sed 's/^\(..\)\(..\)\(..\)\(..\)\(..\).*$/02:\1:\2:\3:\4:\5/')

you can print a new mac address

echo $macaddress

You should see an output that looks like 02:68:b3:29:da:98 and then use it in your config. I have been using it on KVM VM's quite successfully. Random mac address will always start in with a first octet as 02 which you can use to track in your environment easily.

Or like this:

openssl rand -hex 6 | sed 's/\(..\)\(..\)\(..\)\(..\)\(..\)\(..\)/\1:\2:\3:\4:\5:\6/'
2
  • this didn't work for me
    – Joshua
    Jan 12 '21 at 5:28
  • Please explain what this code is expected to do, and how it will help OP.
    – Soren A
    Jan 12 '21 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.