While helping a co-worker I found what appeared to be the most bizarre behavior on their mac. They had set an entry in their hosts file which pointed a domain at a VPN’d internal network address. Normally this would allow the user to bypass the normal DNS lookups and just allow them to work locally. But in this case their computer continued to try to access the internet facing connection. It appeared that MacOS was ignoring the hosts file entries. The hosts entry was something like this:
192.168.1.71 dev.example.com
Hosts file entries are quite useful, and I use them frequently, so I knew it was formatted correctly. But this one wasn’t working, so we started digging. Their local network was on a similar subnet as the VPN (both 192.168.*.* subnets) so we first switched them to a 10.*.*.* network locally. But the change in IP address didn’t seem to address the issue. We changed DNS server settings, and every other tweak I could think of. But then we stumbled on the answer.
Why MacOS was Ignoring the Hosts File Entries
This was a very bizarre behavior, and took a bit of sleuthing to discover what was at the root of the issue. But in the end we got to the bottom of why MacOS was ignoring hosts file entries.
If you want to learn how to edit your hosts file try this page for a tutorial.