Edgerouter 6P: random MAC address

Hello,

when i boot my ubiquity Edgerouter 6P i get random mac addresses on each boot.
Normaly the MAC is stored at mtd2 partition, but this partition is not mounted (i see only mtd0 and mtd1)
When i remove compatible = "nvmem-cells"; from &eeprom in dtsi file, mtd2 is mounted
but the MAC address is still random.

Is there any driver missing? NVMEM is loaded
Any hints?
Thanks, regards, Carsten

Normaly you get this behavior if you have modified the network config and removed the initial boot mac setting. Or reused old configs?

When you have installed openwrt it get the hardcoded mac at initial boot.

But to solve this you can set up manual mac (preferable the mac on the sticker on the bottom) in the device setting in network config.

1 Like

Just to clarify: i get different random MAC addresses after each reboot.

I didn't modify the network config, and after boot there were no boot mac settings.
Starting initramfs-kernel.bin from u-boot i get the following in /etc/config/network

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd9a:e4af:bf37::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'lan1'
	list ports 'lan2'
	list ports 'lan3'
	list ports 'lan4'
	list ports 'lan5'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option device 'lan0'
	option proto 'dhcp'

config interface 'wan6'
	option device 'lan0'
	option proto 'dhcpv6'

So there are no MAC entries here and i think there is no need to be here.
From my understanding the MAC address should be read from SPI flash mapped to nvmem,
but this isn't working for unknown reason.

I know that i can set the MAC address here manually, but i think it should be possible to get it from SPI flash,

BTW: when looking at the original EdgeOS installation the MAC address is here also stored in the device tree (/sys/firmware/devicetree/base/soc@0/pip@11800a0000000/interface@0/ethernet@0/local-mac-address)
But i don't know if this is written at device startup or if the device tree file is generated on SW install.

After digging into kernel source, i found the reason for the missing MTD partition in MTD parser.

The original .dts file was structured like:

flash@0 {
	[...]
	partition@0 { [...] };
	partition@300000 { [...] };
	eeprom: partition@400000 {
		compatible = "nvmem-cells";
		[...]
	};
};

The compatible property prevents the 3rd partition to be populated.
To work correctly the partitions must be surrounded by an partitions node as:

flash@0 {
	[...]
	partitions {
		[...]
		partition@0 { [...] };
		partition@300000 { [...] };
		eeprom: partition@400000 {
		compatible = "nvmem-cells";
			[...]
		};
	};
};

I'll provide a PR in github to fix it.

2 Likes

Wonder if this applies to the other ER devices also?

I think it will apply also to ER 4,
other targets (e.g. in qca9563_ubnt_unifiac.dtsi) contain the partitions node.

PR created: https://github.com/openwrt/openwrt/pull/13098

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.