19.07: Changing WAN MAC via script does not seem to apply. Bug or command change?

I had created an "sh" script that changes the MAC of WAN. By creating, I mean, I copied and modified code snippets that I got from the Internet. I invoked it manually from time to time via SSH, and it had been working.

Recently I upgraded OpenWRT to 19.07 and the sh script was gone. I did not know the files system will be reset after OpenWRT upgrade... I thought it would be like Android or Linux where files are kept. So, I had to create it again, and I am not sure the codes are the same or not.

Anyway, basically the script uses

uci set network.wan.macaddr=new MAC
uci commit network

The old script had some kind of delay until it returned, but this time, the script returns instantly. When I open the web interface and see the "Interfaces" page, the "MAC" value still shows the old value. If I click the "Edit" button, I can see the new MAC at "Advanced Settings -> Override MAC address", but it does not seem to be actually applied. I pressed the "Restart" button, and now the "MAC" value is changed to the new value. Why is it so? Is this a bug? Or do I have to use a new command to apply the new MAC?

It returns instantly because all you're doing is updating a line in a config file.
The missing part will be a /etc/init.d/network restart if i had to guess.

2 Likes

It worked. Thank you.

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