Apple - How do I know the IP addresses of other computers in my network?

Method #1

The easiest way would be to access your network router's administration page. It will have information about any other devices on the network, including IP address.

Method #2

If you know the computer's network name you can ping it in the Terminal. It will return the computer's IP address.

Method #3

If you don't know the computer's network name, there's another trick you can do using ping. Find your IP address and your subnet mask. Both should be visible in the Network preference pane of System Preferences. Line up your IP address and your subnet mask, and replace any 0 values in the subnet mask with 255 in the same relative position of the IP address. For example, if you have the following IP address and subnet mask, respectively:

192.168.1.151

255.255.255.0

The 0 is in the last field of the subnet mask, so you replace the last field of the IP address with 255 and ping it: ping 192.168.1.255

You should get a response with the IP address of any device on the network capable of responding to pings.

Method #4

Last trick is to use the terminal command arp -a. This will show the IP and MAC address of all devices on the network that it knows about.

Last two tricks courtesy of this Macworld article.


Type the command

  arp -a

This will show you all connections one by one.


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 172.141.0.10 --> 172.141.0.9 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.

Assume IPv4

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
Password:

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 typingping 192.168.3.2 ... ping 192.168.3.6 until you find it.

I hope that helps.

Tags:

Network