Hostname resolution in LAN?


#1

Hi there

I have sever computers/devices on my lan. With the Asus RT-AC68U with Merlin and dnsmasq I was able to just ping and access them like “ping computer1”.

However, with the Turris Omnia I can’t neither ping no access them.

How can I eanble automatic hostname resolution in the lan (for dhcp devices, for static I can edit the /etc/hosts file).


Demo for Turris Omnia
#2

A simple search of the forum brings up multiple posts on this:

https://forum.turris.cz/search?q=local%20resolution

I think it’s OK if there’s something in those posts that you have questions about, but a basic search should probably be your first action.


#3

Unfortunately those multiple results all have very different things to say… also feedback on them is sometimes positive, sometimes negative… also they are rather “old”.

So, what is the proper way to achieve that? Disabling KNod and stuff? Enabling dnsmasq? Although it seems dnsmasq is now enabled by default…

However I have no idea what part play now which role in dns resolution etc… hence, I need clarification.


#4

This is the best solution (first post)


#5

Which requires rather some “deep” changes… changing port for dnsmasq, adding custom rules and scripts

and worst of it… it’s non-generic at all as you have to hardcode the local lan subnet into it.

Also, it won’t just use the hostname but it will requires hostname.lan.

So much work for something that should work out-of-the-box and it’s not even generic… if by chance I want to change my lan subnet, I’ll have to reedit that again.

And is this really working? There’s feedback in the thread that it doesnt: Dnsmasq .lan domain while still using knot resolver


#6

just use hostnames, dont use capital letters, and you will be fine… there isnt needed to do anything else.


#7

Yet only using small letters still down’t make it work.


#8

The capital-letter problem in kresd should be long fixed.

I think that simply adding option dynamic_domains '1' should do what you want, but my knowledge is mainly about kresd and not much about Omnia. (maybe there’s some checkbox for it) The relevant script.


#9

And where should the dynamic_domains ‘1’ be added?


#10

I think /etc/config/resolver, section config resolver 'kresd'.


#11

I will try and give then feedback.


#12

Did you configure static leases? I meant hostnames related to them (sorry for confusion). It works for me out of the box for months.

Can be done also via Luci. Just defining static lease and its hostname was enough for my Omnia.

EDIT: I see now you already have working static, no experience with dynamic, apologies. Let us know, if dynamic domains works for you :slight_smile:


#13

Solution i posted requeries only a few changes, survives updates and has worked stable for me for over 4 months. If lan is configured as search domain in dhcp clients automtically resolve hostname as hostname.lan.

And there is no hardcoding anywhere. All you do is editing config files, there is no hard coding. Somewhere some variables have to be defined and this is what config files are for.

Trust me i’m an engineer :wink:

Edit: If something has changed in recent updates I might be wrong, but if local domain resolution doesn’t work for you anyway you could give it a try.


#14

There’s still issues… after adding the line suggested by vcunat, it can’t properly resolve hostnames anymore that are on the TO in the /etc/hosts file.


#15

I assume the static_domains option isn’t explicitly disabled in your config.

If you want to try to debug it, have a look at file $(uci get resolver.kresd.rundir)/hints_dynamic.tmp, as it should contain combination of dynamic and static hints. The code for this. (Probably; I never know which commit is in which release.)


#16

I still can’t get it to work.

Also, I noticed that it takes rather a long time for a ping to become effective. E.g.

ping hostname

Then it takes like 5-6 seconds before I get a reply - this is weird, on the Asus RT-AC68U with Merlin Firmware, it takes no time at all.

Anyway, I still can’t get it to work. I did add the line by vcunat and I still can ping the hostnames in the /etc/hosts fine - except that it takes like forever until it starts pinging them. This happens even when I ping them anew…

hyper@subi:/tmp$ cat pingTest 
#!/usr/bin/env bash

remote="data"
time ping -c 1 "${remote}"
hyper@subi:/tmp$ ./pingTest 
PING data (10.10.10.7) 56(84) bytes of data.
64 bytes from 10.10.10.7 (10.10.10.7): icmp_seq=1 ttl=64 time=0.264 ms

--- data ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.264/0.264/0.264/0.000 ms

real    0m5.012s
user    0m0.002s
sys     0m0.002s

however, it still won’t ping any hostnames that are not in /etc/hosts

hyper@subi:/tmp$ ssh root@data

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Thu Jun  1 13:26:12 2017 from xxx
root@data:~# ping subi
ping: unknown host subi

Also DNS resolution in general is really shitty. No matter where I go, I see the browser at least 1-2 seconds to resolve the domain name. Even when it’s a domain I’ve visited 5 minutes ago.


#17

If you configured kresd with forwarding, there would be effectively no local caching or validation. We’re changing the default forwarding mode – upstream just about now and on Omnia within weeks (most likely).

From your ping test it’s unclear to me whether the lag is just due to DNS or something else as well (you can try pinging an IP address directly).


#18

I still have the issue, that I can’t resolve hostnames in the lan…

As said, I did add a few static entries to the /etc/hosts file on the TO. I can resolve them.

However, my notebook for examble has the hostname “subi”. No other computer on the lan can resolve it.

How can this be fixed?


#19

I posted the best way I know how to start looking for what exactly is wrong on the part of those “missing” names.


#20

I have no idea where that static_domains option is.

Also, I have no idea how to get to that hints_dynamic.tmp file.

root@turris:~# cat $(uci get resolver.kresd.rundir)/hints_dynamic.tmp
uci: Parse error (invalid command) at line 25, byte 1
cat: can't open '/hints_dynamic.tmp': No such file or directory