查看连接Openwrt路由的无线客户端:
iwinfo wlan0 assoclist iw dev wlan0 station dump
查看分配的DHCP客户端IP:
cat /tmp/dhcp.leases
扫描无线路由器/AP:
iwinfo wlan0 scan
查看Openwrt路由无线信息:
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
重启无线:
wifi down && sleep 5 && wifi
一个bash脚本,输出当前无线客户端IP/MAC/名称/速率:
#!/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
本站的文章和资源来自互联网或者站长的原创,按照 CC BY -NC -SA 3.0 CN协议发布和共享,转载或引用本站文章应遵循相同协议。如果有侵犯版权的资 源请尽快联系站长,我们会在24h内删除有争议的资源。欢迎大家多多交流,期待共同学习进步。