You are not logged in.

#1 2017-11-08 17:42:51

krey
Member
From: New York City
Registered: 2011-10-09
Posts: 22

Exclude domain from DNS cache (pdnsd)

I'm using pdnsd on my laptop.

On the school network mysite.myschool.edu resolves to a different ip than it does on an external network.
So every time I go to/leave school, I need to purge my cache:

# pdnsd-ctl empty-cache

I would like to change my config file to never cache mysite.myschool.edu, as a primitive fix to this issue, but I can't figure out how to do it. (I have Skimmed The Fine Manual)

Here's my /etc/pdnsd.conf:

global {
	perm_cache=1024;
	cache_dir="/var/cache/pdnsd";
#	pid_file = /var/run/pdnsd.pid;
	run_as="pdnsd";
	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=8h;       # Retain cached entries at least 15 minutes.
	max_ttl=1w;        # One week.
	timeout=10;        # Global timeout option (10 seconds).
	neg_domain_pol=on;
	udpbufsize=1024;   # Upper limit on the size of UDP messages.

	# https://wiki.archlinux.org/index.php/Pdnsd
	neg_rrs_pol=on;
	par_queries=2;
}

# Resolv.conf
server {
	label= "resolvconf";
	file = "/etc/pdnsd-resolv.conf";  # Preferably do not use /etc/resolv.conf
	#ip = 8.8.8.8;
	proxy_only=on;
	timeout=4;
	#uptest=if;
	#interface=wifi;
	purge_cache=off;
	#preset=off;
}

server {
	label="google";
	ip = 8.8.8.8;
	proxy_only=on;
	timeout=4;
	uptest=none;
	purge_cache=off;
}

server {
	label="google";
	ip = 8.8.4.4;
	proxy_only=on;
	timeout=4;
	uptest=none;
	purge_cache=off;
}

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;
}

Thanks for your help,

krey

Last edited by krey (2017-11-08 17:43:27)

Offline

#2 2017-11-08 18:18:00

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Exclude domain from DNS cache (pdnsd)

I think the exclude= option should do the trick. Look at the man page for details.

Offline

#3 2017-12-23 17:54:08

krey
Member
From: New York City
Registered: 2011-10-09
Posts: 22

Re: Exclude domain from DNS cache (pdnsd)

Thanks x33a, I have looked at the man page, but I don't think this is what exclude is for

From the manual

exclude=string;
    This option adds an entry to the exclusion/inclusion list. If a domain matches the name given as string, the server is not queried if this was the first matching rule (see also the entry for policy).
     
    If the given name starts with a dot, the whole subdomain of the given name including the one of that name is matched, e.g. ".foo.bar." will match the domain names a.foo.bar., a.b.c.foo.bar. and foo.bar.
     
    If it does not start in a dot, only exactly the given name (ignoring the case, of course) will be matched (hint: if you want to exclude all subdomains, but not the domain of the given name itself, place an exact-match include rule before the exclude rule, e.g: include="foo.bar."; exclude=".foo.bar.";
     
    pdnsd now also accepts a more compact notation for adding several "exclude" entries in one line, e.g.:
     
    exclude=".foo",".bar",".my.dom";

My issue is that the ip address is cached. Which section would you add "exclude" to to fix this issue?

I'm not able to add it to the "global" or "rr" sections. I added it to all the "server" sections instead, but then nslookup fails;

** server can't find mysite.university.edu: SERVFAIL

Last edited by krey (2017-12-23 18:06:57)

Offline

#4 2018-01-01 18:25:08

pdc
Member
Registered: 2015-05-30
Posts: 33

Re: Exclude domain from DNS cache (pdnsd)

This is a bit late, but I found the answer when I wanted to stop pdnsd caching the addresses for pool.ntp.org timeservers.

Use "exclude" to stop pdnsd handling your domain, and add

resolv_conf_local_only=no

to your /etc/resolvconf.conf. That makes resolvconf add dns servers from DHCP to /etc/resolv.conf as well as /etc/pdnsd-resolv.conf.

Offline

Board footer

Powered by FluxBB