4

Yesterday I was able to ssh into my development box by using the machine name. Today, I can't. I can nslookup and use chrome to navigate to my box using just the machine name. ping and ssh do not resolve with just the machine name. Everything resolves if I use the fully qualified domain name. It all also resolves if I use the ip address. I am on an internal network (10.0.0.x).

$ dscacheutil -flushcache; sudo killall -HUP mDNSResponder
$ nslookup my-dev-box
Server:     10.0.0.113
Address:    10.0.0.113#53

Name:   my-dev-box.thedomain.internal
Address: 10.0.0.106

$ ssh my-dev-box
ssh: Could not resolve hostname my-dev-box: nodename nor servname provided, or not known

$ ssh my-dev-box.thedomain.internal
password: xxx
Have a lot of fun... (it worked)

When I have ssh'd into my development box, I use the hostname command and it returns my-dev-box.

When I type my-dev-box into chrome, it takes me to my development site just fine.

In system preferences, on my wireless network (I'm on wireless for all this) in the DNS settings I have thedomain.internal listed under search domains.

What setting am I missing or how would I troubleshoot / restore ssh using a less fully qualified host name?

EDIT

So far the solution was to restart my macbook after all the steps above. SSH is working like it did before (connecting with just machine name on internal network.) Still don't know the cause of the error.

  • Guess this is not exactly an answer to your question so I'll put it as a comment: you could also either put aliases in your .bash_profile like alias my-dev-box='ssh my-dev-box.thedomain.internal' or fill your ~/.ssh/config and put this in the ~/.bash_profile: [ -e "$HOME/.ssh/config" ] && complete -o "default" -o "nospace" -W "$(grep "^Host" ~/.ssh/config | grep -v "[?*]" | cut -d " " -f2)" scp sftp ssh to have an autocomplete feature for ssh connections – Asmus Nov 13 '13 at 17:02
  • 1
    @Asmus These might work; I could also edit my hosts file. But right now I'm trying to figure out what caused the problem in the first place. As it stands, I have to type two extra words every once in a while, so it isn't that big of a problem. But I want to make sure this isn't a symptom of some larger, pending headache. – smilebomb Nov 13 '13 at 17:13
  • AH! Wait a minute! Why did you kill the mDNSResponder in the first line? That might kill dns lookups: support.apple.com/kb/HT3789?viewlocale=en_US&locale=en_US – Asmus Nov 13 '13 at 17:16
  • 1
    @Asmus I was following the instructions of this article to flush my DNS osxdaily.com/2008/03/21/how-to-flush-your-dns-cache-in-mac-os-x – smilebomb Nov 13 '13 at 18:21
  • Do you have a dot in the hostname of your machine (configured a local subdomain) like mac.development.internal as opposed to mac.internal? I've just found this blog post where they post a similar scenario. Also: do host my-dev-box, ping my-dev-box and dig my-dev-box all produce the same error? Since they all use different methods this might help find the cause. – Asmus Nov 13 '13 at 18:45

You must log in to answer this question.

Browse other questions tagged .