Welcome! Log In Create A New Profile

Advanced

Armada: Setting persistent MAC address.

Posted by Mijzelf 
Armada: Setting persistent MAC address.
March 06, 2022 08:09AM
The default Armada rootfs has a script /root/set_persistent_mac_address which is called from /etc/rc.local to read the MAC address of the NIC from u-boot environment, and set it to the NIC.
Problem is that it is called after the networking is already up, which means the NAS first requests an IP address by DHCP on a random MAC address, and then another time using the 'real' MAC address, littering the logs of the DHCP server.

After adding a line
[ "${IFACE}" != "eth0" ] && exit 0
as first command, and removing the ifup and ifdown line, the script can placed in /etc/network/if-pre-up.d/, and will be called just before eth0 will go up.

(BTW, the call in /etc/rc.local
# Work around to set persistent MAC address in Armada boxes
if [ -f /root/set_persistent_mac_address ]; then
	/root/set_persistent_mac_address
fi
has a bug, -f should be -x)
Re: Armada: Setting persistent MAC address.
March 06, 2022 04:08PM
> the script can placed in
> /etc/network/if-pre-up.d/, and will be called just
> before eth0 will go up.

That would be best.

It was my quick-and-dirty hack, but nobody has suggested improvement until now :)

Thanks Mijzelf!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Armada: Setting persistent MAC address.
March 08, 2022 09:11AM
I have a similar quick and dirty solution I use in my installer:
https://github.com/1000001101000/Debian_on_Buffalo/blob/master/Tools/ifup-mac.sh

I know someone created an out-of-tree kernel patch that mimicked the method buffalo/marvell use to pass the MAC though that repo appears to have disappeared. I never used it personally since I have this weird fixation with compatibility with Debian's kernel packages.
Author:

Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: