FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
551 views 8 comments
by anonymous

Hi all,

some of our RUT240s exhibit the following picture:

  • Shortly after bootup, local DNS is available on LAN/WiFi, and I can access devices in the network via their hostnames (that is, `ping my_box` resolves `my_box` correctly to its local address, say, `192.168.1.200`).

  • Then, after LTE connectivity is established, the resolution is lost. `ping my_box` no longer pings `my_box` but returns `Name or service not known`. Wireshark traces show that the router responds to the DNS request with a message that it doesn't know what `my_box` is.

I suspect that this is an effect of NTP synchronization, that is, DNS lease expires when the clock updates from 2021 to now. Could this be the cause? If so, how to go about it? If not, what else could I check?
by anonymous
IMHO, after LTE goes up, your router's DNS switched from local to external, provided by LTE interface.

I think, you need to set on router LAN interface correct dns address.
by anonymous
I'm not sure I understand this correctly. As I mentioned in another comment, explicitly setting the DNS server for the LAN interface does not make a difference. Furthermore, even when I explicitly ask the router's dnsmasq service for the address of `my_box`, the result is either empty or NXDOMAIN, depending on if I skip or use `.lan`.

1 Answer

0 votes
by anonymous

Hello,

Have you tried configuring a DNS server on the LAN interface explicitly? This can be done by navigating to Network -> Interfaces -> General -> Edit LAN interface -> put the IP address of your desired DNS server (for example, the IP of RUT itself).

Check the servers used from the CLI/SSH via the following command:

  • cat /tmp/resolv.conf.d/resolv.conf.auto

Kind Regards,

by anonymous
Thanks! As far as I have seen, the field is empty. Which behaviour would that entail? As far as I understand, the router has its own DNS server, does it get ignored then?
by anonymous

Also I cannot confirm the answer helps. In fact, explicitly setting the IP address does not yield a difference. Explicitly using `dig` or `nslookup` with the router's IP address yields NXDOMAIN. On the host I want to resolve, however, `hostname` yields `my_box`.

root@Teltonika-RUT240:~# cat /tmp/resolv.conf.d/resolv.conf.auto
# Interface lan
nameserver 192.168.1.1
# Interface mob1s1a1_4
nameserver 139.7.30.125
nameserver 139.7.30.126
by anonymous
What furthermore confuses me is that under Status|Network|LAN, i don't see the hosts listed under "DHCP leases"
by anonymous

Hi,

Teltonika devices use Dnsmasq. You can find more information about it here and here. I suggest looking at the second link I have just mentioned. Specifically, take a look at the following options that can potentially resolve your issue:

  • localise_queries
  • expandhosts
  • boguspriv
  • domainneeded

The page describes what these options are for. You can change those via UCI ('uci show dhcp') or by editing the '/etc/config/dhcp' file ('vi /etc/config/dhcp').

Also, are you using the latest firmware version?

If you do not see DHCP leases for some reason, I would suggest updating the firmware with 'keep settings' disabled. If the device is running the latest FW version, then you can try the bootloader procedure as described here.

Kind Regards,

by anonymous

Hi,

thanks again. The firmware is current. Here is our configuration:

root@Teltonika-RUT240:~# cat /etc/config/dhcp

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option filterwin2k '0'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option nonegcache '0'
        option authoritative '1'
        option readethers '1'
        option leasefile '/tmp/dhcp.leases'
        option nonwildcard '1'
        option ednspacket_max '1232'
        option dhcpscript '/usr/sbin/dhcpinfo.sh'
        option logqueries '1'
        option interface 'lan'
        option localservice '0'

config dhcp 'lan'
        option interface 'lan'
        option start '100'
        option limit '150'
        option leasetime '12h'
        option relay_enabled '0'
        option force '1'

config dhcp 'wan'
        option interface 'wan'
        option ignore '1'

When I disable `boguspriv`, local name resolution starts working. Now I wonder why this behaviour is inconsistent across devices, some routers (with the same configuration, i.e, restored from the same backup) keep the DNS database across time syncs/WAN connections, some do not. Is there some volatile configuration that is not kept in a backup?

by anonymous

Hello,

It may be related to the cache (which is dynamic information, and not a part of configuration) on the RUT or the end devices themselves. If 'mybox' hostname is not in the 'hosts' file and is not learned via dhcp, likely, it will not resolve.

Dnsmasq is a forwarder and a server. When the WAN connection is active and there are no corresponding records in the '/etc/hosts' file or the hostname is not learned via DHCP, dnsmasq forwards DNS queries to the servers specified in the '/tmp/resolv.conf.d/resolv.conf.auto' file. It sends the DNS queries to the specified servers, and if a response is received, it caches common record types. Those servers are unlikely to have records for your local hostnames unless you are using your own DNS server.

Kind Regards,