Add random MAC generation after each reboot

For mobile phones it is applicable. Stores use it to track customers,. This can be for logistical purposes, like who goes where and why do we always have issues with isle 9. Or commercial, like those piles of boxes. They can see if people hang around them and later verify if they bought it.

But for a router ? Its questionable.

Have you tried it (because I haven't)? Devices in DSA inherit their MACs from eth0 as far as I remember. Will that change wan interface only or eth0, lan1, lan2, lan3... too?

EDIT: If that works why wasn't it documented here: https://openwrt.org/docs/guide-user/network/network_configuration ?

I question that too. Probably it's a nice thing to have implemented but it should be used with caution. Those concerned about tracking can enable SSID randomization, add "_nomap", "_noscan", whatever and disable GPS on their phones.

Yes, worked for wan, wan6. Never tried other lan ports

For me it was useful to get a new IP from my provider every day, otherwise it would be static…but after about one year of useage I lately became problems to they point the provider changed the modem because it wouldn’t provide a public IP and / or DNS was not working. After about four month the same failure started again. Though in my opinion it was both times a software / network problem on their side (because different hardware showed the same effect) they “decided” again to replace the merely four month old modem against the same model. Worked instantly, so I decided to disable random wan.

Just tried that on mt7622 (OpenWrt 24.10.3, specified on wan interface just like in your example) and it didn't work...

^^ That is strange….I used R7800 and a Asrock G10 afaik both DSA. You used

config device ?

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 'fadf:5abc:65c9::/48'                                                                                                                                                                                               
        option packet_steering '1'                                                                                                                                                                                                            
                                                                                                                                                                                                                                              
config device                                                                                                                                                                                                                                 
        option name 'br-lan'                                                                                                                                                                                                                  
        option type 'bridge'                                                                                                                                                                                                                  
        list ports 'lan1'                                                                                                                                                                                                                     
        list ports 'lan2'                                                                                                                                                                                                                     
        list ports 'lan3'                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                              
config interface 'lan'                                                                                                                                                                                                                        
        option device 'br-lan'                                                                                                                                                                                                                
        option proto 'static'                                                                                                                                                                                                                 
        option ipaddr '192.168.1.254'                                                                                                                                                                                                         
        option netmask '255.255.255.0'                                                                                                                                                                                                        
        option ip6assign '60'                                                                                                                                                                                                                 
        option ip6hint '10'                                                                                                                                                                                                                   
                                                                                                                                                                                                                                              
config interface 'wan'                                                                                                                                                                                                                        
        option proto 'pppoe'                                                                                                                                                                                                                  
        option device 'wan'                                                                                                                                                                                                                   
        option username 'USER'                                                                                                                                                                                                            
        option password 'PASSWD'                                                                                                                                                                                                            
        option ipv6 '1'                                                                                                                                                                                                                       
        option peerdns '0'                                                                                                                                                                                                                    
        list dns '127.0.0.1'                                                                                                                                                                                                                  
                                                                                                                                                                                                                                              
config interface 'wan6'                                                                                                                                                                                                                       
        option proto 'dhcpv6'                                                                                                                                                                                                                 
        option device '@wan'                                                                                                                                                                                                                  
        option reqaddress 'try'                                                                                                                                                                                                               
        option reqprefix 'auto'                                                                                                                                                                                                               
        option peerdns '0'                                                                                                                                                                                                                    
        list dns '::1'

Pay no attention to dns pointing at local device - It runs stubby for DoT. Device: AX3200.

^^ Where is the random thing or did you had another intention?

If you want I will add it again. It didn't work, I removed it.

^^ Probably useless if you used it like this:

How should I use it then? I tried both eth0 and wan. This is how it looks. It reports RANDOM via UI but ifconfig reports the same MAC (wireless MACs are truely random though).

There seems to be some difference in the code (or something else ;- ). I have a Netgear R7800 and a Asrock G10. Although both are ipq80x, for the G10 it works as described, R7800 not. The handling in /etc/board.d/02_network seems different:

/etc/board.d/02_network
#
# Copyright (c) 2015 The Linux Foundation. All rights reserved.
# Copyright (c) 2011-2015 OpenWrt.org
#

. /lib/functions/uci-defaults.sh
. /lib/functions/system.sh

ipq806x_setup_interfaces()
{
        local board="$1"

        case "$board" in
        arris,tr4400-v2)
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "eth2"
                ;;
        askey,rt4230w-rev6|\
        asrock,g10|\
        buffalo,wxr-2533dhp|\
        compex,wpq864|\
        linksys,e8350-v1|\
        linksys,ea7500-v1|\
        linksys,ea8500|\
        nec,wg2600hp|\
        nec,wg2600hp3|\
        netgear,d7800|\
        netgear,r7500|\
        netgear,r7500v2|\
        netgear,r7800|\
        netgear,xr450|\
        netgear,xr500|\
        qcom,ipq8064-ap148|\
        tplink,ad7200|\
        tplink,c2600|\
        tplink,vr2600v|\
        zyxel,nbg6817)
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
                ucidef_set_network_device_conduit "lan1" "eth1"
                ucidef_set_network_device_conduit "lan2" "eth1"
                ucidef_set_network_device_conduit "lan3" "eth1"
                ucidef_set_network_device_conduit "lan4" "eth1"
                ucidef_set_network_device_conduit "wan" "eth0"
                ;;
        asus,onhub|\
        tplink,onhub)
                ucidef_set_interfaces_lan_wan "lan1" "wan"
                ucidef_set_network_device_conduit "lan1" "eth1"
                ucidef_set_network_device_conduit "wan" "eth0"
                ;;
        edgecore,ecw5410|\
        extreme,ap3935)
                ucidef_set_interfaces_lan_wan "eth1" "eth0"
                ;;
        fortinet,fap-421e|\
        ignitenet,ss-w2-ac2600|\
        ubnt,unifi-ac-hd)
                ucidef_set_interface_lan "eth0 eth1"
                ;;
        meraki,mr42)
		ucidef_set_interface_lan "eth0"
                ;;
        meraki,mr52)
                ucidef_set_interfaces_lan_wan "eth0" "eth1"
                ;;
        qcom,ipq8064-ap161)
                ucidef_set_interface_lan "eth1 eth2 lan1 lan2 lan3 lan4" "wan"
                ;;
        qcom,ipq8064-db149)
                ucidef_set_interface_lan "eth1 eth2 eth3 lan1 lan2 lan3 lan4" "wan"
                ;;
        *)
                echo "Unsupported hardware. Network interfaces not intialized"
                ;;
        esac
}

ipq806x_setup_macs()
{
        local board="$1"

        case "$board" in
        asrock,g10)
                hw_mac_addr=$(mtd_get_mac_ascii hwconfig HW.LAN.MAC.Address)
                ucidef_set_interface_macaddr "lan" "$hw_mac_addr"
                hw_mac_addr=$(mtd_get_mac_ascii hwconfig HW.WAN.MAC.Address)
                ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 1)"
                ;;
        linksys,e8350-v1|\
        zyxel,nbg6817)
                hw_mac_addr=$(mtd_get_mac_ascii 0:appsblenv ethaddr)
                ucidef_set_interface_macaddr "lan" "$(macaddr_add $hw_mac_addr 2)"
                ucidef_set_interface_macaddr "wan" "$(macaddr_add $hw_mac_addr 3)"
                ;;
        esac
}

board_config_update
board=$(board_name)

ipq806x_setup_macs $board
ipq806x_setup_interfaces $board

board_config_flush

exit 0

Addendum: Probably not the root for the different behavior nor fixable there, but the underlying cause neither I nor the AI seems to understand ;- )