Dnsmasq .lan domain while still using knot resolver

This should be a default config that knotdns starts on port 53 and dnsmasq on 54 or 5353 and then that knotdns forwards to dnsmasq. Ok, Turris Omnia is for powerful users but still I vote for +1 on this as default config.

I think appropriate pull request would work much better than voting :wink:

Well, Luci needs additional comment or tooltip as well then, because if regular user sees that config page, he would think that programmers were drunk to choose non standard DNS port, as all other OpenWRT routers use 53ā€¦ (He changes it back to 53 and instantly breaks DNS) :smiley:

There is no way, how to configure .lan thing to the knot itself? Using dnsmasq for that is the only way to do that?

I dont care about luci, configuring via script is fine for me, but I dont know how. And it seems cleaner solution to me.

Pull request to where? There does not seem to be a comprehensive guide how tu make pull request or even where to find the repository.

I think it is a better setup like this. If I am not mistaken dnsmasq is also a dhcp server, so it is running no matter what.

In relation to @dpdrownā€™s first post: for me it only activated after rebooting the Omnia

Apparently only restarting kresd (/etc/init.d/kresd restart) after the edits was not enough to make it active, while a complete system did the trick.

What did I miss (should I have restarted the DHCP server maybe; and - if so - how)?

Restarting kresd is enought, but you may have some caching of responses on the client. Not related to Omnia.

After recent update, my change in /etc/init.d/kresd was overwritten.

But I found some new, better options.

In /etc/config/resolver there is section for kresd containing two commented-out lines:

option include_config '/tmp/kresd.custom.conf'
option hostname_config '/etc/hosts'

The first line allows to add custom rules to that config files. I changed it to /etc/kresd.custom.conf. This file wonā€™t get overwritten. For example, the rules suggested above to forward local domain to dnsmasq:

policy.add(policy.suffix(policy.FORWARD('127.0.0.1@5353'), policy.todnames({'lan'})))
policy.add(policy.suffix(policy.FORWARD('127.0.0.1@5353'), policy.todnames({'10.in-addr.arpa'})))

This is for 10.0.0.0/8 network. You still need to hack /usr/lib/kdns_modules/policy.lua to allow forwarding reverse DNS of private zoneā€¦

Now, there is easier option, as Knot resolver itself now resolves most of the local domain. Missing just the router itself and the reverse queries. The first problem can be solved by uncommenting the other option. Add something like this to /etc/hosts:

10.0.0.1 turris.lan turris

After restarting (/etc/init.d/kresd restart), Knot resolves all hosts in local domain. Still, I opted for Dnsmasq for the bonus of reverse queries.

2 Likes

what do do there, just change port from 53 to port of dnsmasq in line 58?

Thank you @glyphin , it works for me.
Just for info - both options
option include_config '/tmp/kresd.custom.conf' option hostname_config '/etc/hosts'
was not available In my /etc/config/resolver after update so I added them

Ah I canā€™t get it to work again, the local 192.168.1.X network .lan is not resolved at all :-/

Actually now kresd should automatically resolve static names as set in DHCP page in LuCI without need to manually configure it. But if you need more than that, include_config is there for you :slight_smile:

But it doesnā€™t at least it did not for me, I will try to comment out the include_config out, but on Monday, I have left work for today and set everything to IPs for now. Anything else needs to be setup in DNS and DHCP config for it to work ? Like specific port for DNS, or anything ticked on or off ?

Should be enough to fill in Local server and Local Domain the same way and then just add some static leases.

ok will try it on Monday, thanks.

Regarding the reverse DNS:

In /usr/lib/kdns_modules/policy.lua, I commented out the line for 10.0.0.0/8 private network, so the affected section now looks like this:

-- RFC1918 Private, local, broadcast, test and special zones.
local private_zones = {
--    '10.in-addr.arpa.',

Note that this change will again be lost with next update.

Static leases work however what I discovered:

  • even when I changed port of dnsmasq to 5353 I discovered that nothing listen on that port.
  • I had some hostnames defined (not static leases) - e.g. ldap.home pointing to TO IP address
    ā€“ I solved it by adding the hostnames manually into /etc/hosts and uncommented the option hostname_config '/etc/hosts'

Does not work for me as well, I think I donā€™t exactly understand these two option values. I have the following:

    option domain 'home.lan'
    option local '/lan/'

Added some entries, but it does not work for me. Shall I add the entries with or withou the ā€œhome.lanā€ suffix?

Static leases should be without suffix and domain and local should be same. Local specifies the name of your locally created domain and domain in which domain computers in your local network should search for hostnames.