6

I use network setup to modify my search domains which works fine so far, but it only does it per device. Once I VPN somewhere, it no longer uses those changes. Is there a way to set the search domains globally (ie. for every device: Ethernet, Wi-Fi, and VPN) on Mac OS X Lion?

1
  • Can you add your resolv.conf into the question?
    – DogEatDog
    Oct 17 '12 at 4:26
4

enter image description hereThere was a similar issue in 2002 with OS X. I found a few articles about it and I've been able to address this issue by simply adding "local" to the Search Domains in the advanced network properties of my network interface. This has allowed those of connecting via VPN to resolve .local hosts.

1
1

If you want a strict command line solution, you can add the search domains manually to each adapter/service.

  1. List all networkservices to get the common names:

    $ networksetup -listallnetworkservices
    Wi-Fi
    FT232R USB UART
    Thunderbolt Bridge
    Thunderbolt Ethernet
    
  2. Check the current searchdomain setting on the device you want to update (You must fully quote devices with spaces in the names):

    $ networksetup -getsearchdomains "Thunderbolt Ethernet"
    yourdomain.com
    yourdomain.lan
    
  3. Then add the searchdomains you want where they are missing:

    $ networksetup -setsearchdomains "Wi-Fi" yourdomain.com yourdomain.lan
    
1

Why not just add it to the adapter in question? i.e. ethernet or Wi-Fi: http://support.apple.com/kb/PH14159 Per: https://web.archive.org/web/20150227052942/http://support.apple.com/kb/PH14159


For example, if you specify the search domain apple.com, typing “store” in your web browser takes you to store.apple.com. Or, if you use campus.university.edu as a search domain, you can type “server1” in the Connect To Server dialog in the Finder to connect to server1.campus.university.edu.

Choose Apple menu > System Preferences, then click Network.
Select the network connection service you want to use (such as Wi-Fi or Ethernet, unless you named it something else) in the list, then click Advanced.
Click DNS, then click Add (+) at the bottom of the DNS Servers list. Enter the IPv4 or IPv6 address for the DNS server.
Click Add (+) at the bottom of the Search Domain list and enter the search domain, for example, apple.com.

When you’re finished, click OK.
Domains are searched in the order you list them, and the search stops when a valid name is found.

To search a name hierarchy, use search domains of varying scope. For example: building.campus.university.edu, campus.university.edu, and university.edu.

com.apple.mDNSResponder.plist can be overwritten by something else/update and you will forget it. The url above is the "supported" way to add the domain search path to the DNS query.

2
  • This URL is no longer valid, it would have been helpful to add the relevant information into this answer. Mar 26 '20 at 22:33
  • 1
    I added the text but apparently someone added pictures since then of the same thing and is now the upvoted answer.
    – Marlon
    Apr 2 '20 at 21:34

You must log in to answer this question.

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