You are not logged in.

#1 2018-07-04 19:34:56

Freggar
Member
Registered: 2017-04-22
Posts: 3

[SOLVED] pdnsd: dns uptest fails during boot

Hey, I'm currently facing an issue with my pdnsd setup.
Short Overview:

I run NetworkManager in a WiFi configuration and added pdnsd to cache OpenDNS results. When the computer initially boots up all DNS requests fail. This can be temporarily fixed by restarting pdnsd.service manually. The issue I'm facing seems very similar to  https://bbs.archlinux.org/viewtopic.php?id=186006.

Here is the journalctl showing how after a reboot pdnsd fails and how after a manual restart pdnsd starts working again. Interestingly, pdnsd fails the ping test for the first time and marks the OpenDNS server as down although I also tried setting ping_timeout to 10 minutes. https://ptpb.pw/5_dl

/etc/pdnsd.conf

global {
	debug=on;
	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=15m;       # 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.
}

server {
	label = "opendns";
	ip = 208.67.222.222, 208.67.220.220;
	timeout = 4;
	uptest = ping;            
	ping_timeout = 6000;	
	interval = 15m;           # Test every 15 minutes.
	preset = off;
	interface = wlp2s0;
}

rr {
	name=localhost;
	reverse=on;
	a=127.0.0.1;
	owner=localhost;
	soa=localhost,root.localhost,42,86400,900,86400,86400;
}

/etc/resolv.conf

search home
nameserver 127.0.0.1

/etc/NetworkManager/NetworkManager.conf

# Configuration file for NetworkManager.
# See "man 5 NetworkManager.conf" for details.
[main]
dns=unmanaged

Any ideas how I can further debug/troubleshoot the problem? I also tried replacing Required/Wants network.target with NetworkManager-wait-online.service but that didn't seem to do anything.

Last edited by Freggar (2018-07-05 17:12:17)

Offline

#2 2018-07-05 06:56:46

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,723

Re: [SOLVED] pdnsd: dns uptest fails during boot

As the pdnsd.service hooks into network-online.target, have you enabled NetworkManager-wait-online.service ? You don't need to adjust the pdnsd service file, but you have to enable NetworkManager-wait-online so that it can invoke network-online.target when notified of that by NetworkManger.

Offline

#3 2018-07-05 16:50:22

Freggar
Member
Registered: 2017-04-22
Posts: 3

Re: [SOLVED] pdnsd: dns uptest fails during boot

1. Yes it's enabled
2. Sorry, I should have taken a close look at NetworkManager-wait-online.service; I thought that this service comes after network-online.target

Nevertheless the issue persisted and I found out why. By default NetworkManager-wait-online.service uses

/usr/bin/nm-online -s -q --timeout=30

where the -s flag does following as per nm-online(1):

Wait for NetworkManager startup to complete, rather than waiting for network connectivity
specifically. Startup is considered complete once NetworkManager has activated (or attempted to
activate) every auto-activate connection which is available given the current network state.
(This is generally only useful at boot time; after startup has completed, nm-online -s will
just return immediately, regardless of the current network state.)

So pdnsd was still started before an actual ping could have succeeded. Creating a new systemd unit specifically for pdnsd without the -s flag solves this issue.

EDIT:
Now this is still not quite the solution I want because this does not cover cases where the PC is started without being connected to Wifi and only later on connects to Wifi.
So I've found a solution that makes pdnsd retest the opendns servers when NetworkManager connects to an interface using NetworkManager's dispatcher. Just define a file like this:

/etc/NetworkManager/dispatcher.d/10-pdnsd.sh

#!/bin/sh
pdnsd-ctl server opendns retest

Now every time NetworkManager connects to an interface it'll trigger pdnsd to reping the DNS servers.

Last edited by Freggar (2018-07-05 20:09:37)

Offline

Board footer

Powered by FluxBB