DNS lookups in Realtime Graphs

Hello,
I also have this issue with unable to display dns lookups in realtime graphs (19.07)
I tried to add 127.0.0.1 for wan. But still unable to resolve ips in the graphs.
Have you managed to find another workaround or solution?

You need a real DNS server. Where is it set?

1 Like

Have two dnsmasqs, both for serving lan.

One in /etc/config/dhcp for lo, and eth0 (192.168.2.1)

config dnsmasq
        option domainneeded '1'
        option boguspriv '1'
        option localise_queries '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option local '/lan/'
        option domain 'lan'
        option expandhosts '1'
        option authoritative '1'
        option readethers '1'
        option localservice '1'
        option nonwildcard '1'
        option strictorder '1'
        option confdir '/tmp/dnsmasq.d'
        option leasefile '/tmp/dhcp.leases'
        option resolvfile '/tmp/resolv.conf.auto'
        list server '208.67.222.222'
        list server '208.67.220.220'
        list interface 'eth0'
        option cachesize '1500'

And one additinal on eth0:2 (192.168.2.2) via /etc/dnsmasq2.conf

domain-needed
strict-order
localise-queries
read-ethers
enable-ubus
expand-hosts
bind-dynamic
local-service
resolv-file=/etc/resolv.conf
stop-dns-rebind
rebind-localhost-ok
addn-hosts=/tmp/hosts
conf-dir=/tmp/dnsmasq.d
user=dnsmasq
group=dnsmasq

conf-file=/usr/share/dnsmasq/dhcpbogushostname.conf

bogus-priv
conf-file=/usr/share/dnsmasq/rfc6761.conf

rebind-domain-ok=lan
domain=lan
server=/lan/127.0.0.1
server=/in-addr.arpa/127.0.0.1
server=64.6.64.6
server=8.8.4.4
server=8.8.8.8
server=1.0.0.1
server=1.1.1.1

bind-dynamic
interface=eth0:2
except-interface=lo
cache-size=1500
except-interface=lo

It appears you have excluded loopback interface in your "DHCP and DNS" configuration. Hence, "adding 127.0.0.1" didn't work for you.

First, check what interfaces has DNS server listening on and then, add the corresponding ip addresses of those interfaces in your WAN's customer dns servers.

Good luck!

1 Like

It is excluded for the second instance of dnamasq. For the first instance, it is not excluded and it is listening on 127.0.0.1.

Run the following command on your openwrt device and paste the output here.

nslookup www.google.com

Also, paste the contents of /etc/resolve.conf file.

Here is output:

root@OpenWrt:~# nslookup www.google.com
Server:         127.0.0.1
Address:        127.0.0.1#53

Non-authoritative answer:
Name:   www.google.com
Address: 172.217.169.164
Name:   www.google.com
Address: 2a00:1450:4017:80a::2004

root@OpenWrt:~# cat /etc/resolv.conf
search lan
nameserver 127.0.0.1

LuCI > Status > Realtime Graphs > Connections > Enable DNS lookups

However, note that rDNS relies on PTR records.
This means rDNS often fails since many IPs have no PTR.

https://en.wikipedia.org/wiki/Reverse_DNS_lookup

1 Like

that is true, but at least the local source address 192.168.2.XX (here in the screenshot) can be resolved.

root@OpenWrt:~# nslookup 192.168.2.22
22.2.168.192.in-addr.arpa       name = yovopc.lan.

root@OpenWrt:~# nslookup 192.168.2.51
51.2.168.192.in-addr.arpa       name = sc.lan.

1 Like

That's weird, collect the diagnostics:

