What's new

Solved Enable/Disable guest network on schedule (crontab)

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

mvadu

Regular Contributor
I have few Tasmota IOT devices running on ESP8266 chips. They have some compatibility problem with Asus AiMesh they keep going in loop trying to connect and failing to connect (no error in Asus side, but device thinks it couldn't find the access point.
wlceventd_proc_event(491): wl0.2: Deauth_ind 98:F4:AB:EA:CA:6F, status: 0, reason: Deauthenticated because sending station is leaving (or has left) IBSS or ESS (3), rssi:0
wlceventd_proc_event(527): wl0.2: Auth 98:F4:AB:EA:BB:AA, status: Successful (0), rssi:0

What I have noticed is if I stop and start the access point, they connect just fine. So I moved them to a guest network so its very easy for me to disable/enable the guest network. Now I want to try doing that every day at a specific time (proactively instead of doing it reactively after seeing the device failures). SO I started looking if there a command I can run in the shell (so it can be added to crontab) which is equivalent of GuestNetwork->Remove/Enable?

Looking at github code, its calling a en_dis_guest_unit (https://github.com/RMerl/asuswrt-me...release/src/router/www/Guest_network.asp#L903). Which is updating some qos based on the guest network number (e.g. second guest network is wl0.2). But my reverse engineering skills aren't deep enough to figure how dis_qos_enable function is actually dealing with interfaces.

Is it ultimately as simple as toggling that interface?

Code:
merlin@RT-AC86U:/tmp/home/root# ifconfig | grep wl
wl0.1     Link encap:Ethernet  HWaddr 0C:9D:92:AA:DD:B1
wl0.2     Link encap:Ethernet  HWaddr 0C:9D:92:AA:DD:B2
merlin@RT-AC86U:/tmp/home/root# ifconfig wl0.2 down
merlin@RT-AC86U:/tmp/home/root# ifconfig | grep wl
wl0.1     Link encap:Ethernet  HWaddr 0C:9D:92:AA:DD:B1
merlin@RT-AC86U:/tmp/home/root# ifconfig wl0.2 up
merlin@RT-AC86U:/tmp/home/root# ifconfig | grep wl
wl0.1     Link encap:Ethernet  HWaddr 0C:9D:92:AA:DD:B1
wl0.2     Link encap:Ethernet  HWaddr 0C:9D:92:AA:DD:B2
merlin@RT-AC86U:/tmp/home/root#
 
#!/bin/bash
## /jffs/scripts/reset_guest_wifi.sh
# echo cru a vpnon "0 7 * * * /jffs/scripts/reset_guest_wifi.sh" >> services-start
## Script to restart guest networks
guest1=$(nvram get wl0.1_bss_enabled)
guest2=$(nvram get wl0.2_bss_enabled)
guest3=$(nvram get wl0.3_bss_enabled)

nvram set wl0.1_bss_enabled=0
nvram set wl0.2_bss_enabled=0
nvram set wl0.3_bss_enabled=0
nvram commit
service restart_wireless
nvram set wl0.1_bss_enabled=$guest1
nvram set wl0.2_bss_enabled=$guest2
nvram set wl0.3_bss_enabled=$guest3
nvram commit
service restart_wireless
## -----------------------------------------------------------------------------
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top