Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

my MBP's .local hostname is no longer resolvable

Hi, I am on Yosemite 10.10.1 and have recently run into an issue where my laptop's '.local' address isn't resolvable as follows:

---

MacBook-Pro:bin xxxx$ ping `hostname`

ping: cannot resolve MacBook-Pro.local: Unknown host

--

I've checked here and stack overflow and have not seen this specific issue. The only thing that was close was checking 'scutil --get HostName'. That was returning a blank result so I '--set' that value to 'MacBook-Pro.local' but I am still getting the same inability to resolve the host. It's my understanding that .local's get resolved via Bonjour, so perhaps it's not properly advertising the local machine (to itself). Has anyone encountered this?

MacBook Pro with Retina display, OS X Yosemite (10.10.1)

Posted on Dec 10, 2014 1:22 PM

Reply
8 replies

Dec 10, 2014 3:17 PM in response to erichfromwashington

If you visit System Preferences > Security & Privacy > Firewall — in Firewall Options is the Enable Stealth mode check box. If it is checked it will block all ICMP packets, including those you originate in the Terminal to localhost. If you temporarily uncheck Stealth Mode in the Security settings, your Terminal based ping syntax will work correctly with localhost.

Dec 10, 2014 3:56 PM in response to erichfromwashington

Hi guys, my problem isn't really with the ping (though I tried disabling the firewall entirely just to be sure). It's that the hostname doesn't seem to get resolved to an actual IP address. So aside from the ping problem say dig and nslookup fail as well.


----

> dig MacBook-Pro.local


; <<>> DiG 9.8.3-P1 <<>> MacBook-Pro.local

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 41157

;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0


;; QUESTION SECTION:

;MacBook-Pro.local. IN A


;; AUTHORITY SECTION:

. 10800 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2014121001 1800 900 604800 86400


;; Query time: 234 msec

;; SERVER: 75.75.75.75#53(75.75.75.75)

;; WHEN: Wed Dec 10 18:55:08 2014

;; MSG SIZE rcvd: 110

---

dig returns no "ANSWER" section

--

> nslookup MacBook-Pro.local

Server: 75.75.75.75

Address: 75.75.75.75#53


** server can't find MacBook-Pro.local: NXDOMAIN

---

Dec 10, 2014 4:35 PM in response to erichfromwashington

On my machine, with the computer name = localhost, I get:


dig localhost.local


; <<>> DiG 9.6-ESV-R4-P3 <<>> localhost.local

;; global options: +cmd

;; Got answer:

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 28607

;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0


;; QUESTION SECTION:

;localhost.local. IN A


;; ANSWER SECTION:

localhost.local. 10 IN A 198.105.244.228

localhost.local. 10 IN A 198.105.254.228


;; Query time: 16 msec

;; SERVER: 192.168.0.1#53(192.168.0.1)

;; WHEN: Wed Dec 10 16:31:02 2014

;; MSG SIZE rcvd: 65

Dec 10, 2014 4:51 PM in response to erichfromwashington

When I perform a ping `hostname` (with the Firewall stealth off), the ip address is shown in the ping output for me.


dig +short `hostname` returns blank for me.


python -c 'import socket; print socket.gethostbyname("myhost.local")' returns my machine's current ip address.


So does the following syntax:


ping -q -c 1 -t 1 your_host_here | grep PING | sed -e "s/).*//" | sed -e "s/.*(//"



I wonder if the /etc/hosts file has been edited. Placing the machine name, and localhost on the same line has been known to cause issues in past OS X releases.

Dec 10, 2014 5:14 PM in response to erichfromwashington

I've updates in my hosts file, but never for my machine name 'MacBook-Pro.local' specifically to avoid collisions like these. As I mentioned I think there's something hinky with Bonjour announcing/resolving the address for the local address. I can perhaps 'force' it to the loopback address in the hosts but that's really not fixing the problem

Dec 11, 2014 3:08 PM in response to erichfromwashington

Stop me if I am missing something, but are you certain that mdns entries will be resolved by these tools?


I also get no answer section for 'dig myhostname.local' (on 10.9).

I think this depends on your local network setup (e.g. a router that manages mDNS, like Apples Airport etc).


Isn't dns-sd is the tool for troubleshooting bonjour?

dns-sd -q Myhostname.local

12:05:58.236 Add 2 4 Myhostname.local. Addr IN 192.168.12.35


Also have you tested on other networks? I think it's possible for admins to block bonjour, it's unclear (at least to me) if services are resolvable locally with these tools…

See the Mac OS X NOTICE section in the nslookup manual, it doesn't use the same resolution methods as other parts of the OS for DNS, mDNS is not mentioned, I'm not certain you are testing correctly.


Bonjour bowser will show advertised services, it's a bit easier than dns-sd.

http://tildesoft.com - don't let the minimalist site scare you, it is a handy app.

my MBP's .local hostname is no longer resolvable

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.