MacOS – Cannot Resolve Host

dnsmacosNetwork

For some reason my system will not resolve hosts added to /etc/hosts. If I add an entry:

127.0.0.1 somename.dev

It won't resolve. If I add this, however:

127.0.0.1 somename.dev
::1 somename.dev

…it will resolve. Any idea why this is the case? It never was before, but I just reinstalled by system and now its doing this.

Note: I'm using Lion (10.7.5).

Best Answer

You've answered your question by showing that whatever unknown dns resolving you are doing needs both IPv6 and IPv4 entries.

Since OS X has API and a bit more directory services layered on top of the normal DNS system (i.e. it doesn't simply use /etc/hosts like many unix systems), even calls you think might simply check the hosts file for an IPv4 address can and will fail if they don't specify IPv4 only or are using Bonjour/ZeroConf to do address resolution.