What's new

List associated WiFi clients on command line?

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

Jack Yaz

Part of the Furniture
Like Wireless Log, but in a terminal. I can see the page is using AJAX but I can't follow it at that point, AJAX is a mystery to me!
 
Like Wireless Log, but in a terminal. I can see the page is using AJAX but I can't follow it at that point, AJAX is a mystery to me!

It varies between router models.
 
Thanks, I can then use arp and other commands to get hostname and ip address!
Like in my wireless monitor script ;).
Code:
#!/bin/sh

# This script only works with Broadcom wireless chipsets, not Quantenna.
# https://www.snbforums.com/threads/to-trace-mobile-mac-adress.20022/#post-144852

oldlist=/tmp/assoclist.old
newlist=/tmp/assoclist.new
touch $oldlist          # Create an empty file the first time through

while sleep 15
do
        for iface in $(nvram get wl_ifnames) $(nvram get wl0_vifs) $(nvram get wl1_vifs)
        do
                wl -i $iface assoclist >> $newlist
                sed -i "s/assoclist/$iface/g" $newlist
        done

        grep -vxFf $newlist $oldlist | while read macinfo
        do
                macaddr="${macinfo#* }"
                arpinfo="$(arp -a | grep -iF $macaddr | awk '{print $1 " " $2}')"
                logger -t "wireless" $macinfo $arpinfo "has disconnected."
        done

        grep -vxFf $oldlist $newlist | while read macinfo
        do
                macaddr="${macinfo#* }"
                arpinfo="$(arp -a | grep -iF $macaddr | awk '{print $1 " " $2}')"
                logger -t "wireless" $macinfo $arpinfo "has connected."
        done

        mv $newlist $oldlist
done
 
Last edited:
Like in my wireless monitor script ;).
Code:
#!/bin/sh

# This script only works with Broadcom wireless chipsets, not Quantenna.
# https://www.snbforums.com/threads/to-trace-mobile-mac-adress.20022/#post-144852

oldlist=/tmp/assoclist.old
newlist=/tmp/assoclist.new
touch $oldlist          # Create an empty file the first time through

while sleep 15
do
        for iface in $(nvram get wl_ifnames) $(nvram get wl0_vifs) $(nvram get wl1_vifs)
        do
                wl -i $iface assoclist >> $newlist
                sed -i "s/assoclist/$iface/g" $newlist
        done

        grep -vxFf $newlist $oldlist | while read macinfo
        do
                macaddr="${macinfo#* }"
                arpinfo="$(arp -a | grep -iF $macaddr | awk '{print $1 " " $2}')"
                logger -t wireless $macinfo $arpinfo "has disconnected."
        done

        grep -vxFf $oldlist $newlist | while read macinfo
        do
                macaddr="${macinfo#* }"
                arpinfo="$(arp -a | grep -iF $macaddr | awk '{print $1 " " $2}')"
                logger -t wireless $macinfo $arpinfo "has connected."
        done

        mv $newlist $oldlist
done
Would you mind if i incorporate it (while adding support for my ac87u) as a status output for YazFi? I'll be sure to credit you in the code!
 
Would you mind if i incorporate it (while adding support for my ac87u) as a status output for YazFi? I'll be sure to credit you in the code!
By all means. It's all free code, I don't have copyright on awk, sed or grep :D. In fact I'd like to see a version that also worked with Quantenna. I would have written one myself but had no way of testing it.
 
By all means. It's all free code, I don't have copyright on awk, sed or grep :D. In fact I'd like to see a version that also worked with Quantenna. I would have written one myself but had no way of testing it.
Cheers. I still prefer being polite and asking! I'm hoping the linked post you sent with Merlin's input on the Quantenna input will be enough, otherwise at least i know where to start!
 
By all means. It's all free code, I don't have copyright on awk, sed or grep :D. In fact I'd like to see a version that also worked with Quantenna. I would have written one myself but had no way of testing it.
So for the primary networks, using
Code:
nvram get wl_ifnames
is wifi0 2.4ghz and eth1 5Ghz?

