Finding the IP address of a Mac on a LAN with ping. D’oh!

Bonjour logo
Bonjour logo
I somewhat regularly have to log in to a WiFi connected machine (they vary, so DHCP assigned addresses would be a PITA to juggle and remember). I have a static IP macOS box I can ssh or Screen Share into, and from there I’ve usually danced a jig of arp -a or last to try to find the IP address of that box, so I can connect to it directly. Apple’s Bonjour [née Rendezvous, an implementation of zeroconf] shows the machines, since they’re Macs, but the command line tools for that aren’t part of my muscle memory. dns-sd -Gv4v6 doesn’t really roll off the tongue...

I was today years old when I realized if I just append .local to the machine name, good ol’ ping will give me the address:

% ping -c1 BigMac.local     

PING BigMac.local (172.16.345.99): 56 data bytes

64 bytes from 172.16.345.99: icmp_seq=0 ttl=64 time=0.785 ms

I’m a maroon.

Comments