Override MAC address for interface?

Robert Marko robimarko at gmail.com
Wed Feb 22 12:43:33 PST 2023


On Wed, 22 Feb 2023 at 21:39, Peter Naulls <peter at chocky.org> wrote:
>
> On 2/22/23 15:34, Robert Marko wrote:
>
> >>           option 'lan1'
> >>           option macaddr 34:BA:9A:CC:DD:EE
> >
> > This should work as long as its in single quotes.
>
> I corrected the quotes, but no joy.

Hm, that is weird as I have a device using this, albeit for WLAN interface
and it works.

>
> > Also, cant you fixup the MAC in 02_networking or in preinit?
>
> Yes, I have a preinit script, but it seems that the MAC address
> doesn't get retained. Probably cleared by netifd, which would be entirely
> expected.
>
> The plan of course is to have the preinit script do the config setting.

So, you have a script in /lib/preinit calling boot_hook_add
preinit_main with a function setting the MAC?
You can also use 02_network to set the MAC.

Regards,
Robert

>
>



More information about the openwrt-devel mailing list