Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > checking to see how many people are on a network

checking to see how many people are on a network
Thread Tools
barbarian
Senior User
Join Date: Apr 2001
Location: Palo Alto, CA
Status: Offline
Reply With Quote
Sep 1, 2004, 12:35 AM
 
Is there a simple way to check and see how many people are logged onto a particular airport or ethernet network?
     
Mithras
Professional Poster
Join Date: Oct 1999
Location: :ИOITAↃO⅃
Status: Offline
Reply With Quote
Sep 1, 2004, 09:13 AM
 
Not exactly. Some machines will let themselves be seen, and others may not.

But here's what you can do as a first effort:
1. Open Terminal
2. Type ifconfig en0 (for Ethernet) or ifconfig en1 (for Airport)

The third line of the output reads
inet 192.168.x.x netmask 0xffffff00 broadcast 192.168.1.255

or something similar. The part in bold (broadcast 192.168.1.255) is called the broadcast address. That's the address to send things to if you want everyone on the network to receive the packet.

3. Ping the broadcast address.
Pinging sends a packet that requests, "please reply to let me know if you're there." Machines don't have to reply if they don't want to.

Type ping 192.168.1.255 (or whatever your broadcast address is)
Press control-C to stop the pinging after a bit.

You'll get something like the following:
Code:
64 bytes from xxx.xxx.245.95: icmp_seq=0 ttl=64 time=0.376 ms 64 bytes from xxx.xxx.245.1: icmp_seq=0 ttl=255 time=51.563 ms (DUP!) 64 bytes from xxx.xxx.245.95: icmp_seq=1 ttl=64 time=0.36 ms 64 bytes from xxx.xxx.245.70: icmp_seq=1 ttl=64 time=1.969 ms (DUP!) 64 bytes from xxx.xxx.245.112: icmp_seq=1 ttl=64 time=6.158 ms (DUP!) 64 bytes from xxx.xxx.245.95: icmp_seq=2 ttl=64 time=0.365 ms 64 bytes from xxx.xxx.245.70: icmp_seq=2 ttl=64 time=1.974 ms (DUP!) 64 bytes from xxx.xxx.245.112: icmp_seq=2 ttl=64 time=6.164 ms (DUP!)
Looking at the replies, you can get a sense of how many unique machines are out there. But remember this only finds machines that are willing to be found.


Here's a command that will do the whole thing at once:
ping -c 10 $(ifconfig en0 | awk '/broadcast/ {print $6}') | awk '/bytes from/ {print $4}' | sed -e 's/://' | sort -u -n -t. +3 +2 +1 +0

Or, if you just want the count:
ping -c 10 $(ifconfig en0 | awk '/broadcast/ {print $6}') | awk '/bytes from/ {print $4}' | sed -e 's/://' | sort -u -n -t. +3 +2 +1 +0 | wc -l


One other thing you can do is, after you've pinged the broadcast address and asked machines to tell you that they're there, consult your ARP table, which is the table your machine uses to keep track of how to reach machines on the network.
Type arp -a to see the list of machines your Mac presently knows about on the network.
( Last edited by Mithras; Sep 1, 2004 at 09:20 AM. )
     
barbarian  (op)
Senior User
Join Date: Apr 2001
Location: Palo Alto, CA
Status: Offline
Reply With Quote
Sep 1, 2004, 12:31 PM
 
The reason I ask is that I have a home in NY with a very fast connection. I'm not there very often (live in CA), and while I'm not there I leave an airport network open to whoever finds it. When I returned recently I noticed several users itunes libraries showing up via rendezvous and started wondering just how many people were logging on. It would be cool to have a little app that tracked users as the came on and off and gave you a summary at the end of the day via email...

Many thanks for the terminal goodness.
     
bborofka
Forum Regular
Join Date: Sep 2000
Location: Chico, California
Status: Offline
Reply With Quote
Sep 1, 2004, 06:37 PM
 
Are you using an Airport router? If so, you can probably just look at the DHCP client list. I've never seen the Airport config tool so I don't know where to look for it. That should tell you all the names of the computers, their LAN ips, and MAC addresses too.
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 05:09 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,