View connected wireless clients to the OpenWrt router:
12 |
iwinfo wlan0 assoclist iw dev wlan0 station dump
|
View allocated DHCP client IPs:
Scan wireless routers/APs:
View wireless information of the OpenWrt router:
12345678910111213 |
iwinfo wlan0 info wlan0 ESSID: "OpenWrt" Access Point: 00:1F:A3:65:55:8E Mode: Master Channel: 5 (2.432 GHz) Tx-Power: 20 dBm Link Quality: 30/70 Signal: -80 dBm Noise: unknown Bit Rate: 32.5 MBit/s Encryption: WPA2 PSK (CCMP) Type: nl80211 HW Mode(s): 802.11bg Hardware: unknown [Generic MAC80211] TX power offset: unknown Frequency offset: unknown Supports VAPs: no PHY name: phy0
|
Restart wireless:
1 |
wifi down && sleep 5 && wifi
|
A bash script that outputs the current wireless client IP/MAC/name/rate:
1234567891011121314151617181920 |
#!/bin/bash echo -e "# IP address\tname\tMAC address\ttx bit\trx bit" for interface in `iw dev | grep Interface | cut -f 2 -s -d " "` do maclist=(`iw dev $interface station dump | grep Station | cut -f 2 -s -d " "`) txlist=(`iw dev wlan0 station dump|grep 'tx bitrate'|awk '{print $3$4}'`) rxlist=(`iw dev wlan0 station dump|grep 'rx bitrate'|awk '{print $3$4}'`) len=${#maclist[@]} for ((i=0;i<$len;i++)) do mac=${maclist[$i]} tx=${txlist[$i]} rx=${rxlist[$i]} ip="UNKN" host="" ip=`cat /tmp/dhcp.leases | cut -f 2,3,4 -s -d " " | grep $mac | cut -f 2 -s -d " "` host=`cat /tmp/dhcp.leases | cut -f 2,3,4 -s -d " " | grep $mac | cut -f 3 -s -d " "` echo -e "$ip\t$host\t$mac\t$tx\t$rx"|awk '{printf "%-15s %-25s %-15s %-10s %-10s\n",$1,$2,$3,$4,$5}' done done
|