I am using a NanoPi NEO 1.4 and also observed MAC changing with each reboot.
Linux npi-neo-1 5.10.21-sunxi #21.02.3 SMP Mon Mar 8 00:28:04 UTC 2021 armv7l GNU/Linux
While I was successful configuring `/etc/network/interfaces` (`armbianEnv.txt` didn't work, didn't try `dhclient.conf`), I wasn't quite satisfied by the results.
I thus looked for a different solution and stumbled over
https://epsilonrt.fr/2018/03/corriger-une-adresse-mac-aleatoire-dans-armbian-sur-nanopi/
The solution suggested by that three year old post doesn't work with my kernel.
But as it turned out, the analysis for the underlying problem was spot-on.
That prompted me to create a custom device tree overlay as `nanopi-neo-stable-mac.dts` as follows:
/dts-v1/;
/plugin/;
/ {
compatible = "allwinner,sun8i-h3";
/*
* uboot tries to write a MAC address from ${mac_node}
* to the device tree at 'local-mac-address' within 'ethernet0'
* fdt set ethernet0 local-mac-address ${mac_node}
* This obviously doesn't work if the device tree does not match the
* expected structure, resulting in the kernel creating a random MAC.
*
* This overlay adjusts the device tree to accept uboot's MAC address
* by adding
* - 'ethernet0' alias for symbol '/soc/ethernet@1c30000'
* (or change to whatever path your existing symbol 'emac' points to)
* - 'local-mac-address' to structure at 'emac'
*
* Tested to work on a NanoPi NEO 1.4 - adjust for other devices as required
*/
fragment@0 {
target-path = "/aliases";
__overlay__ {
ethernet0 = "/soc/ethernet@1c30000";
};
};
fragment@1 {
target = <&emac>;
__overlay__ {
local-mac-address = [00 00 00 00 00 00];
};
};
};
This custom overlay can be compiled with
sudo armbian-add-overlay nanopi-neo-stable-mac.dts
You may verify that `/boot/armbianEnv.txt` has been expanded by a new user_overlays option like:
user_overlays=nanopi-neo-stable-mac
After a reboot, a stable MAC will be used (likely starting with `02:81`)
You may verify that `local-mac-address` has indeed been set by running:
sudo dtc -qq -I fs /proc/device-tree | grep local-mac-address
This should return something like:
local-mac-address = [ 02 81 01 ba dc af ];
My initial complaints were also gone.
What remains to be verified is whether that stable MAC is specific for that device or identical across multiple devices of the same type.
As I only have that one device, I cannot test this.
It would be important if you would run multiple NanoPi NEOs on the same link.
Maybe a developer can shed some light on how uboot acquires that MAC address?
Just to be clear, I'm just getting used to the environment I'm not trying to put anything into production. If I break it, I get to keep both pieces.
I am a BIG fan of Armbian and I hope I can at least feedback information.
I just want to post a thank you to the developers and contributors who have built one NICE distribution. Over a year ago I bought a few OPi PC as a possible replacement for Raspberry Pi based HAM radio projects I support. To say I was disappointed in the distribution from the manufacturer is a understatement. Without Loboris stepping up and getting something usable I would have tossed them in the trash and moved on. Last night I downloaded and installed Jessie server from Armbian. What a pleasure. Small, clean and a giant plus for me, HEADERS!!!!. I am so tired of having to build the headers for a kernel so I can compile the out of tree modules I need. I just ordered a few NanoPi NEO and I look forward to being able to run Armbian. Thank you VERY much! My next stop is the donate button.
I just want to post a thank you to the developers and contributors who have built one NICE distribution. Over a year ago I bought a few OPi PC as a possible replacement for Raspberry Pi based HAM radio projects I support. To say I was disappointed in the distribution from the manufacturer is a understatement. Without Loboris stepping up and getting something usable I would have tossed them in the trash and moved on. Last night I downloaded and installed Jessie server from Armbian. What a pleasure. Small, clean and a giant plus for me, HEADERS!!!!. I am so tired of having to build the headers for a kernel so I can compile the out of tree modules I need. I just ordered a few NanoPi NEO and I look forward to being able to run Armbian. Thank you VERY much! My next stop is the donate button.