Sometimes, I need to see the actual IPv4 address of web sites I open in Safari.
Now, there are two terminal commands, host and dig, which I could use for that.
But these commands are not always telling my the actual IP address that the Mac apps, such as Safari, use. Examples for when they show a different IP address:
- I've added the address to the Mac's
/etc/hostsfile. - The IP address has recently changed and the Mac apps still use the previous one it has cached.
So, is there a tool that tells me the IP address that's currently known to OS X instead of the address the external name server reports?
host- The host command does not use the host name and address resolution or the DNS query routing mechanisms used by other processes running on Mac OS X. The results of name or address queries printed by host may differ from those found by other processes that use the Mac OS X native name and address resolution mechanisms. The results of DNS queries may also differ from queries that use the Mac OS X DNS routing library. – Allan Apr 05 '18 at 19:06/etc/hostsand then go to DNS, while utilities likedigandhostwill directly query a DNS server. – Allan Apr 05 '18 at 19:10gethostbyname()function. See also: https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/ResolvingDNSHostnames.html – Thomas Tempelmann Apr 07 '18 at 12:58