3

Very unusual request here, I know you aren't normally meant to change your MAC address since it's burned into the interface you are using, but I am networking 2 raspberry Pi zeros together, each with a USB to ethernet attachment where the manufacturer used the EXACT SAME mac address for both modules. So now I need to manually change one.

I've read a lot of instruction saying to do that through /etc/network/interfaces but I've also read that using that file is now totally outdated so there ought to be a more correct way of making this change. Would that be through /etc/dhcpcd.conf - and if so what is the command to be written?

0

1 Answer 1

5

based in information found here

sudo tee /etc/systemd/network/00-default.link <<EOF
[Match]
MACAddress=00:00:00:00:00:00

[Link]
MACAddress=00:00:00:00:00:01
EOF

replace 00:00:00:00:00:00 with your USB/Ethernet MAC address and 00:00:00:00:00:01 with whatever you want your MAC to be

As for what to set the address to, something in the "locally administered" ranges are probably the safest, these are

x2-xx-xx-xx-xx-xx
x6-xx-xx-xx-xx-xx
xA-xx-xx-xx-xx-xx
xE-xx-xx-xx-xx-xx

I have tested the above on a Raspberry pi 3, so can not guarantee it will work with a USB ethernet dongle - however, since the article I linked to refers to cute little USB-to-Ethernet adapters for your Raspberry Pi Zeros I'm fairly confident this should work for you

4
  • You're the most helpful guy around @Jaromanda x
    – Matt
    Sep 9, 2018 at 23:30
  • 1
    Just good timing, @Matt. I was looking at using USB-Ethernet adapters for a couple of my Zero's - your question made me wonder if ALL such adapters had similar issues. So, in a way, your question helped me before I even (possibly) had the same issue (oh, and I see I've answered you before :p ) Sep 9, 2018 at 23:41
  • Well it works to change the MAC address if I will know the MAC address. So eth0 is static in my case. But the usb to ethernet module has also eth1 and eth2. I don't know how this could work if I won't find out how eth1 and eth2 changes. In other words: I can not use eth0. And I can only replace (MATCH and LINK) if I will know the original MAC of eth1 or eth2.
    – Micha93
    Jul 5, 2021 at 9:40
  • well, you have two mac addresses on the USB device, right ... pick 1 make it eth1, pick the other make it eth2 - if it's not the order you want, swap ... it's not clear from the answer, but you can create multiple files in that folder ... say 10-eth1.link and 00-eth2.link Jul 5, 2021 at 22:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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