DNS lookup priorities -- hosts file

Hi,


I need to make the hosts file top priority in lookups. Could someone advise me on whether or not the following procedure will work? Do I need to do anything else to make the hosts file itself top priority or is that implied in "strict unicast ordering"? I'm using OS X 10.6.8 right now. If there is a better way to do it, let me know! 🙂



Open the com.apple.mDNSResponder.plist file in a text editor (the file is located in /System/Library/LaunchDaemons/ ).

Locate the following key in the file:

<key>EnableTransactions</key>
<true/>
</dict>

Between the last <true/> and </dict>, add the following lines:

<key>StrictUnicastOrdering</key>
<true/>

Use Terminal to unload and load mDNSResponder.


Thanks


Bob

Mac OS X (10.6.8)

Posted on Aug 25, 2012 4:15 PM

Reply
8 replies

Aug 25, 2012 5:39 PM in response to Linc Davis

(in response to Linc Davis)


I would think it does, but very occasionally a request slips through and is resolved by DNS to an external webpage instead. Is there any way to check on the order (is there a modern equivalent to "lookupd -configuration" or something like it)? I know the order is supposed to be dynamic now...


I just had a thought -- a slow-responding server is pushed to the last position in the lookup order according to Apple (brief summary, in case someone reading hasn't yet seen it: http://support.apple.com/kb/HT4030). Maybe when the computer has a heavy load to process, and it takes longer than the 30 second timeout to read the hosts file, it goes on - by default - to the next-in-line resolution option. Does that seem plausible? As a side note, I do remember to flush the cache when I edit the hosts file.

Aug 25, 2012 8:36 PM in response to Linc Davis

I don't know what that's the output from, but it seems to have nothing to do with name resolution.

I should have been clearer: In a Terminal window, I opened dscl (in interactive mode) and entered "list . hosts" just like you said. BSD shows up before Local, which says to me that DNS will be searched before the hosts file (so I won't get the result I want that's given in the hosts file). Tell me if I'm incorrect there, though. Is there any way to read the cache results directly? That would really help, but I haven't found out how to do that yet or if it's possible. Thanks for your help so far!


Bob

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

DNS lookup priorities -- hosts file

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.