Use "options ndots:2" in global DNS resolver

Until yesterday, I regularly ssh'd into my servers that have names like "server.prod.example.com" as "server.prod" and it worked fine. (Actually, this required getting mDNSResponder to start with the "-AlwaysAppendSearchDomains" option, but that's a different story. I think.)

Very recently, the ".prod" TLD was made active. Now when I try to log into "server.prod", it resolves to 127.0.53.53. This is a universal DNS problem and is solvable on other BIND-based DNS resolvers by adding "options ndots:2" to the resolver configuration (normally "/etc/resolv.conf").

Is it possible to set this option with MacOS's scutil/configd-based resolver?

I'll point out that the resolver seems to recognize the option when put in a resolver config file in "/etc/resolver": when placed there, "scutil --dns" shows the option. Of course, it does no good there.

I'm on Mavericks, if that makes any difference.


Solution 1:

I have this same issue. I was able to easily fix this on my linux desktop by adding the line to /etc/resolvconf/resolv.conf.d/head

OSX is a different beast though, hoping someone smarter than I am can find a way. I miss being able to "ssh server1.prod" :(

The alternative is to set up "ssh" as an alias to a script, and the servername is your $1. The script can see if the last 5 chars of $1 are ".prod" and if so ssh to the fqdn.