nisanth074
4/21/2015 - 5:12 AM

PDNSD DNS Daemon Setup

PDNSD DNS Daemon Setup

// Read the pdnsd.conf(5) manpage for an explanation of the options.
// Add or remove '#' in front of options you want to disable or enable, respectively.
// Remove '/*' and '*/' to enable complete sections.

global {
	perm_cache=999999;
	cache_dir="/usr/local/var/cache/pdnsd";
#	pid_file = /var/run/pdnsd.pid;
	run_as="nobody";
	server_ip = 127.0.0.1;  # Use eth0 here if you want to allow other
				# machines on your network to query pdnsd.
	status_ctl = on;
#	paranoid=on;       # This option reduces the chance of cache poisoning
	                   # but may make pdnsd less efficient, unfortunately.
	query_method=udp_tcp;
	min_ttl=1d;       # Retain cached entries at least 1 day.
	max_ttl=2d;        # Two days
	timeout=10;        # Global timeout option (10 seconds).
	neg_domain_pol=on;
}

# The following section is most appropriate if you have a fixed connection to
# the Internet and an ISP which provides good DNS servers.
server {
	label= "Google Public DNS";
	ip = 8.8.8.8, 8.8.4.4, 4.2.2.2;  # Put your ISP's DNS-server address(es) here.
	proxy_only=on;     # Do not query any name servers beside your ISP's.
	                   # This may be necessary if you are behind some
	                   # kind of firewall and cannot receive replies
	                   # from outside name servers.
	timeout=4;         # Server timeout; this may be much shorter
			   # that the global timeout option.
	uptest=ping;         # Test if the network interface is active.
	ping_timeout=100;
    #interface=eth0;    # The name of the interface to check.
	interval=10m;      # Check every 10 minutes.
	purge_cache=off;   # Keep stale cache entries in case the ISP's
			           # DNS servers go offline.
}


source {
	owner=localhost;
#	serve_aliases=on;
	file="/etc/hosts";
}


rr {
	name=localhost;
	reverse=on;
	a=127.0.0.1;
	owner=localhost;
	soa=localhost,root.localhost,42,86400,900,86400,86400;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>Label</key>
        <string>homebrew.mxcl.pdnsd</string>
        <key>Program</key>
        <string>/usr/local/sbin/pdnsd</string>
        <key>RunAtLoad</key>
        <true/>
        <key>ServiceDescription</key>
        <string>pdnsd dns caching daemon</string>
    </dict>
</plist>

Installing pdnsd from homebrew as root user.

$ brew install pdnsd

$ sudo chown -R nobody /usr/local/var/cache/pdnsd

$ curl -L http://goo.gl/kMlyQ -o pdnsd.conf
$ mv pdnsd.conf /usr/local/etc
$ sudo chown root /usr/local/etc/pdnsd.conf

Test

$ sudo pdnsd
$ dig @127.0.0.1 www.google.com
  .... You should see a proper response here.

Running pdnsd on startup.

$ curl -L http://goo.gl/qk77g -o homebrew.mxcl.pdnsd.plist
$ sudo mv homebrew.mxcl.pdnsd.plist /Library/LaunchDaemons
$ sudo chown root /Library/LaunchDaemons/homebrew.mxcl.pdnsd.plist
$ sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.pdnsd.plist