[Solved] How to create a "backup" router?

OpenWrt tries to use the factory-determined MAC address for ports since it should be globally unique. The factory stores the MAC somewhere in a reserved area of flash such as a "factory" partition that OpenWrt always treats as read-only. Part of developing OpenWrt for a model is to find where the MAC is stored and set up code to read it. The problem is that different manufacturers and different models store the MAC in different places and different ways.

In some cases OpenWrt will extract the factory MAC at runtime when the port is brought up-- but in other cases a firstboot script extracts it only once and creates a device section in /etc/config/network like this:

config device 'lan_eth0_1_dev'
	option name 'eth0.1'
	option macaddr 'b4:fb:e4:<redacted>'

Luci does not have a way to access this value. It is supposed to be an invisible process of how the per-unit MAC on the sticker gets to be the default for the port.

This config stanza is part of the runtime configuration and since the backup / restore process stores whole files without parsing anything in the files, it will propagate to restoring a backup onto a different unit.

Again this only applies to some models, others will not have a config device and will get the unit's factory MAC directly from the ROM.

Also this is completely separate from the per-interface override mac address. The "factory" MAC is a default value.

3 Likes