Dismiss Notice

Welcome To SNBForums

SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.

If you'd like to post a question, simply register and have at it!

While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!

[RT-AC87U] Custom script - radio manipulation - need help

Discussion in 'Asuswrt-Merlin' started by Tostaki, May 19, 2017.

  1. Tostaki

    Tostaki New Around Here

    Joined:
    May 19, 2017
    Messages:
    7
    Location:
    France
    Hello,

    I wanted to add a custom "night mode" to my RT-AC87U router. My target is to shutdown the wireless adapters and the leds at night. A custom script + a cron job does the job.
    This solution enables me get the wifi harware button not turning off the scheduling each time it is pressed.

    I just need help to get it working for the 5G network. At this time only the 2.4G one works with the following command. I did not found the 5G interface

    Does anybody knows how to deal with the 5g adapter ?

    Trying to list the interfaces gave me the following
    Code:
    [email protected]:/# lshw
    -sh: lshw: not found
    
    [email protected]:/# wl status
    SSID: "myssid"
    Mode: Managed   RSSI: 0 dBm   SNR: 0 dB   noise: -91 dBm   Channel: 9l
    BSSID: F0:79:59:D4:XX:XX   Capability: ESS ShortSlot RRM
    Supported Rates: [ 1(b) 2(b) 5.5(b) 6 9 11(b) 12 18 24 36 48 54 ]
    VHT Capable:
       Chanspec: 2.4GHz channel 11 40MHz (0x180b)
       Primary channel: 9
       HT Capabilities:
       Supported MCS : [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 32 ]
       VHT Capabilities:
       Supported VHT (tx) Rates:
           NSS: 1 MCS: 0-9
           NSS: 2 MCS: 0-9
           NSS: 3 MCS: 0-9
       Supported VHT (rx) Rates:
           NSS: 1 MCS: 0-9
           NSS: 2 MCS: 0-9
           NSS: 3 MCS: 0-9

    My full script which does not work entirely
    Code:
    #!/bin/sh
    
    show_help()
    {
        echo "Arrete et relance le wifi par script. Les leds suivent la meme logique"     
        echo "usage:"
            echo "nightmode -on         wifi off, leds off"
            echo "nightmode -off        wifi on, leds on"
            echo ""
    }
    
    option="${1}"
    case ${option} in
    
                    -on)
                #2.4G network                     
                wl -i eth1 radio off
                #5G network - does not work on RT-AC87U - wl driver adapter not found
                wl -i eth2 radio off
                logger ****Wifi off****
                nvram set led_disable=1
                service restart_leds
    
                    ;;
    
                    -off)
                #2.4G network                     
                wl -i eth1 radio on
                #5G network - does not work on RT-AC87U - wl driver adapter not found
                wl -i eth2 radio on
                logger ****Wifi on****
                nvram set led_disable=0
                service restart_leds
                    ;;
    
                    *) show_help
                    exit 1
                    ;;
    esac
     
    TheUntouchable likes this.
  2. TheUntouchable

    TheUntouchable Occasional Visitor

    Joined:
    May 17, 2017
    Messages:
    30
    Location:
    Germany
    Thanks for that script, I personally like the led off feature a lot and will use your script without the wlan feature! Sadly I can't help you any further with the 5GHz WLAN problem :(
     
  3. Tostaki

    Tostaki New Around Here

    Joined:
    May 19, 2017
    Messages:
    7
    Location:
    France
    You're welcome.
    The Led part is taken from the AsusMerlin Wiki :)

    About radio, I tried different option without success so far.

    By the way, I noticed a weird beahvior of Dropbear SSH server. The password I set on the router was not accepted to login ssh. Changing the password to something dummy simple, worked. Here the examples :

    Password type : "Mickey mous is the world best know mouse" => fail to login sshd
    Password type : "admin" => succeed to login sshd
     
    TheUntouchable likes this.
  4. RMerlin

    RMerlin Part of the Furniture

    Joined:
    Apr 14, 2012
    Messages:
    22,575
    Location:
    Canada
    Password is limited to 16 characters.
     
    amplatfus likes this.
  5. Tostaki

    Tostaki New Around Here

    Joined:
    May 19, 2017
    Messages:
    7
    Location:
    France
    Thank you @RMerlin for the password feedback.

    Any idea about the eth interface for 5G network ?

    Thx
     
  6. Jack Yaz

    Jack Yaz Senior Member

    Joined:
    Apr 20, 2017
    Messages:
    230
    At a guess, I think its like vlan4000 for 5ghz on 87U, though I didn't have much luck with it. The guests appear to fall into line with w1.1 etc!
     
  7. Tostaki

    Tostaki New Around Here

    Joined:
    May 19, 2017
    Messages:
    7
    Location:
    France
    I tested without luck eth1.0, eth1.1 and eth 1.2.
    After a carefull read of a first test report by @RMerlin it appears, 5G network is on a dedicated CPU (Qantenna). A simple ifconfig does not list the interface...
     
  8. Zirescu

    Zirescu Very Senior Member

    Joined:
    Jul 16, 2013
    Messages:
    641
    Location:
    Kelowna, BC
    Why not use the built-in wireless scheduler under the Wireless Professional tab?
     
  9. Tostaki

    Tostaki New Around Here

    Joined:
    May 19, 2017
    Messages:
    7
    Location:
    France
    I am know using the built-in feature. But this is the moot point here.

    As soon as my kids are overriding the schedule using the front panel button, the scheduling is disabled. As this is the design of the feature by construction, I was looking for a workaround. The custom script seems to be a good idea as soon as I found the way to control the 5G network through command line.
     
  10. CivHunter

    CivHunter Occasional Visitor

    Joined:
    Jun 20, 2013
    Messages:
    31
    Would the parental controls give the results you are looking for? Limiting the hours of access for your kids devices?
     
  11. Zirescu

    Zirescu Very Senior Member

    Joined:
    Jul 16, 2013
    Messages:
    641
    Location:
    Kelowna, BC
    See here: #5
     
  12. Tostaki

    Tostaki New Around Here

    Joined:
    May 19, 2017
    Messages:
    7
    Location:
    France
    Thank you @Zirescu

    The solution is then

    Code:
    #!/bin/sh
    #This script works on RT-AC87U which has 2 different CPU for 2.4 and 5.0 wireless networks
    show_help()
    {
        echo "Arrete et relance le wifi par script. Les leds suivent la meme logique"   
        echo "usage:"
            echo "nightmode -on         wifi off, leds off"
            echo "nightmode -off        wifi on, leds on"
            echo ""
    }
    
    option="${1}"
    case ${option} in
    
          -on)
              #5.0G AP control
              qcsapi_sockrpc rfenable 0 wifi0
              #2.4G AP control
              wl -i eth1 radio off
    
              logger ****Wifi is off****
             
              nvram set led_disable=1
              service restart_leds
             
              logger ****Leds are off****
    
                    ;;
        -off)
             #5.0G AP control
             qcsapi_sockrpc rfenable 1 wifi0
             #2.4G AP control               
             wl -i eth1 radio on
             
             logger ****Wifi is on****
             
             nvram set led_disable=0
             service restart_leds
             
             logger ****Leds are on****
                    ;;
    
       *) show_help
                    exit 1
                    ;;
    esac
    I'll test this asap and let you know.
     
    Last edited: May 23, 2017 at 6:12 AM
    TheUntouchable likes this.
  13. Tostaki

    Tostaki New Around Here

    Joined:
    May 19, 2017
    Messages:
    7
    Location:
    France
    The idea is not to prevent kids from using Wifi. They are old enough and responsible to be allowed. The idea is to get a scheduling which is "kill switch proof". Wifi is really useful but at some time we do not need to get it on.
     

Share This Page