idpitt
Posts: 14
Joined: Sat Jan 04, 2020 2:28 pm

Getting random eth0 mac addresses on each reboot

Sat Feb 08, 2020 11:58 am

The pi4 is running gentoo via Sakaki's build. Running 1.5.3 of her build.

I need to have the pi get a static IP address via dhcp but I've found that the mac address of eth0 is random on each boot. I've added smsc95xx.macaddr=DC:A6:32:XX:YY;ZZ to cmdline.txt but this has no effect.

Any ideas?

Posting in the Gentoo forum here too.

Thanks
Ian

User avatar
sakaki
Posts: 548
Joined: Sun Jul 16, 2017 1:11 pm

Re: Getting random eth0 mac addresses on each reboot

Sat Feb 08, 2020 1:39 pm

Hi Ian -

apologies for the slow reply - things have been a bit hectic in day-job land since the start of this year ><

To your question, this randomization is applied by NetworkManager, as a feature. See e.g. these notes.

You can control this easily enough. Simply right-click on the network icon in the panel, and click on "Edit Connections...":

Image

Then, in the dialog that appears. double-click on your wired Ethernet connection (this will probably show up as "Wired connection 1" or similar, unless you have explicitly renamed it). A further dialog will open. Click on the "Ethernet" tab, and in the "Cloned MAC address" dropdown select either Preserve (to copy the mac address through) or Stable (to assign a hashed address that will still be constant boot-to-boot):

Image

Your initial device MAC address, as shown in the Device field, will of course differ from the above.

Once done, click Save, and restart your system. You should now find the eth0 mac address is stable across reboots.

hth, sakaki

idpitt
Posts: 14
Joined: Sat Jan 04, 2020 2:28 pm

Re: Getting random eth0 mac addresses on each reboot

Sat Feb 08, 2020 2:54 pm

Thanks for this. I feel so dumb that I'm going to hand back my technical skills license :(

bls
Posts: 651
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA
Contact: Twitter

Re: Getting random eth0 mac addresses on each reboot

Sat Feb 08, 2020 4:36 pm

sakaki wrote:
Sat Feb 08, 2020 1:39 pm
apologies for the slow reply
More than an hour. Completely unacceptable! :lol: :lol: :lol:
Pi tools:
RPi SD Card Image Manager: https://github.com/gitbls/sdm
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo
Easy VPN installer/manager: https://github.com/gitbls/pistrong
DNS/DHCP manager:https://github.com/gitbls/ndm

Return to “Gentoo”