ubus call system board; uci show dhcp; \
pgrep -f -a dnsmasq; netstat -l -n -p | grep -e dnsmasq; \
head -v -n -0 /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/*
1 Like

Here is the output of each.
I skipped most of the static hosts in uci show dhcp output in order to make it shorter...

root@OpenWrt:~# ubus call system board
{
        "kernel": "4.14.221",
        "hostname": "OpenWrt",
        "system": "AMD GX-412TC SOC",
        "model": "PC Engines apu2",
        "board_name": "pc-engines-apu2",
        "release": {
                "distribution": "OpenWrt",
                "version": "19.07.7",
                "revision": "r11306-c4a6851c72",
                "target": "x86/64",
                "description": "OpenWrt 19.07.7 r11306-c4a6851c72"
        }
}

root@OpenWrt:~# uci show dhcp
dhcp.odhcpd=odhcpd
dhcp.odhcpd.maindhcp='0'
dhcp.odhcpd.leasefile='/tmp/hosts/odhcpd'
dhcp.odhcpd.leasetrigger='/usr/sbin/odhcpd-update'
dhcp.odhcpd.loglevel='4'
dhcp.@dnsmasq[0]=dnsmasq
dhcp.@dnsmasq[0].domainneeded='1'
dhcp.@dnsmasq[0].boguspriv='1'
dhcp.@dnsmasq[0].localise_queries='1'
dhcp.@dnsmasq[0].rebind_protection='1'
dhcp.@dnsmasq[0].rebind_localhost='1'
dhcp.@dnsmasq[0].local='/lan/'
dhcp.@dnsmasq[0].domain='lan'
dhcp.@dnsmasq[0].expandhosts='1'
dhcp.@dnsmasq[0].authoritative='1'
dhcp.@dnsmasq[0].readethers='1'
dhcp.@dnsmasq[0].localservice='1'
dhcp.@dnsmasq[0].nonwildcard='1'
dhcp.@dnsmasq[0].strictorder='1'
dhcp.@dnsmasq[0].confdir='/tmp/dnsmasq.d'
dhcp.@dnsmasq[0].leasefile='/tmp/dhcp.leases'
dhcp.@dnsmasq[0].resolvfile='/tmp/resolv.conf.auto'
dhcp.@dnsmasq[0].server='208.67.222.222' '208.67.220.220'
dhcp.@dnsmasq[0].interface='eth0'
dhcp.@dnsmasq[0].cachesize='1500'
dhcp.lan=dhcp
dhcp.lan.interface='lan'
dhcp.lan.start='101'
dhcp.lan.limit='40'
dhcp.lan.leasetime='1h'
dhcp.wan=dhcp
dhcp.wan.interface='wan'
dhcp.wan.ignore='1'
dhcp.tag_dns_2=tag
dhcp.tag_dns_2.dhcp_option='6,192.168.2.2'
dhcp.@domain[0]=domain
dhcp.@domain[0].name='OpenWrt2'
dhcp.@domain[0].ip='192.168.2.2'
dhcp.@domain[1]=domain
dhcp.@domain[1].name='router'
dhcp.@domain[1].ip='192.168.2.1'
dhcp.@host[0]=host
dhcp.@host[0].mac='40:3F:8C:78:23:81'
dhcp.@host[0].dns='1'
dhcp.@host[0].name='tplink'
dhcp.@host[0].ip='192.168.2.11'
...
dhcp.@host[4]=host
dhcp.@host[4].mac='00:D8:61:C5:85:F7'
dhcp.@host[4].dns='1'
dhcp.@host[4].name='geopc'
dhcp.@host[4].ip='192.168.2.21'
dhcp.@host[4].tag='tag_dns_2'


root@OpenWrt:~# pgrep -f -a dnsmasq
3230 /usr/sbin/dnsmasq -C /etc/dnsmasq2.conf -x /var/run/dnsmasq2.pid
26705 /usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf.cfg02411c -k -x /var/run/dnsmasq/dnsmasq.cfg02411c.pid

root@OpenWrt:~# netstat -l -n -p | grep -e dnsmasq
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      26705/dnsmasq
tcp        0      0 192.168.2.1:53          0.0.0.0:*               LISTEN      26705/dnsmasq
tcp        0      0 192.168.2.2:53          0.0.0.0:*               LISTEN      3230/dnsmasq
udp        0      0 127.0.0.1:53            0.0.0.0:*                           26705/dnsmasq
udp        0      0 192.168.2.1:53          0.0.0.0:*                           26705/dnsmasq
udp        0      0 192.168.2.2:53          0.0.0.0:*                           3230/dnsmasq
udp        0      0 0.0.0.0:67              0.0.0.0:*                           26705/dnsmasq

root@OpenWrt:~# head -v -n -0 /etc/resolv.* /tmp/resolv.* /tmp/resolv.*/*
==> /etc/resolv.conf <==
search lan
nameserver 127.0.0.1

==> /tmp/resolv.conf <==
search lan
nameserver 127.0.0.1

==> /tmp/resolv.conf.auto <==
# Interface wan
nameserver 127.0.0.1
head: /tmp/resolv.*/*: No such file or directory

1 Like

Set up upstream resolvers like this:

uci -q delete dhcp.@dnsmasq[0].interface
uci -q delete dhcp.@dnsmasq[0].server
uci -q delete dhcp.@dnsmasq[0].strictorder
uci commit dhcp
/etc/init.d/dnsmasq restart

uci -q delete network.wan.dns
uci add_list network.wan.dns="208.67.222.222"
uci add_list network.wan.dns="208.67.220.220"
uci commit network
/etc/init.d/network restart

See also: Resolve LAN addresses - #6 by vgaetera

1 Like

Thanks,
But still no resolve in connections status window. And I lost my second dnsmasq, because the first has bound to all interfaces.

I also added domain setting for the hosts with static leases, but it did not help too.

1 Like

Enable DNS query logging and see what happens when you open the problematic LuCI page:
https://openwrt.org/docs/guide-user/base-system/dhcp_configuration#logging_dns_queries

1 Like

Enabled. In the log mostly A queries from other clients, but not a single PTR query from the router itself.
...

Mar 18 12:05:13 dnsmasq[8215]: 72 192.168.2.46/41284 query[A] inbox.google.com from 192.168.2.46
Mar 18 12:05:13 dnsmasq[8215]: 72 192.168.2.46/41284 forwarded inbox.google.com to 208.67.220.220
Mar 18 12:05:13 dnsmasq[8215]: 73 192.168.2.46/42548 query[A] clients4.google.com from 192.168.2.46
Mar 18 12:05:13 dnsmasq[8215]: 73 192.168.2.46/42548 cached clients4.google.com is <CNAME>
Mar 18 12:05:13 dnsmasq[8215]: 73 192.168.2.46/42548 cached clients.l.google.com is 172.217.17.206
Mar 18 12:05:13 dnsmasq[8215]: 72 192.168.2.46/41284 reply inbox.google.com is 172.217.17.165
Mar 18 12:05:16 dnsmasq[8215]: 74 192.168.2.46/38092 query[A] peoplestack-pa.googleapis.com from 192.168.2.46
Mar 18 12:05:16 dnsmasq[8215]: 74 192.168.2.46/38092 forwarded peoplestack-pa.googleapis.com to 208.67.220.2

That probably explains why I do not see the names in the status. The button "Enable DNS lookups" in luci actually does nothing.

1 Like

Why is this Dnsmasq instance not listening on the IPv6 localhost socket?
I'm afraid the local system resolver may prefer IPv6 over IPv4.

2 Likes

Hey that was the reason :slight_smile:
Thank you very much for pointing me to that.
I had option ipv6 '0' under loopback interface in /etc/config/network. Removed it and now it is working.

1 Like

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.

2 Likes

I am not the original poster, I cannot edit or mark solution.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.