海运的博客

Openwrt无线管理工具/命令

发布时间:February 9, 2015 // 分类:OpenWrt // No Comments

查看连接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

http://wiki.openwrt.org/doc/faq/faq.wireless
http://wiki.openwrt.org/doc/howto/wireless.utilities

标签:openwrt, wifi, iw, iwinfo

评论已关闭

分类
最新文章
最近回复
  • 海运: 正常情况下编译整个内核执行make menuconfig后就不会出现此提示,当单独编译单个模块...
  • oijq: 就是用的armbian的配置文件哈,按你的教程做的,在执行make LOCALVERSION=...
  • 海运: 使用armbian的配置文件,其它添加或修改自己懂的部分,不懂的就不要碰了。
  • oijq: 编译时这些选项全部选Y吗?Actions Semi Platforms (ARCH_ACTIO...
  • 海运: n1编译bbr内核模块参考这个:https://www.haiyun.me/archives/...
  • jiqz: make M=net/ipv4/ CONFIG_TCP_CONG_BBR=m modules编...
  • ruralhunter: 哦,文档里应该是对的,是.config
  • ruralhunter: cp /mnt/boot/config-4.18.7-aml-s9xxx .config这里应...
  • 海运: 你是编译不成功呢?还是编译后不能运行呢?还是运行后不能访问web界面呢?
  • 白墨: 可能不清楚就是编译安装后启动后访问不了web界面