Knot, kresd with /etc/hosts

knot
dns

#1

Hi,

how can I configure TO with its default knot/kresd to load AND SERVE entries from /etc/hosts.
with list hostname_config ‘/etc/hosts’ in /etc/config/resolver I couldonly achieve to resolve it from the tourer but I want to resolve it also form my PC connected to it (or any other device on the network)


#2

That hostname_config option should work fine. Without the option the file just used locally by libc (i.e. takes only effect on the router itself), with the option it affects also the DNS served.

I assume you did restart the resolver, and the PC does ask it for DNS (not using some other source), etc.


#3

Hmm, you are right, the router seems to serve it because it works if I nslookup it specifially via the router on my PC:

$ nslookup turris 192.168.1.1
Server: 192.168.1.1
Address: 192.168.1.1#53

Non-authoritative answer:
Name: turris
Address: 192.168.1.1

But for some reason it does not work by default (without specifiying the router IP):

$ nslookup turris
Server: 127.0.0.53
Address: 127.0.0.53#53

** server can’t find turris: SERVFAIL

although I set up my eth0 network settings in NetworkManager to use DNS resolver with 192.168.1.1:

$ nmcli dev show | grep DNS
IP4.DNS[1]: 192.168.1.1
IP6.DNS[1]: fd48:49f0:ee01::1

What could be wrong?
Thanks for your feedback


#4

Maybe a bit “old school” in times of NetworkManager, but /etc/resolv.conf points to your configured nameserver (192.168.1.1) as well? :wink:


#5

yes, but I would rather like to make it work via NetworkManager if possible, otherwise my settings in networkmanager gui wouldnt work. Also I am really curious what the hell this problem is


#6

Did you use an older ubuntu release? If I remember right, they have used a bogus ‘systemd-resolved’ service which listens on “127.0.0.53” … google is your friend! :wink:

Good luck!


#7

No, it is the latest Ubuntu LTS: Ubuntu 18.04.2 LTS

127.0.0.53 should be not bogus, it is your localhost for dnsmasq, that is caching requests/responses.

For my problem I have also found this recently:

it seems it is about the short name problem, however I added lan as my search domain and it does not work, but using the lan extension it does not even work from the router, only without it:

[root@turris:~]# nslookup turris
Server: 127.0.0.1
Address: 127.0.0.1#53

Name: turris
Address 1: 192.168.1.1
*** Can’t find turris: No answer

[root@turris:~]|# nslookup turris.lan
Server: 127.0.0.1
Address: 127.0.0.1#53

** server can’t find turris.lan: NXDOMAIN
** server can’t find turris.lan: NXDOMAIN


#8

I don’t see any advantages in such cascading DNS setups. I use unbound or kresd as central caching resolver in my (test) network, propagated via DHCP - without further DNS services on the clients.