Or as per John's post in the linked thread,

eth1 2.4ghz
eth2 5ghz

and wifi0 is a red herring?
 
This is what I didn't know because I don't have an RT-AC87U.

All I know is that other post refers to wifi0 which is apparently the Quantenna 5GHz radio???

On the Broadcom based routers:

eth1 - 2.4GHz
eth2 - 5GHz
wl0.x - 2.4GHz guest
wl1.x - 5GHz guest

I don't know whether it's possible to identify whether a Quantenna client (wifi0) is on a guest network or not.
 
Last edited:
What do you get on your RT-AC87U for:

nvram get wl_ifnames
nvram get wl0_vifs
nvram get wl1_vifs
 
This is what I didn't know because I don't have an RT-AC87U.

All I know is that other post refers to wifi0 which is apparently the Quantenna 5GHz radio???

On the Broadcom based routers:

eth1 - 2.4GHz
eth2 - 5GHz
wl0.x - 2.4GHz guest
wl1.x - 5GHz guest

I don't know whether it's possible to identify whether a Quantenna client (wifi0) is on a guest network or not.
eth1 probably works on 87U but I have (unhelpfully, for this test) named both 2.4 and 5 with the same SSID.

wifi0 (via qcsocket) works for primary 5GHz, and wl0.x for 2.4GHZ also works
 
I'm also interested in this, I have an RT-AC87U running Merlin 380.70. Here's what I get, let me know if you need more

me@87u:/tmp/home/root# nvram get wl_ifnames
eth1 wifi0
me@87u:/tmp/home/root# nvram get wl0_vifs
wl0.1
me@87u:/tmp/home/root# nvram get wl1_vifs
wl1.1
me@87u:/tmp/home/root#
 
Hi Colin, below is the router's output, this is with both radios on with one guest wifi on each, I have different ssid names per radio.

Note I have an isolated vlan100 that i use for some wired devices. Bridging a new vlan with the guest wlans is on my list of things to do, a while back I made an attempt but it didn't work as I don't keep the guest wlans on all the time and they would drop back onto br0 when reactivated.

Code:
me@87u:/tmp/home/root# ifconfig -a
aux0      Link encap:Ethernet  HWaddr 9C:::::
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:28844 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2227820 (2.1 MiB)  TX bytes:0 (0.0 B)
          Interrupt:180 Base address:0x5000

br0       Link encap:Ethernet  HWaddr 9C:::::
          inet addr:10...  Bcast:10...  Mask:255.255.255.0
          UP BROADCAST RUNNING ALLMULTI MULTICAST  MTU:1500  Metric:1
          RX packets:394589 errors:0 dropped:0 overruns:0 frame:0
          TX packets:504231 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:32081386 (30.5 MiB)  TX bytes:553110262 (527.4 MiB)

br0:0     Link encap:Ethernet  HWaddr 9C:::::
          inet addr:169.254.39.93  Bcast:169.254.39.255  Mask:255.255.255.0
          UP BROADCAST RUNNING ALLMULTI MULTICAST  MTU:1500  Metric:1

eth0      Link encap:Ethernet  HWaddr 9C:::::
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3695701 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1290999 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:627446434 (598.3 MiB)  TX bytes:660557364 (629.9 MiB)
          Interrupt:181 Base address:0x6000

eth1      Link encap:Ethernet  HWaddr 9C:::::
          UP BROADCAST RUNNING ALLMULTI MULTICAST  MTU:1500  Metric:1
          RX packets:1907 errors:0 dropped:0 overruns:0 frame:21239
          TX packets:3272 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:221559 (216.3 KiB)  TX bytes:2250781 (2.1 MiB)
          Interrupt:163

ifb0      Link encap:Ethernet  HWaddr 26:::::
          BROADCAST NOARP  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ifb1      Link encap:Ethernet  HWaddr B6:::::
          BROADCAST NOARP  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING MULTICAST  MTU:16436  Metric:1
          RX packets:83802 errors:0 dropped:0 overruns:0 frame:0
          TX packets:83802 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:21630137 (20.6 MiB)  TX bytes:21630137 (20.6 MiB)

