Jump to content

How to change ethernet MAC address on image?


Go to solution Solved by grixm,

Recommended Posts

I have installed Armbian on my Rock Pi S, done some setup, and then taken an image of the disk to be duplicated to other devices.
The problem is that each of these devices get the same permanent MAC address on the ethernet port as the first device. I don't know how Armbian gets the MAC address from the interface but it doesn't seem to depend on unique hardware, or if it does then the hardware ID isn't actually unique between boards.

This leads to problems because my device is meant to be used several in the same network, causing collisions in DHCP assignment etc.

 

I have tried multiple workarounds and none have worked well. I tried spoofing the MAC addr by changing the cloned-mac-address setting in NetworkManager. This worked at changing the MAC address, however it caused an entirely different problem, namely that a fallback connection with a link-local address never gets activated. It previously worked but after changing only this setting, it no longer works. I have no idea why but I have tried for days now to fix this issue and I'm out of new ideas.

 

The other thing I tried was adding ethaddr=[some mac address] in the armbianEnv.txt file, as found in another forum thread. This didn't seem to do anything, the same duplicate MAC address was still used.

 

I also tried using macchanger, but it was difficult to get to work nicely with NetworkManager, I don't think this is a good solution...

 

What else can I try?

Edited by grixm
Link to comment
Share on other sites

Armbian & Khadas are rewarding contributors

  • Solution

For the record, I finally found a solution.

There is already a bash script in the rock pi s distribution that changes to a unique mac address. However for whatever reason this is not set up to run on the ethernet port, only on wifi. You can fix this by opening the file /etc/udev/rules.d/05-fixMACaddress.rules , adding this line:

KERNEL=="end0", ACTION=="add" RUN+="fixEtherAddr %k 06"

(Change end0 with eth0 on ubuntu version)

 

PS: Even this didn't seem to work on older armbian versions like v22, but on v24 debian build it worked.

Link to comment
Share on other sites

@grixm you copied the image of the SD card after the initial setup?

 

I think that results in the same machine-id(/etc/machine-id) and as such I guess it could get the same MAC address?

 

I set the neplan MAC address in my netplan file. I think that is enough.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines