Can somebody help me with script (MAC generator)?

One can be changed natively, also travelmate changes client mac and saves one per network.
i am pretty sure you cannot easily disable lan-side maintenance beacon easily.
Also dhcp parameters have some imprints.
Thats as far existing functionality goes, btw changing imei is illegal in most if the world.

1 Like

Ohā€¦ I used AT command to change itā€¦ Crapā€¦

I donā€™t need. I can make information be random. The requirement is ā€œrandom BSSID, random Radio MAC, random WAN mac, random repeater MACā€. They should be set at each reboot (to avoid potential connection issues). Just simple script in init.d.

If you have more good script for init.d, can you share it please?

BSSID is MAC

I know. I mean MAC can be visible on different interfaces. I need to randomise it on all visible interfaces

netifd changes AP BSSID
travelmate changes wwan BSSID per network
Install macchanger and add other interfaces to rc.local.

No no. I need especially one script that will do this. I tried automatic method in OpenWRT - it seems not to do what I meant. It changed only radio MAC. WWAN and WAN stays the sameā€¦

#/bin/ash
macchanger -r wan

to change wwan mac you need travelmate package.

Found this:

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

START=98
STOP=15

logit() {
    echo "$@" | tee -a /var/log/mac_change.log
    logger -t mac_change "$@"
}

generate_random_mac() {
    printf "02:%02x:%02x:%02x:%02x:%02x" \
        $((RANDOM % 256)) \
        $((RANDOM % 256)) \
        $((RANDOM % 256)) \
        $((RANDOM % 256)) \
        $((RANDOM % 256))
}

change_mac_address() {
    local iface=$1
    local mac=$(generate_random_mac)
    
    if ifconfig | grep -q "$iface"; then
        logit "Changing MAC address of $iface to $mac"
        ifconfig "$iface" down
        ifconfig "$iface" hw ether "$mac"
        ifconfig "$iface" up
    else
        logit "Interface $iface does not exist."
    fi
}

start() {
    logit "Starting MAC address changer..."
    interfaces=$(ls /sys/class/net)
    for iface in $interfaces; do
        change_mac_address "$iface"
    done
    logit "MAC addresses changed successfully."
}

stop() {
    logit "Stopping MAC address changer..."
}

Can somebody check if it will work?

There is macchanger tool exactly for your purposes, just add it to /etc/rc.local for each interface you need to change.

1 Like

I wanna automate this. To make it automatically find interfacesā€¦

So you need to detect automatically your only ethernet port that never gets renamed?

No. I may add VVANā€¦ This router regularly configurated

If you handle wwans with travelmate you can check the box to have random MAC per access point.

How many times can MAC be changed? Isnā€™t this wearing off some chip?

No, burned-in MACs stay on chips, changed MAC is only in chip memory

1 Like

You mean OS memory?

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

START=99

start() {
    config_load networking
    config_foreach change_mac_interface setup_interface
}

setup_interface() {
    local interface="$1"
    if [ "$interface"!= "lo" ]; then
        macchanger -r "$interface"
    fi
}

So I wrote this to use macchanger maybe this will be enough?

Sorry for too many questions, I am total noob :smiling_face_with_tear:

Quite excessive. Will be ignored if you configure wifi-s to randomize air BSSID-MAC.

1 Like

What do you mean? Like option in Luci?

Yes, check access points MAC adresses in lower part / advanced. Restart acess point - check MAC from the air.

1 Like

This will change BSSID only? How to change WANs?