from yesterday I have noticed that I can't connect via SSH to my OS X's SSH server anymore using the following command:
User-MBP:~ user$ ssh user@user-mbp
user is the user on the server, user-mbp is the name of my machine, as specified here in
System Preferences > Sharing:
I have the following written under
Remote Login: On:
To log in to this computer remotely, type "user@user-mbp".
user-mbp seems to be unreachable, even ping doens't respond:
User-MBP:~ user$ ping user-mbp ping: cannot resolve user-mbp: Unknown host
It is strange because I was able to connect typing
user-mbp before, I remember. Also OS X is telling me to use that hostname for the SSH connection in
System Preferences > Sharing, as I told.
I thought maybe something messed up the DNSResolver, even if I didn't touch anything, so I tried the following commands taken from the post DNS not resolving on Mac OS X:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
But they didn't help, so I am writing this post. I have Yosemite 10.10.4 installed. Also, recently I have installed Little Snitch, now I have uninstalled it, maybe it's because of it?
What can I do to re-enable my hostname and make it reachable again? (I know I can connect to the machine using the local address of the server instead, but I do want to use
user-mbp cause the LAN IP is assigned dinamically).
Thanks for the attention!
Still didn't resolve. I have also tried to restore my system to a previous state when everything worked (I booted the system in recovery mode (Cmd+R) and restored from a Time Machine backup (the SSH server which is supposed to be user-mbp runs on a MacBook Pro)), but it doesn't work anymore too! Now I start thinking that maybe it is a problem of the router I am using? Could it be possible?
Here is the output of
dig user-mbp.local issued on the client side:
; <<>> DiG 9.8.3-P1 <<>> user-mbp.local ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 21043 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0 ;; QUESTION SECTION: ;user-mbp.local. IN A ;; AUTHORITY SECTION: . 10800 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2015072802 1800 900 604800 86400 ;; Query time: 169 msec ;; SERVER: 192.168.1.1#53(192.168.1.1) ;; WHEN: Tue Jul 28 23:53:27 2015 ;; MSG SIZE rcvd: 109
There's a NXDOMAIN, so the hostname seems to not exist...
Here is the content of resolve.conf:
# # Mac OS X Notice # # This file is not used by the host name and address resolution # or the DNS query routing mechanisms used by most processes on # this Mac OS X system. # # This file is automatically generated. # domain Home nameserver 192.168.1.1
daniel Azuelos advised me to remove the line "domain Home" when we were chatting but it seems that whenever you remove that line, it reappears automatically...
Here are the commands klanomath wrote about:
user-mbp:~ user$ dig _services._dns-sd._udp.local ptr @192.168.1.2 -p 5353 ; <<>> DiG 9.8.3-P1 <<>> _services._dns-sd._udp.local ptr @192.168.1.2 -p 5353 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48322 ;; flags: qr aa; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;_services._dns-sd._udp.local. IN PTR ;; ANSWER SECTION: _services._dns-sd._udp.local. 10 IN PTR _ssh._tcp.local. _services._dns-sd._udp.local. 10 IN PTR _sftp-ssh._tcp.local. ;; Query time: 1 msec ;; SERVER: 192.168.1.2#5353(192.168.1.2) ;; WHEN: Wed Jul 29 21:44:37 2015 ;; MSG SIZE rcvd: 94
192.168.1.2 is the IP of the SSH server.
user-mbp:~ user$ dns-sd -B _ssh._tcp local Browsing for _ssh._tcp.local DATE: ---Wed 29 Jul 2015--- 21:46:39.034 ...STARTING... Timestamp A/R Flags if Domain Service Type Instance Name 21:46:39.035 Add 2 6 local. _ssh._tcp. User’s MacBook Pro
I guess Bonjour is set up properly, isn't it?
However, the temporarily fix
dns-sd -R user-mbp _ssh._tcp. local 22 seems to not working:
user-mbp:~ user$ dns-sd -R user-mbp _ssh._tcp. local 22 Registering Service user-mbp._ssh._tcp..local port 22 DATE: ---Wed 29 Jul 2015--- 21:51:47.238 ...STARTING... 21:51:48.048 Got a reply for service user-mbp._ssh._tcp.local.: Name now registered and active ^C user-mbp:~ user$ ssh user@user-mbp ssh: Could not resolve hostname user-mbp: nodename nor servname provided, or not known
user-mbp, what I mean with
when everything worksis that I was able to run
ssh user@user-mbpand it worked. That was just before I installed Little Snitch. Even here a funny thing, I have restored the system to that state (when everything worked) but it resulted to be a state when "everything was supposing to work", cause still doesn't. I hope I was clear. What could it be?
user-mbpruns on a MacBook Pro)