Openwrt无线管理工具/命令


http://blog.csdn.net/cupidove/article/details/45599985

查看连接Openwrt路由的无线客户端:

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. iwinfo wlan0 assoclist  
  2. iw dev wlan0 station dump  

查看分配的DHCP客户端IP:

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. cat /tmp/dhcp.leases   

扫描无线路由器/AP:

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. iwinfo wlan0 scan  

查看Openwrt路由无线信息:

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. iwinfo wlan0 info  
  2. wlan0     ESSID: "OpenWrt"  
  3.           Access Point: 00:1F:A3:65:55:8E  
  4.           Mode: Master  Channel: 5 (2.432 GHz)  
  5.           Tx-Power: 20 dBm  Link Quality: 30/70  
  6.           Signal: -80 dBm  Noise: unknown  
  7.           Bit Rate: 32.5 MBit/s  
  8.           Encryption: WPA2 PSK (CCMP)  
  9.           Type: nl80211  HW Mode(s): 802.11bg  
  10.           Hardware: unknown [Generic MAC80211]  
  11.           TX power offset: unknown  
  12.           Frequency offset: unknown  
  13.           Supports VAPs: no  PHY name: phy0  
重启无线:

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. wifi down && sleep 5 && wifi  
一个bash脚本,输出当前无线客户端IP/MAC/名称/速率:

[cpp]  view plain  copy
  在CODE上查看代码片 派生到我的代码片
  1. #!/bin/bash  
  2. echo -e "# IP address\tname\tMAC address\ttx bit\trx bit"  
  3. for interface in `iw dev | grep Interface | cut -f 2 -s -d" "`  
  4. do  
  5.   maclist=(`iw dev $interface station dump | grep Station | cut -f 2 -s -d" "`)  
  6.   txlist=(`iw dev wlan0 station dump|grep 'tx bitrate'|awk '{print $3$4}'`)  
  7.   rxlist=(`iw dev wlan0 station dump|grep 'rx bitrate'|awk '{print $3$4}'`)  
  8.   len=${#maclist[@]}  
  9.   for ((i=0;i<$len;i++))  
  10.   do  
  11.     mac=${maclist[$i]}  
  12.     tx=${txlist[$i]}  
  13.     rx=${rxlist[$i]}  
  14.     ip="UNKN"  
  15.     host=""  
  16.     ip=`cat /tmp/dhcp.leases | cut -f 2,3,4 -s -d" " | grep $mac | cut -f 2 -s -d" "`  
  17.     host=`cat /tmp/dhcp.leases | cut -f 2,3,4 -s -d" " | grep $mac | cut -f 3 -s -d" "`  
  18.     echo -e "$ip\t$host\t$mac\t$tx\t$rx"|awk '{printf "%-15s %-25s %-15s %-10s %-10s\n",$1,$2,$3,$4,$5}'  
  19.   done  
  20. done  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值