Wifi problem (connected even after router restart)



  • Hello everybody,

    I have a question regarding wifi. My Omega2+ running stock BusyBox v1.26.2 (0.1.10 b160).
    I can connect to wifi with no problem but.....my router sometimes looses connection with internet and all i can do is powercycle it. After wifi is back(router) my onion doesnt reconnect back to AP as it is still connected by omegas state but not according to my router.

    With command
    iwconfig apcli0
    i get:
    apcli0 RTWIFI SoftAP ESSID:"XXXXXX"
    Mode:Managed Channel=2 Access Point: XX:XX:XX:XX:XX:XX
    Bit Rate=72 Mb/s
    with ifconfig i can see all ifaces BUT apcli0
    so i do ifconfig apcli0 up - in logread i can see it sends out DHCP requests but I think as it is "STILL" connected to AP it doesnt try to reconnect to AP.
    with command afterward wifimanager also doesnt reconnect to AP as it shows as connected.
    If i doo the reboot - it reconnects to AP as it should but i dont want to do the rebooting constantly if something goes wrong as during my debugging i can reboot my router even a few times in one hour (i know - GET A NEW ROUTER - no can do - implemented in cable modem - changed it with my ISP and the same thing happens - crappy choice but i am stuck with it)

    Does anybody know the command to release the connection to AP?
    have tried network restart, wifimanager all of them just check if AP is connected and if yes they do not try to reconnect to AP....

    BR
    Ales



  • @Ales-Strazar
    One of the wifi scripts (wifimanager / wifi - sorry away from O2's at the moment to check) resets the wifi hardware and then reconnects to the AP, so that is probably the one you want to run.

    Since you've tried wifimanager, then it is probably wifi. Just run it as is, I don't recall it needing any switches.

    You probably want to write up something fired off by cron every few minutes to check the network state (e.g. ping an address beyond your O2 or check ifconfig output for missing apcli0) and if it's down, run the wifi command to break and reconnect.

    I'm sure I've read about this on here somewhere, so if you search the forum, you might find an existing script to deploy.



  • I've read forum left and right but found only to check if OM2+ is disconnected from AP and I am checking that already ......and sorry forgot to wrote it yesterday I've tried wifi script also with no help.........
    What ever I do only reboot helps.......

    BR
    Ales



  • @Ales-Strazar
    And if you try this:

    # Disable wifi
    /sbin/uci set wireless.ra0.disabled=1
    /sbin/uci commit wireless
    /sbin/reload_config
    
    # Wait 5 seconds
    /bin/sleep 5
    
    # Enable wifi
    /sbin/uci set wireless.ra0.disabled=0
    /sbin/uci commit wireless
    /sbin/reload_config
    
    # Wait 30 seconds
    /bin/sleep 30
    
    # Run wifimanager verbose
    /usr/bin/wifimanager -v
    

    [edit]
    Should have mentioned, do this over a serial connection as the disable wifi section will break your ssh connection and then you will be unable to re-connect to enable the wifi.
    Alternatively, put it in a script and run it via cron.
    [/edit]



  • you could go into console wifi settings and delete record for that router then create new record. it is rather drastic method, i realize but considering all the other stuff you have tried might be quick considering



  • @Douglas-Kryder
    you mean config for wireless? Wont help.....I can delete the connected wifi info but interface is still connected to that wifi as it was before so no can do.......

    @cas
    been considering that option but the amount of time it takes.....i could also reboot it then.....when considering your option (even before u mentioned it) i thought to do it by shell script and run it once by cron job (i know it disconnects u from omega ap as it is bind to ra0 interface :)

    BR
    Ales



  • @cas
    been considering that option but the amount of time it takes.....i could also reboot it then.....

    Aah yes, but that requires manual intervention. ;-) As I rediscovered yesterday, the 30s sleep is quite important as it takes time for the hardware to realign before you run the wifimanager to reconnect.

    I wrote this a while back to turn the radio on and off as desired - 'set-radio-status.sh'. Feel free to adapt it and perhaps it could be useful to you. You'll need to add something that checks for connectivity and determines when to run it though.

    #! /bin/sh
    
    # uci set wireless.ra0.disabled=[0|1]
    
    #echo "Debug: $# $1"
    
    if [ "1" != "$#" ];then
     echo "Usage: $0 enable / disable"
     exit 0
    fi
    
    if [ "enable" != "$1" ] && [ "disable" != "$1" ];then
     echo "Usage: $0 enable / disable"
     exit 0
    fi
    
    if [ "enable" == "$1" ]; then
     ACTION=0
    else
     ACTION=1
    fi
    
    UCIBIN='/sbin/uci'
    WIFIMANAGERBIN='/usr/bin/wifimanager -v'
    RELOADCONFIGBIN='/sbin/reload_config'
    SLEEPBIN='/bin/sleep'
    
    RADIOSTATUS=`${UCIBIN} get wireless.ra0.disabled`
    
    if [ "0" == "${RADIOSTATUS}" ] && [ "1" == "${ACTION}" ];then
     # Currently enabled and choice is disable
     (>&2 echo "lights out")
     ${UCIBIN} set wireless.ra0.disabled=1
     ${UCIBIN} commit wireless
     ${RELOADCONFIGBIN}
    # ${WIFIMANAGERBIN}
    elif [ "1" == "${RADIOSTATUS}" ] && [ "0" == "${ACTION}" ]; then
     # Currently disabled and choice is enable
     ${UCIBIN} set wireless.ra0.disabled=0
     ${UCIBIN} commit wireless
     ${RELOADCONFIGBIN}
     ${SLEEPBIN} 30
     (>&2 echo "wifimanager -v")
     ${WIFIMANAGERBIN}
    else
     # Nothing to do
     echo "State is already as requested."
    fi
    


  • @cas GENIOUS!!!

    Thank you very much....yes the trick is in sleep :) !!!!!!!

    Case closed :)

    BR to all and a Happy new 2018!
    Ales



  • Also my check script with wifi restart that WORKS ! :)

    #next line is to test if previous instance of test.sh is still running - in case u run connectivity test every few seconds
    test1=$(ps |grep "test.sh" |grep -v grep |wc -l) 
    PINGTEST=$(ping www.google.com -c1 -W3|grep loss| awk {'print $7'})
    if [[ "$PINGTEST" != "0%" ]] && [[ $test1 == "0" ]] ; then
        /bin/sh test.sh
    fi
    
    #also what i do after negative test result on connectivity (test.sh):
    #! /bin/sh
    
    /sbin/uci set wireless.ra0.disabled=1
    /sbin/uci commit wireless
    /sbin/reload_config
    
    /bin/sleep 30
    
    /sbin/uci set wireless.ra0.disabled=0
    /sbin/uci commit wireless
    /sbin/reload_config
    /bin/sleep 30
    /usr/bin/wifimanager -v
    

    Like i said in case somebody needs the script to REALLY restart the whole wifi procedure.
    Please change the line:
    PINGTEST=$(ping www.google.com -c1 -W3|grep loss| awk {'print $7'})
    replace www.google.com with some other address as I don't think google guys will appreciate all the pings to their server :) Lets say some server u rely on but under your control - again not to "attack" somebody :)

    BR
    Ales


  • Banned

    This post is deleted!

Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.