13

This is a direct follow-on to this question. Before Yosemite, I'd add the "-AlwaysAppendSearchDomains" argument to the mDNSResponder plist file so that all local resolver lookups added the search domains, regardless of whether there was a period in the label to be looked up. For example, whether I try to ssh to hostname foo.bar or foo, the search domain of baz.com should be tried, not only for the latter case, as was (and is) the default behavior.

Now, it looks like the mDNSResponder is gone, replaced with discoveryd. I cannot find a similar option to get it to always appending the search domain. Suggestions? I'd rather not go the route of using a non-default local resolver, but I'd consider it as an option. For now, I'll just type in the long FQDNs, but I'd really rather not.

Thanks, Pete

4
  • I previously had tried to enable the disabled mDNSResponder but since DP8, that seems absent altogether :( I've got a support ticket escalated to the Yosemite engineers now about the -AlwaysAppendSearchDomains option and how to handle this with discoveryd so I will post any further findings here when they contact me in a few days.
    – djh
    Commented Oct 20, 2014 at 15:48
  • @djh, any luck with the Apple engineers?
    – Sigsegv
    Commented Nov 5, 2014 at 20:49
  • This is fixed as part of the 10.10.1 update: Allows you to append search domains for partially qualified domain names when performing DNS lookups (consult the discoveryd man page for more information). See @Teknisten's answer below.
    – cOle2
    Commented Nov 19, 2014 at 21:32
  • This appears to be less relevant on newer versions of macOS since they have removed discoveryd in 10.10.4 macrumors.com/2015/06/30/apple-releases-os-x-10-10-4 Commented Jun 2, 2019 at 18:28

4 Answers 4

18

Since 10.10.1, the simplest way to fix this is to add --AlwaysAppendSearchDomains to ProgramArguments in plist file /System/Library/LaunchDaemons/com.apple.discoveryd.plist

Then restart com.apple.discoveryd.plist with:

sudo launchctl unload /System/Library/LaunchDaemons/com.apple.discoveryd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.discoveryd.plist

All this according to the help printed by:

/usr/libexec/discoveryd --help

That will do the same as it did for mDNSResponder as far as I can tell.

1
  • Not working in El Capitan unfortunately. Commented Nov 12, 2015 at 15:05
4

Run sudo discoveryutil mdnsactivedirectory yes in Terminal. According to https://discussions.apple.com/message/26927843#26927843 it is the solution.

This can be made to run automatically whenever launching a terminal without a password:

  • sudo visudo
    • add a line to the bottom %admin ALL=NOPASSWD: /usr/sbin/discoveryutil
    • If admin group doesn't work, run groups at the terminal and use an appropriate group - perhaps 'staff' or 'everyone'. Or just use an individual username without the leading %
  • To test visudo change
    • sudo -k
    • sudo su and verify that you are asked for password. Then control-c without entering your password
    • sudo discoveryutil mdnsactivedirectory and verify that you aren't asked for password
  • Add a line to ~/.bash_profile sudo discoveryutil mdnsactivedirectory yes
  • Add Terminal to your user's Login Items
    • on 10.10: System Preferences->Users & Groups, Select User
    • Goto "Login Items" tab, and add /Applications/Utilities/Terminal
3
  • How do you make this permanent? After a reboot you will need to execute this command again.
    – JoeriBe
    Commented Oct 25, 2014 at 18:04
  • This doesn't seem to work for me, at least wrt non-.local hostnames. I still need to type "ssh foo.bar.baz.com" instead of "ssh foo.bar", even though ".baz.com" is in my search path.
    – Sigsegv
    Commented Oct 29, 2014 at 12:43
  • You shouldn't add in a user ~/.bash_profile a configuration modification which has to be made at the level of the system daemon, here discoveryd.
    – dan
    Commented Jun 29, 2015 at 14:03
1

No solution unfortunately, but I've found out you can at least check the resolver config using 'discoveryutil', like so:

mdbraber-mba:~ mdbraber$ sudo discoveryutil configresolver
Configuration Resolvers: Resolver domain [default], type Unicast, ifIndex 4, port 0, timeout 30, A yes, AAAA no, serviceID 0, scope None, order 0
    server 192.168.143.1
    search domain ourhouse
Configuration Resolvers: Resolver domain [default], type Unicast, ifIndex 4, port 0, timeout 30, A yes, AAAA no, serviceID 0, scope InterfaceID, order 0
    server 192.168.143.1

Apparently the first resolver lists a searchdomain, although it doesn't seem to work as under OS X < 10.10 versions. No idea why there is a second resolver without a search domain listed.

1

Here is a hacked up solution using a local nameserver - works for me:

https://github.com/joedj/yosemite_dnsfix

1
  • 1
    It would be better to add the solution as part of the answer, otherwise if the link ever disappears, the answer becomes useless. You can edit your own post to add it.
    – Tetsujin
    Commented Nov 5, 2014 at 9:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .