How to configure local address DNS resoultion on Omnia

To be honest I am a bit confused that this is not working OOB. As I see it, there is user interfaces to add host names and to configure DHCP and DNS, at a first glance this should be a breeze to set up. However, whatever setting I put into the host names entries seems to be ignored.
Can someone please explain, in a step-by-step answer, how to enable local address resolution because I can’t seem to get it to work at all.

Yes, I wanted to do it like this but it seems that there is Knot resolver https://www.knot-resolver.cz/ installed and I did not find possibility yet, how to configure Knot resolver to forward local domain zone to dnsmasq. Or maybe there is no such feature yet.

Knot dns (which you are referring in your post) is probably different product (maybe I am wrong).

It looks like that in case of Knot resolver we will need some module which will be able to handle this functionality. Something like http://knot-resolver.readthedocs.io/en/latest/modules.html#static-hints but in case of local domain query it should be able either read data from files created by dnsmasq dhcp part or it should be able to make query to dnsmasq. Unfortunately there is probably not suitable module yet. Or at least I did not find it yet.

It is already answered here.

Update (19.04.2018): Dunno exactly since when, but since some version of kresd you have to use policy.STUB() instead of policy.FORWARD()

1 Like

Hi,

is odhcpd really necessary, if dnsmasq is used?

p.

odhcpd is used as a DHCPv6/RA Server & Relay. It’s DHCP(v4) functions are disabled. This is exactly the same setup like in current OpenWRT/LEDE.

I found a solution how to resolve host-names from DHCP. Here is the solution:

Edit:
/etc/init.d/kresd
Add those two lines:

  1. in section init_header, after line echo " 'policy'" >> $CONFIGFILE
    echo " , 'hints'" >> $CONFIGFILE
  2. in section load_uci_config_common, after line set_param_func "cache.clear" ""
    set_param_func "hints.config" "'/tmp/hosts/dhcp'"

restart the KNOT service:
/etc/init.d/kresd restart

If you edit /etc/config/dhcp and add anything you want, it will be resolved as well.

3 Likes

i had a similar problem, and ended up looking at how it would be done in the next update of the resolver. it seems it will support arbitrary configuration files, with the include_config option. this allows arbitrary extensions to the resolver configuration, but of course it would be much better if the specific use case here would be covered in UCI and LUCI.

see this discussion for more information about the exact changes I did:

1 Like

Should this resolve static leases added to LuCI? Did not work for me.

IMHO local addres DNS resolution from /etc/ethers and /etc/hosts should be working by default.

Well, for me all this works. What I had to change in comparision to default is:

  • dnsmasq port I set to 54
  • /etc/init.d/kresd - line 41 I included the line
    echo “policy.add(policy.suffix(policy.FORWARD(‘127.0.0.1@54’), policy.todnames({‘lan’,‘2.168.192.in-addr.arpa’,‘4.168.192.in-addr.arpa’})))” >>$CONFIGFILE
  • firewall update for port 54 for my guest network

This constellation works properly on my turris. DHCP dynamic, statisc lease from LUCI, DNS resolving as well.

Works also together with OpenVPN in tun mode, no issues.

2 Likes

Thanks. This solution worked for me. After adding entries to /etc/config/dhcp I had to restart kresd for the changes to take effect. Same thing when I added them through luci hostnames option.

Extremely clear and useful ! No more headaches :slight_smile:
Thanks !

@tr1l1ner’s fix worked for me too, why isn’t that just the default config? I assume they can get that local domain from the GUI.

Okay so one major snag is that I don’t want the root domain getting caught up in this and I think it is. I only want subdomains, i guess I have to write a regex patter but the format in Knot is a bit confusing.

Other solution (static, but supported I think and also without breaking init.d scripts) is to add static DHCP leases (edit /etc/config/dhcp or use LuCi -> Network -> DHCP and DNS -> Static Leases). After that you have to restart Knot using /etc/init.d/resolver restart (this is possibly bug, because I think it should work also without restart).

Verify a solution in file /tmp/kresd.config. It should contains:

hints['obluda.lan'] = '192.168.10.232'
hints['turris.lan'] = '192.168.10.1'
hints['cloudia.lan'] = '192.168.10.121'
hints['krtko.lan'] = '192.168.10.124'

I have the hints in my config file, but when I ping those names the ip is not resolved.

root@turris:~# cat /tmp/kresd.config | grep Foscam      
hints['Foscam.lan'] = '192.168.1.98'                    
root@turris:~# ping Foscam.lan                          
ping: bad address 'Foscam.lan'

Do the hints work for you?

Can you ping them?

It works for me. what is output of:

nslookup Foscam.lan 192.168.1.1

did you try this from your client machine, not from turris?

Server:      192.168.1.1
Address 1:   192.168.1.1

nslookup: can't resolve 'Foscam.lan': Name does not resolve

Both from turris and a client.

I don’t forward the DNS request to other IPs or Dnsmasq.

I added an entry into /etc/hosts file, and that works.
But the hints are not working.

I don’t know, it works for me with or without forwarding

@tr1l1ner I’m attempting to use this solution to a bug I’ve reported with revrerse lookup. My /etc/config/dhcp contains all of the hosts that I am attempting to reach by reverse lookup. My /etc/config/dhcp looks like this - not sure what to expect, but the only entry is my Omnia:

auto-generated config file from /etc/config/dhcp

x.x.x.1 nxnet

My interpretation of the proposed solution is that I should see (or add?) all of the other host entries. Manual add to an autogenerated file makes no sense to me. What am I missing?