Adguard and local dns

Hi,
I installed asguard using this tutorial.. I copied the script that configure dnsmasq and run it on router.
Oke, I set up adguard, it is running and everything is fine.. but
My dns lookup doesnt work from a ssh terminal on router nor I can ping any host except local.
If I do

root@OpenWrt:~# nslookup google.com
nslookup: write to '127.0.0.1': Connection refused
nslookup: write to '::1': Connection refused
;; connection timed out; no servers could be reached

This is because, as i understand, loopback is listening on 127.0.0.1:54
There it is

root@OpenWrt:~# netstat -tunlp | grep 54
tcp        0      0 192.168.100.9:54        0.0.0.0:*               LISTEN      2792/dnsmasq
tcp        0      0 127.0.0.1:54            0.0.0.0:*               LISTEN      2792/dnsmasq
tcp        0      0 192.168.8.1:54          0.0.0.0:*               LISTEN      2792/dnsmasq
tcp        0      0 fe80::9683:c4ff:fea2:b315:54 :::*                    LISTEN      2792/dnsmasq
tcp        0      0 ::1:54                  :::*                    LISTEN      2792/dnsmasq
tcp        0      0 fd7f:ca86:a163::1:54    :::*                    LISTEN      2792/dnsmasq
tcp        0      0 fe80::7451:8fff:fe74:6649:54 :::*                    LISTEN      2792/dnsmasq
tcp        0      0 fe80::9683:c4ff:fea2:b317:54 :::*                    LISTEN      2792/dnsmasq
tcp        0      0 fe80::9683:c4ff:fea2:b316:54 :::*                    LISTEN      2792/dnsmasq
tcp        0      0 fe80::9683:c4ff:fea2:b313:54 :::*                    LISTEN      2792/dnsmasq
udp        0      0 192.168.100.9:54        0.0.0.0:*                           2792/dnsmasq
udp        0      0 127.0.0.1:54            0.0.0.0:*                           2792/dnsmasq
udp        0      0 192.168.8.1:54          0.0.0.0:*                           2792/dnsmasq
udp        0      0 fe80::9683:c4ff:fea2:b317:54 :::*                                2792/dnsmasq
udp        0      0 fe80::9683:c4ff:fea2:b313:54 :::*                                2792/dnsmasq
udp        0      0 ::1:54                  :::*                                2792/dnsmasq
udp        0      0 fe80::7451:8fff:fe74:6649:54 :::*                                2792/dnsmasq
udp        0      0 fd7f:ca86:a163::1:54    :::*                                2792/dnsmasq
udp        0      0 fe80::9683:c4ff:fea2:b315:54 :::*                                2792/dnsmasq
udp        0      0 fe80::9683:c4ff:fea2:b316:54 :::*                                2792/dnsmasq
udp        0      0 :::546                  :::*                                2731/odhcp6c
udp        0      0 :::547                  :::*                                1710/odhcpd

or dns

root@OpenWrt:~# netstat -tunlp | grep 53
tcp        0      0 192.168.8.1:53          0.0.0.0:*               LISTEN      2300/AdGuardHome
udp        0      0 192.168.8.1:53          0.0.0.0:*                           2300/AdGuardHome

This is my /etc/resolv.conf file

search lan
nameserver 127.0.0.1
nameserver ::1

If I add nameserver 192.168.8.1 to my resolv.conf file resolving is working.
I'm struggling how to solve that problem. Can anyone help?

1 Like

I tried to add 127.0.0.1 but it wasnt working. The problem was probably because adguard wasnt starting on boot. I fixed that using your solution and adguard is starting on boot.
I rebooted now and everything is working. Thank you.
If someone bump on this scratching his head this is what I done.
Service should probably be stopped prior this but I didnt do it.

cd /etc/init.d and edit adguardhome to this

# starts just after network starts to avoid some network race conditions
START=99
# stops before networking stops
STOP=89

cd /etc/rc.d

mv S25adguardhome S99adguardhome

cd /etc and edit adguardhome.yaml and add

dns:
  bind_hosts:
    - 127.0.0.1
    - 192.168.8.1

Reboot router.

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