- A+
所属分类:Linux
IP类:
查看连接上openwrt的设备IP信息,mac地址,端口状态信息。
方式1:通过arp查看ip、mac地址、端口。
cat /proc/net/arp

Flags标志可以表示是否在线状态,标志0x0表示不在线,离线,标志0X2表示在线。
方式2:使用DHCP客户端查看mac地址、ip信息。此命令无法查看端口状态。
cat /tmp/dhcp.leases

无线类:
1、查看连接Openwrt路由连接的无线客户端:
iwinfo wlan0 assoclist

2、查看所连接的客户端的个数和详细信息
iw dev wlan0 station dump

3、查看Openwrt路由无线信息:
iwinfo wlan0 info

重启无线:
wifi down wifi up
4、使用bash脚本查看无线客户端IP/MAC/名称/速率:

脚本内容如下:
#!/bin/bash echo -e "# IP addresstnametMAC addressttx bittrx 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 "$ipt$hostt$mact$txt$rx"|awk '{printf "%-15s %-25s %-15s %-10s %-10sn",$1,$2,$3,$4,$5}' done done
5、用命令行扫描路由器周围WIFI,wlan0为使用当前路由器哪张网卡进行信号扫描。
iwinfo wlan0 scan
设备封禁
1、iwinfo wlan0 assoclist 查看当前wifi所连设备的mac地址。

2、使用arp查看需要封禁设备mac地址对应的IP。

3.通过iftop -i br-lan -n抓取大流量占用所对应IP。i表示接口,n表示不显示域名显示成ip。

4.通过如下图所示封禁特定mac地址的设备,引号中填写需要封禁mac地址,保存退出。使其无法连接wifi。最后重启路由器即可生效。

- 微信公众号
- 扫一扫关注微信公众号
-
- 运维交流群
- 扫一扫二维码加入群聊
-