tun21     Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:10...  P-t-P:10...  Mask:255.255.255.0
          UP POINTOPOINT RUNNING NOARP PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

vlan1     Link encap:Ethernet  HWaddr 9C:::::
          UP BROADCAST RUNNING ALLMULTI MULTICAST  MTU:1500  Metric:1
          RX packets:293625 errors:0 dropped:0 overruns:0 frame:0
          TX packets:414362 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:22510933 (21.4 MiB)  TX bytes:427144393 (407.3 MiB)

vlan100   Link encap:Ethernet  HWaddr 9C:::::
          inet addr:192...  Bcast:192...  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:111 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:14578 (14.2 KiB)

vlan2     Link encap:Ethernet  HWaddr 9C:::::
          inet addr:10...  Bcast:10...  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3430623 errors:0 dropped:0 overruns:0 frame:0
          TX packets:881778 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4882193175 (4.5 GiB)  TX bytes:230483829 (219.8 MiB)

vlan4000  Link encap:Ethernet  HWaddr 9C:::::
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:297 errors:0 dropped:0 overruns:0 frame:0
          TX packets:324 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:21186 (20.6 KiB)  TX bytes:27852 (27.1 KiB)

wl0.1     Link encap:Ethernet  HWaddr 9C:::::
          UP BROADCAST RUNNING ALLMULTI MULTICAST  MTU:1500  Metric:1
          RX packets:135867 errors:0 dropped:0 overruns:0 frame:21239
          TX packets:151574 errors:108 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:169820059 (161.9 MiB)  TX bytes:198295295 (189.1 MiB)

me@87u:/tmp/home/root# robocfg show
Switch: enabled
Port 0: 1000FD enabled stp: none vlan: 2 jumbo: off mac: ::::::
Port 1:   DOWN enabled stp: none vlan: 1 jumbo: off mac: 00:00:00:00:00:00
Port 2: 1000FD enabled stp: none vlan: 1 jumbo: off mac: ::::::
Port 3: 1000FD enabled stp: none vlan: 1 jumbo: off mac: ::::::
Port 4:   DOWN enabled stp: none vlan: 1 jumbo: off mac: 00:00:00:00:00:00
Port 5: 1000FD enabled stp: none vlan: 1 jumbo: off mac: ::::::
Port 7: 1000FD enabled stp: none vlan: 1 jumbo: off mac: 9c:::::
Port 8: 1000FD enabled stp: none vlan: 1 jumbo: off mac: 9c:::::
VLANs: BCM5301x enabled mac_check mac_hash
   1: vlan1: 1 2 3 5 8t
   2: vlan2: 0 8t
 100: vlan100: 1t 2t 3t 8t
1045: vlan1045: 7 8u
1046: vlan1046: 0 1t 2t 4 7t 8t
1047: vlan1047: 0 2t 4t 5t
1099: vlan1099: 1 2t 3t 5t 7
1100: vlan1100: 1 3t 4t 5 7t
1101: vlan1101: 1 3 4 7 8u
1102: vlan1102: 1t 2t 5t
1103: vlan1103: 0 1t 4t 5 7t 8u
4000: vlan4000: 5t 7t
me@87u:/tmp/home/root# brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.9c:::::            no             vlan1
                                                        vlan4000
                                                        eth1
                                                        wl0.1
me@87u:/tmp/home/root#

For reference here's the 87u's switch port to interface layout

Code:
port0 wan
port1 lan4
port2 lan3
port3 lan2
port5 lan1 (quantenna chipset)
 
Last edited:
Does your 5ghz guest wifi actually broadcast? Mine doesn't and that's having done a factory reset.

Edit : never mind i see you're on 380.70, mine stopped working after the jump to 384.x
 
Does your 5ghz guest wifi actually broadcast? Mine doesn't and that's having done a factory reset.

Edit : never mind i see you're on 380.70, mine stopped working after the jump to 384.x

Indeed and that's one of the reasons I'm holding on to the 380 code.
 

Similar threads

Latest 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