您的位置:首页 > 运维架构

Openwrt无线管理工具/命令

2016-03-26 22:37 411 查看
/article/8436462.html

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

[cpp] view
plain copy







iwinfo wlan0 assoclist

iw dev wlan0 station dump

查看分配的DHCP客户端IP:

[cpp] view
plain copy







cat /tmp/dhcp.leases

扫描无线路由器/AP:

[cpp] view
plain copy







iwinfo wlan0 scan

查看Openwrt路由无线信息:

[cpp] view
plain copy







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

重启无线:

[cpp] view
plain copy







wifi down && sleep 5 && wifi

一个bash脚本,输出当前无线客户端IP/MAC/名称/速率:

[cpp] view
plain copy







#!/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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: