KadNode
KadNode copied to clipboard
Debian: add KadNode to resolv.conf
The openwrt package register redirect of the .p2p domains to a local kadnode dns resolver. But for Debian and Arch only the NSS reolver is added. Should we add the preinst script that will add the same redirect to the resolv.conf?
The problem is that the TLD that is intercepted is configurable. So when it is set for the kadnode binary, it would also need to be changed in the /etc/resolv.conf. On OpenWrt I had no other choice because there is no /etc/nsswitch.conf.
We may add the same p2p TLD by default. Any advanced users may set up own domain if needed.
Sure, we can use /etc/resolv.conf on Debian instead of /etc/nsswitch.conf if it is possible.
I found that Consul redirects DNS for own tld: https://developer.hashicorp.com/consul/docs/services/discovery/dns-forwarding/enable#systemd-resolved
So create /etc/systemd/resolved.conf.d/kadnode.conf
[Resolve]
DNS=127.0.0.1:3535
DNSSEC=false
Domains=~p2p
then
systemctl restart systemd-resolved
add to /etc/kadnode/kadnode.conf the option --dns-port 3535 and systemctl restart kadnode.
I think we should do this by default.
Hi, that is what we do on OpenWrt already. If it works, then I would definitely prefer this. Do you like to create an MR?
I may send a PR later. BTW the Consul article shows that we may add a file into /etc/dnsmasq.d/ so we probably may get rid off the postinst script.
hm, dnsmasq does not seem to use /etc/dnsmasq.d by default in OpenWrt
yes, the ps ax | grep dnsmasq shows /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf.cfg01411c so it uses the generated config. The generated config inside has only one conf-dir=/tmp/dnsmasq.d. I don't know why the OpenWrt doesn't look for the the standard folder.
The postinst has:
uci add_list dhcp.@dnsmasq[0].server='/p2p/::1#3535'
The wiki page says:
If it does not work it may mean that KadNode tries to connect to the IPv4 localhost address. Change ::1 by 127.0.0.1 in this case.
Maybe use the IPv4 here? like /p2p/127.0.0.2#3535. If someone built OpenWrt without the IPv6 support then it won't have a trouble.
I agree that 127.0.0.1 is the slightly better choice.