How to set macchanger

Good evening,

I would like to have my router randomize its MAC addresses on a daily basis.
In my Arch Linux installation I solved it by installing the package in question, i.e. macchanger.
To succeed, I therefore gave:
sudo ip link set dev enpxsx down to disable the interface
Created the file "/etc/systemd/system/macspoof@enpxsx.service" containing:


[Unit]
Description=macchanger on %I
Wants=network-pre.target
Before=network-pre.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
ExecStart=/usr/bin/macchanger -e %I
Type=oneshot

[Install]
WantedBy=multi-user.target

Enabled the service with systemctl
And finally re-enabled the interface
Just wanting to do the same thing with my router, I then installed macchanger on it too, but now I wonder how to "translate" all this to an OpenWrt router.
I have not found the documentation for the OpenWrt version of macchanger...
Thank you in advance!

OpenWrt does not have systemd. Services use the older init.d system.

I would suggest writing a script that applies a new random MAC to the network configuration using the uci command:
uci set network.wan.macaddr=$NEWMAC
uci commit network
Then you can wrap this script in a service or simply have cron launch it once per day.

Of course the Internet service will be disrupted for at least several seconds while reconnecting with a new MAC.

The bigger question would be, 'why?!'.

MAC addresses are layer 2, the only one who's going to see your MAC, is your ISP - and they know very well who you are anyways, after all someone is paying the bills…

Thanks for your answer, now I go deeper into the init.d cron topic.

I could tell you that it is only for my educational purpose, but by telling you that I simply do not want the network to which I connect with my router to see my real MACs, I would be more sincere...

Wanting to use macchanger instead, since, if it is the same as for Arch Linux, it has some functions that I consider interesting (such as keeping the first 3 pairs of the interface manufacturer unchanged), I can also use it by combining it with an init.d service? Anyone know how this specific package works?

Update in which case anyone cares.
I gave up on macchanger, I found a script online and I modified it for my needs as follows:

#!/bin/sh /etc/rc.common

START=17

start()
{
	interface="wan"
	old_mac=$(uci get network.${interface}.macaddr)
	new_last_three_pairs=$(dd if=/dev/urandom bs=1024 count=1 2>/dev/null | md5sum | sed -e 's/^\(..\)\(..\)\(..\).*$/\1:\2:\3/' -e 's/^\(.\)[13579bdf]/\10/')
	new_mac="${old_mac:0:8}:${new_last_three_pairs}"
	uci set network.${interface}.macaddr=${new_mac}
	uci commit network
}

With the "wan" and "wan6" interface it works, however, it doesn't seem to work if I apply the same script to the other interfaces as well (lan and wwan). What am I missing?
Also I ask you: could it cause problems if the MACs of wan, wan6, lan and wwan are each totally different from the others? (By default, in my router, only the last character of the MAC of each of them changes).