如何查看 Ubuntu 热点接入点上的连接?

如何查看 Ubuntu 热点接入点上的连接?

使用 Ubuntu 作为热点接入点是一种非常无缝设置,虽然有很多步骤。但是我找不到任何关于如何查看连接的参考资料...连接数、IP 和 MAC 地址。

我也在尝试找到一种管理连接的方法。我想控制谁连接并检查他们使用的带宽,以及 wifi 设置中可用的其他常规详细信息。

有时候可能会想要禁止或限制与某些 MAC 地址的连接。

有人知道这些详细信息吗?

创建热点后,连接到该热点的其中一台计算机具有此私有 IP:。10.42.0.18连接到http://10.42.0.1会显示 Ubuntu 默认网页...与相同http://localhost

该命令netstat -n | less未显示任何对10.42.0网络的引用。它确实显示了一个条目 ( ),这是我在正常输出raw中没有看到的。netstat

netstat -n | less输出

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0     36 192.168.16.24:22        192.168.16.26:41458     ESTABLISHED
tcp        0      0 192.168.15.136:55190    72.43.238.234:1723      ESTABLISHED
raw        0      0 192.168.15.136:47       72.43.238.234:*         1          
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node   Path
unix  2      [ ]         DGRAM                    32734    /run/user/1001/systemd/notify
unix  2      [ ]         DGRAM                    10603    /run/systemd/journal/syslog
unix  7      [ ]         DGRAM                    10605    /run/systemd/journal/socket

raw无论与热点建立多少个连接,条目都不会发生变化。

答案1

我发现这个脚本我一直在用它监控我的hotspot连接,尽管它不能以任何方式控制它们,但至少我可以随时知道谁在连接。我使用watch命令来查看我的 中发生的更改hotspot

# modified by [email protected] from http://wiki.openwrt.org/doc/faq/faq.wireless#how.to.get.a.list.of.connected.clients

echo    "# All connected wifi devices, with IP address,"
echo    "# hostname (if available), and MAC address."
printf  "# %-20s %-30s %-20s\n" "IP address" "lease name" "MAC address"
leasefile=/var/lib/misc/dnsmasq.leases
# list all wireless network interfaces 
# (for MAC80211 driver; see wiki article for alternative commands)
for interface in `iw dev | grep Interface | cut -f 2 -s -d" "`
do
  # for each interface, get mac addresses of connected stations/clients
  maclist=`iw dev $interface station dump | grep Station | cut -f 2 -s -d" "`
  # for each mac address in that list...
  for mac in $maclist
  do
  # If a DHCP lease has been given out by dnsmasq,
  # save it.
     ip="UNKN"
     host=""
     ip=`cat $leasefile | cut -f 2,3,4 -s -d" " | grep $mac | cut -f 2 -s -d" "`
     host=`cat $leasefile | cut -f 2,3,4 -s -d" " | grep $mac | cut -f 3 -s -d" "`
     # ... show the mac address:
     printf "  %-20s %-30s %-20s\n" $ip $host $mac
   done
done

相关内容