Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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).

share|improve this question
    
I added a general answer since it's not clear what exactly the host resolution process you are testing - but perhaps you just needed a little background on why OS X is different than other Unix in this regard. –  bmike Feb 4 '13 at 18:44
1  
I'm using MAMP PRO which modifies the host file. It used to work great until I reinstall Lion. IDK why it suddenly stopped working. –  user1750 Feb 4 '13 at 21:15
    
OK - now that makes sense. I don't know what changed, but I do know, I've stopped messing with DNS and just use xip.io to resolve addresses. It's not perfect for your case, since localhost is a level deeper than picking on IP address on the subnet, but as testing progresses, having other devices get to my development server kills this problem by solving the "other devices" need to connect to my test web server. –  bmike Feb 4 '13 at 21:21
add comment

1 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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.