What's new

Command to query Backhaul Wireless Uplink Type

  • 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!

rrossorr

Occasional Visitor
I have 2 RT-AC86U routers in a wireless mesh configuration. Running into some issues where the backhaul will go from 5GHz to 2.4. I usually only hear about this when my family complains about how slow their internet is. A reboot of the downstairs node fixes the issue. Is there a command I can run on the master or node (through ssh) that I can query the backhaul spectrum that's being used? I'll be running this from a bash script on my computer.

Thanks
 
Yup .. Not sure

just ran the following 2 commands from the ChannelHog script on the Master Node via ssh

Code:
port5ghz1="$(nvram get wl_ifnames | grep -oF "$(ifconfig | grep -F "$(nvram get wl1_hwaddr)"...
-> eth6

Code:
currentbandwidth1="$(wl -i eth6 assoc | grep -F "Chanspec" | awk '{print $5}')"
-> 80MHz

Is my wireless backhaul really "eth6"?

My Router Wireless Config has:
2.4GHz - 20/40Mhz
5GHz - 20/40/80Mhz

So, If my backhaul is really eth6 then anything less than 80Mhz is on the 2.4GHz spectrum?

Again, I'm looking to query the backhaul from a bash script that I'm running on my Mac.

Thanks
 
Last edited:
@ColinTaylor, you're right. Reading too fast last night.
 
Thanks to @L&LD for pointing to ChannelHog, I put together the following (port recycle untested)

Some of my assumptions were wrong (thinking the wl would show me the downgrade vs getting an error message).

In my case, recycling the adaptor did not fix the issue requiring the reboot to correct.

Here is the current script in case someone has a similar issue
Replace prt and prt-error with echo or your print of choice
"asus" and "asusnode" are defined in my ~/.ssh/config file utilizing key authentication

Code:
#!/usr/bin/env bash

# Thanks to https://github.com/Adamm00/ChannelHog for pointing me to the nvram/ifconfig to get the backhaul adapter

for router in asus asusnode; do

    prt ""
    prt-underline "$router"

    wl1=$(ssh $router 'ifconfig | grep -F $(nvram get wl1_hwaddr) | head -1')

    set $wl1
    interface=$1
    mac=$5

    response=$(/usr/bin/ssh $router wl -i $interface assoc)

    # The wl command will return 'Not associated. Last associated with SSID: ""' if backhaul is downgraded to 2.4GHz
    # Which, in turn, will return "" from the awk
  
    chanspec=$(printf '%s\n' "$response" | awk '/Chanspec:/ {print}')

    if [[ ! $chanspec ]]; then
        prt-error "$(printf %-30s "$router") backhaul downgraded"
        if [[ -f ~/etc/asusRebooted ]]; then
            prt-error "$(printf %-30s "$router") reboot failed to fix"
        else
            >~/etc/asusRebooted
            prt-error "$(printf %-30s "$router") rebooting"
            /usr/bin/ssh $router reboot
        fi
        exit
    fi

    rm ~/etc/asusReboot &>/dev/null

    set $chanspec
    antenna=$2
    width=$5

    mode=$(printf '%s\n' "$response" | awk '/Mode:/ {print}')
    set $mode
    rssi=$4
    noise=${10}
    channel="${@:$#}"

    prt "$(printf %-30s "Interface") ${interface}"
    prt "$(printf %-30s "MAC") ${mac}"
    prt "$(printf %-30s "Antenna") ${antenna}"
    prt "$(printf %-30s "Channel Width") ${width}"
    prt "$(printf %-30s "RSSI") ${rssi} dBm"
    prt "$(printf %-30s "Noise") ${noise} dBm"
    prt "$(printf %-30s "Channel") ${channel}"
done
 
Last edited:
Hmm, I guess my mind works in mysterious ways!

Looks like another script is being born here. :)
 

Latest threads

Sign Up For SNBForums Daily Digest

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