Hi guys, I’m using a GL- AR750 connected to Wireless Network: Client “WOW FI - FASTWEB” (wlan-sta) with a WPA2-EAP-MSCHAPV2 certificate. Connection can works flawlessly for days, but sometimes its MAC address get banned so I need to randomize from admin panel (More Settings - MAC clone - Your Router -WAN-). Doing this way, I’m back online in 10 seconds.
I read a lot of useful articles and scripts here, and tried merging. The result is
start() {
server=8.8.8.8
ping -c2 ${server} > /dev/null
if [ $? -ne 0 ]
then
interface="wlan-sta"
current_mac=$(ifconfig ${interface} | grep "HWaddr" | awk '{print$5}')
new_mac=$(dd if=/dev/random bs=1 count=3 2>/dev/null | hexdump -C | head -1 | cut -d' ' -f2- | awk '{ print "34:36:3b:"$1":"$2":"$3 }')
if [ $? -eq 0 ];
then
ifconfig $interface down
ifconfig $interface hw ether $new_mac
ifconfig $interface up
if [ $? -eq 0 ]; then
current_mac=$(ifconfig ${interface} | grep "HWaddr" | awk '{print$5}')
exit 0
else
exit 1
fi
}
But of course it won’t work, I don’t know the syntax of the script language
My goal is to save this file
/usr/bin/randomizer.sh
and use cron every minute
*/1 * * * * /usr/bin/randomizer.sh
to check if connection still works, otherwise change MAC on wlan-sta
No need to disconnect and reconnect from wlan-sta or restart wlan0 interface, so maybe the “interface up and down” part can be removed?
Thanks, will test immediately!
Tested, after disconnection it can’t reconnect at all, I must disable script and change MAC manually. And it doesn’t even work, MAC remain the same. I should test with wlan0 instead wlan-sta
Can I remove the following lines without problems or should they remain? Consider that wlan-sta remain connected to main network even when my MAC get banned (but without internet connection)
ifconfig $interface down
ifconfig $interface up
fi
fi
You cannot do it this way for wireless sta
mac=$(cat /proc/interrupts|sha256sum|sed “s/^(…)(…)(…)(…)(…).*$/02:\1:\2:\3:\4:\5/”)
uci set wireless.default_radio0.macaddr=“$mac” >/dev/null 2>&1
wifi down; sleep 3; wifi
Hi Rabbit, have you found a solution to change the mac address? I also need it for the wow fi.
I managed to ping google and take down and up the wlan-sta interface when unreachable.
The mac address change would do the trick!
ping -c2 ${SERVER} > /dev/null
if [ $? -ne 0 ]
then
echo “Offline”
ifconfig wlan-sta down
sleep 15
ifconfig wlan-sta up
else
echo “Online”
fi
saved in “/usr/bin/wifi_rebooter.sh” and activated with “*/1 * * * * /usr/bin/wifi_rebooter.sh” line using cron
But most of the times my router remain connected to WOW-FI network but without internet access, and when happen I must open web interface and change MAC manually, regaining internet access in few seconds. So a script would be the best option, but don’t know how to write it
Confirmed, same here. But got no disconnections since running this script.
I discovered that I can get “mac banned” in few seconds by uploading whatsapp backup to google drive when connected to WOW-FI network, then I must change MAC or wait from minutes to hours, even my girlfriend learned how to change MAC manually from web interface when needed
I’m doing it manually since 3 years, not the best but I spared so much money compared to having an internet contract that I can live with that. But automatizing would be awesome. Luckily in the past 3 days I had no MAC bans at all, hope it will continue this way
I don’t know, but I guess that this parameter isn’t needed to avoid disconnections. I wrote “FASTWEB” here since 1st day. But should I get disconnected with no automatic reconnection when I’m on PC, I’ll try changing this field instead of requiring a new random MAC