Q: How do I know the IP addresses of other computers in my network?
A lot of networks
Well, first of all your computer is probably on a lot of networks. You can see this with the
ifconfig command. There is a lot of info in there, but most of it is overwhelming, so I like to filter is like so:
$ ifconfig | grep -E '^[a-z0-9]|inet '
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
inet 127.0.0.1 netmask 0xff000000
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet 192.168.0.101 netmask 0xffffff00 broadcast 192.168.0.255
en1: flags=963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX> mtu 1500
en2: flags=963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX> mtu 1500
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
inet 220.127.116.11 --> 18.104.22.168 netmask 0xffffffff
en5: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
inet 169.254.146.193 netmask 0xffff0000 broadcast 169.254.255.255
bridge100: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
inet 192.168.3.1 netmask 0xffffff00 broadcast 192.168.3.255
The first field of the left aligned lines are network interface names. You wifi is probably
en0. My TunnelBlick VPN to AWS is
utun1. My System Preferences > Sharing > Internet Sharing created
bridge100 for the RaspberryPi I have getting internet from my MacBook Pro via my ethernet dongle.
Because you asked for IP addresses I assume IPv4 addresses are what you care about. I used "inet " (with a space) to block the "inet6" entries for IPv6. If you wanted IPv6 you probably know more about networking than I do and I should be asking you questions.
Find the hosts
Let's focus on that
bridge100 and bring you a little Google traffic. Lots of people run into this situation when they want to SSH or RDC into a headless computer (like a RaspberryPi) either on their network or tethered via Internet Sharing. It's especially difficult when you have no connection history (arp table) with the device. For this you can use
sudo nmap -sn 192.168.3.0/24, which is the value of bridge100 inet (192.168.3.1) with the last digit replaced with "0/24". However, nmap isn't standard on OSX so we can install it with homebrew.
$ brew install nmap
Warning: nmap-7.31 already installed
$ sudo nmap -sn 192.168.3.0/24
Starting Nmap 7.31 ( https://nmap.org ) at 2016-11-21 22:03 EST
Nmap scan report for 192.168.3.6
Host is up (0.00025s latency).
Nmap scan report for 192.168.3.1
Host is up.
Nmap done: 256 IP addresses (2 hosts up) scanned in 2.08 seconds
From that you can assume that my RaspberyPi got IP
192.168.3.6 for some reason. Last time I connected it I was on a different subnet and it got
192.168.2.3. That nmap trick is a lot better than typing
ping 192.168.3.2 ...
ping 192.168.3.6 until you find it.
I hope that helps.