[HOWTO] - Speed up DNS lookups in OSX

Hi there,

I'm a total newbie at this Unix stuff, so bear with me if my brain is on the wrong way around.

I've followed all the instructions, and everything seems to be working OK, in that my internet connection is fine. However, when I type nslookup into terminal now I get the following...

*** Can't find server name for address 10.0.1.1: Non-existent host/domain
*** Default servers are not available

Is this something I should worry about?! If it is, can I fix it?!

ta.

Ed.
 
Everything is working well, but I can't get Named to start at boot. Once I start I can launch a terminal and run /Library/StartupItems/Named/Named
and it is fine. Added some debug stuff into Named/Named and it seems as though the script never gets executed. Any thoughts on why this might be?

Thanks!
 
Are you using Jag?

Under 10.2, they've made the DNS server already pretty much all set up for you. Just edit /etc/hostconfig to say
DNSSERVER=-YES-
and that's pretty much it.

Oh yeah, there's one other thing - You need to edit /System/Library/StartupItems/Named/Named and change the bit that says DNSSSERVER to DNSSERVER (note the extra 'S')
...somebody forgot to spellcheck...

Then just reboot and it should work. Also, a lot of the stuff this hint says is already done by apple - the /var/named stuff is already set up (even got a hints file already for you).
 
Okay; now that we have the basics down, I have a real-world application. Our network is behind firewall/router that does not allow loopbacks. Therefore, changing the lookup order and adding machines entries to NetInfo to get local domain name resolution is the preferred method for adding entries to access our domain named e-mail server. This works fine for desktop machines within the confines of a LAN.

However, I have a laptop user to contend with who is not always on the network. He often travels and dials-up on the road. NetInfo 'machines' entries will trump his DNS resolution, making our server inaccessible to him.

The ideal solution(?) is to have the user switch lookup orders for when they are on the road and back when they are behind the network. I elected to create an AppleScript to do the job and install the Script Menu in the user's menubar to make the script easily accessible.

Overall, it seemed like the most effecient way to accomplish the goal. For those interested, here is the script in its enirety. I have also attached it to this post as a compiled AppleScript.
Code:
(*
This script will set optimize your lookup order for a LAN internet connection  or dial-up
*)

set runresult to ""

tell me to activate
display dialog "Please choose your connection method to optimize your internet connection" buttons {"LAN", "Dial-up"} default button 2
set userchoice to button returned of result
if userchoice = "LAN" then
	set myReply to (display dialog "Please enter your Administrator password" default answer "" giving up after 60)
	set myPassword to (text returned of myReply)
	if myPassword is not "" then
		try
			--LAN optimized
			do shell script "sudo /usr/bin/niutil -create / /locations/lookupd/hosts" password myPassword with administrator privileges
			do shell script "sudo /usr/bin/niutil -createprop / /locations/lookupd/hosts LookupOrder CacheAgent NIAgent DNSAgent" password myPassword with administrator privileges
			do shell script "sudo /bin/kill -USR1 `/bin/cat /var/run/lookupd.pid`" password myPassword with administrator privileges
			set runresult to "Network settings optimized for LAN connection" & return
		on error errormsj
			display dialog errormsj as string
			set runresult to runresult & "Settings change failed: " & errormsj & return
			--return adds ASCII13 to the output
		end try
	end if
	
	tell me to activate
	display dialog (runresult as string) buttons {"Ok"}
	
else if userchoice = "Dial-up" then
	set myReply to (display dialog "Please enter your Administrator password" default answer "" giving up after 60)
	set myPassword to (text returned of myReply)
	if myPassword is not "" then
		try
			--Dial-up optimized
			do shell script "/usr/bin/niutil -create / /locations/lookupd/hosts" password myPassword with administrator privileges
			do shell script "/usr/bin/niutil -createprop / /locations/lookupd/hosts LookupOrder CacheAgent DNSAgent NIAgent" password myPassword with administrator privileges
			do shell script "/bin/kill -USR1 `/bin/cat /var/run/lookupd.pid`" password myPassword with administrator privileges
			
			--display progress
			set runresult to "Settings optimized for dial-up connection"
		on error errormsj
			display dialog errormsj as string
			set runresult to errormsj
		end try
	end if
	tell me to activate
	display dialog ("Network Configuration:" & return & runresult) as string buttons {"Ok"}
	
end if
 
Hi DarkShadow.
All worked fine thanks, but now ADGate (ad server blocker - very good) does nothing, so web now slower on the whole:(
Can the two work together? If not, how do I (sadly) uninstall this mod?)
 
Back
Top