Domain Suffix Tier Completion on Mac
On Ubuntu I have this line in /etc/resolv.conf
:
search example.com uk.example.com se.example.com
Now when I type host svr1.uk
I get an entry for svr1.uk.example.com
If I do ping svr1.uk
, I see pings from svr1.uk.example.com.
However, if I try ping svr1.uk
on a mac with the same line search
present in /etc/resolv.conf, I get "ping: cannot resolve svr1.uk: Unknown host"
although I see an entry for srv1.uk.example.com from the command host
.
Does anyone have a way to make whichever search method ping
correctly use domain suffixes in the order listed in /etc/resolv.conf
?
source to share
OSX does not use /etc/resolv.conf for DNS configuration. Go to networksetup instead .
To set up search domains:
sudo networksetup -setsearchdomains <network-interface> example.com uk.example.com se.example.com
To list network interfaces / services:
networksetup -listallnetworkservices
source to share
On OS X 10.7-8
Look for these lines (around line 16; 10.8 starts around line 17) and add a third line to the end, then save the file
<string>/usr/sbin/mDNSResponder</string>
<string>-launchd</string>
<string>-AlwaysAppendSearchDomains</string>
On OS X 10.9
It's still around line 17 and will need to be edited after the OS update. The line "-launchd" doesn't exist, so just add the line alwaysappend
.
Restart the responder:
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
On OS X 10.10.1
Now the file is named com.apple.discoveryd.plist
and you need to add a very similar element below the tag ProgramArguments
. Add in <string>--AlwaysAppendSearchDomains</string>
(note there are two hyphens) for the elements in the tag. Run a similar load / unload command pair, but referring to this new plist
source to share