2

Using Ubuntu as a Hotspot access point is a very seamless setup, though there are a number of steps. However I can't find any reference to how to view the connections... the number of connections, the IP and MAC addresses.

I'm also trying to identify a way to manage the connections. I would like to control who connects and check the bandwidth they are using, and other normal details that are available from wifi setups.

There might be an occasion to want to ban or limit connections to certain MAC addresses.

Does anyone have any information these details?

After creating the Hotspot, one of the computers connecting to it has this private IP: 10.42.0.18. Connecting to http://10.42.0.1 brings up the Ubuntu default Webpage... the same as http://localhost.

The command netstat -n | less doesn't show any references to a 10.42.0 network. It does show an entry (raw), which I haven't seen in normal netstat outputs.

netstat -n | less output

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

There's no change in the raw entry no matter how many connections are made to the Hotspot.

5

I found this script I have been using to monitor my hotspot connection, though it doesn't control them in any way atleast I know whose connected at any time. I use watch command to see changes that occurred in my hotspot.

# modified by romano@rgtti.com 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
  • In my case I used /var/lib/NetworkManager/dnsmasq-wlp8s0.leases for the leasefile path because I setup the Hotspot with netcli. – Markus Ressel Oct 15 '19 at 11:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.