MacOS – Loopback in Yosemite not working

dnsmacos

I'm on Yosemite (10.10.2). Since upgrading I got some DNS issues, it seems my loopback isn't working any more. When I'm talking to my app locally via http://localhost:port, localhost in some cases (sorry for being vague here) gets resolved to my current local IP. (observed with rails and openstack)

some analysis:

mac:~ me$ scutil -r localhost
Reachable,Local Address,Directly Reachable Address
mac:~ me$ scutil -r loopback
Not Reachable

etc/hosts:

127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0     localhost

etc/networks:

loopback        127             loopback-net

And a maybe related issue: DNS sometimes stops working completely. The only thing that helps, is a force quit of the discoveryd process.

I appreciate any help guiding me in the right direction to solve this issue.
Thanks in advance.

Best Answer

This might possibly be not the best long-term solution - I can't fully test as I don't actually have active IPv6 from my ISP yet, only on my local network.

I simply set my hosts file to

127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             127.0.0.1 
fe80::1%lo0     127.0.0.1

which has so far given no noticeable issues.