Dns are too slow and doesn't solve local dns

Expected Behaviour:

RPI3
pi@RASPBERRY:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
VERSION_CODENAME=stretch
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

I user also this to have DoH:

But also after and before DoH setup, was ok, now are 2 days that i have this issue, of slow dns solve is very very slow

I setup also dns cache to zero.
Here /etc/dnsmasq.d/01-pihole.conf
cache-size=0

Actual Behaviour:

Dns are very slow to resolve in windows 10.
In first, doesn't solve local dns, i can ping 192.168.178.47 that is my firestick. But on local dns in pi hole i set up firestick4k, and ping firestick4k, say: impossible to find host....

And also with chrome, is too slow to open webpage, like also youtube.

Debug Token:

https://tricorder.pi-hole.net/n3vnu3fc73

Why?

Is Pi-hole the upstream DNS of your router? Because it advertises itself via DHCP as DNS server

   * Received 548 bytes from eth0:192.168.178.1
     Offered IP address: 192.168.178.39
     Server IP address: 192.168.178.1
     Relay-agent IP address: N/A
     BOOTP server: (empty)
     BOOTP file: (empty)
     DHCP options:
      Message type: DHCPOFFER (2)
      server-identifier: 192.168.178.1
      lease-time: 864000 ( 10d )
      renewal-time: 432000 ( 5d )
      rebinding-time: 756000 ( 8d 18h )
      netmask: 255.255.255.0
      router: 192.168.178.1
      dns-server: 192.168.178.1
      domain-name: "fritz.box"
      broadcast: 192.168.178.255
      ntp-server: 192.168.178.1
      Port Control Protocol (PCP) server: 192.168.178.1

Do you have anything accessing the gravity database?

2021-05-20 13:45:01.204 2232/T2236] ERROR: SQL query "END TRANSACTION" failed: database is locked
   [2021-05-20 13:45:01.205 2232/T2236] END TRANSACTION failed when trying to store queries to long-term database
   [2021-05-20 13:45:01.205 2232/T2236] Keeping queries in memory for later new attempt
   [2021-05-20 13:45:01.206 2232/T2236] SQLite3 message: API call with invalid database connection pointer (21)
   [2021-05-20 13:45:01.207 2232/T2236] SQLite3 message: misuse at line 125258 of [5d4c65779d] (21)
   [2021-05-20 13:45:01.207 2232/T2236] ERROR: SQL query "BEGIN TRANSACTION IMMEDIATE" failed: bad parameter or other API misuse
   [2021-05-20 13:45:01.207 2232/T2236] SQLite3 message: API call with invalid database connection pointer (21)
   [2021-05-20 13:45:01.207 2232/T2236] SQLite3 message: misuse at line 165242 of [5d4c65779d] (21)
   [2021-05-20 13:45:01.207 2232/T2236] Error while trying to close database: bad parameter or other API misuse
   [2021-05-20 13:45:01.207 2232/T2236] ERROR: Storing devices in network table ("BEGIN TRANSACTION IMMEDIATE") failed
   [2021-05-20 13:45:01.207 2232/T2236] SQLite3 message: API call with invalid database connection pointer (21)
   [2021-05-20 13:45:01.207 2232/T2236] SQLite3 message: misuse at line 165242 of [5d4c65779d] (21)
   [2021-05-20 13:45:01.207 2232/T2236] Error while trying to close database: bad parameter or other API misuse

Hi,

in first, thanks for reading and reply.

1 - I use zero dns cache because i didn't like to use cache, that maybe isn't updated. So i prefer to user zero cache for this reason.

2 - I have my router and it is a dhcp server. Is a fritz box.

But in my windows 10 machine, i use pi hole dns ( on my rpi3 ).

So i didn't use dhcp from my pihole.

3 - About gravity , i'm going to tools - update gravity, but seems that no change nothing.

I don't know if there is an access in db gravity.

I remember that in the past, i have installed mysql / mariadb, to share kodi library, between my devices. But i didn't use it now. https://kodi.wiki/view/MySQL

So there isn't any devices that trying to have access into rpi, or into mysql or mariadb.

Maybe i need to delete it? how? and is safe for pi hole?

I made another debug log:
https://tricorder.pi-hole.net/7dktjbc60i

Because i do these things:

https://www.reddit.com/r/CloudFlare/comments/dae1ez/cloudflare_dns_over_https_in_a_raspberry_pi_with/

So I change 1.1.1.1 to 1.0.0.1

And from https://pi-hole.net/2018/02/02/why-some-pages-load-slow-when-using-pi-hole-and-how-to-fix-it/#page-content

I sent these commands in sudo:

iptables -A INPUT -p tcp --destination-port 443 -j REJECT --reject-with tcp-reset
iptables -A INPUT -p udp --destination-port 80 -j REJECT --reject-with icmp-port-unreachable
iptables -A INPUT -p udp --destination-port 443 -j REJECT --reject-with icmp-port-unreachable

ip6tables -A INPUT -p tcp --destination-port 443 -j REJECT --reject-with tcp-reset
ip6tables -A INPUT -p udp --destination-port 80 -j REJECT --reject-with icmp6-port-unreachable
ip6tables -A INPUT -p udp --destination-port 443 -j REJECT --reject-with icmp6-port-unreachable

Seems that more fast, but i wish to config pi hole i the right way, and if there is errors in my log, i wish to fix them.

And anyway, local dns, can't resolve from my windows 10 machine :frowning:

Internally, Pi-hole uses dnsmasq. It will cache dns answers as long as their TTL (time-to-live) specifies. This is the time the authoritative server wants this record to be valid, before it should be queries again. So there are no outdated cache entries.

So you set it manually on your windows machine?

What is the output from this PC of

nslookup pi.hole

nslookup firestick4k

nslookup firestick4k @192.168.178.39

ipconfig /all

Yes i setup dns manually in my windows 10 machine.

C:\Users\rob>nslookup pi.hole
Server:  RASPBERRY
Address:  192.168.178.39

Nome:    pi.hole
Address:  192.168.178.39
C:\Users\rob>nslookup firestick4k
Server:  RASPBERRY
Address:  192.168.178.39

Nome:    firestick4k
Address:  192.168.178.47
C:\Users\rob>nslookup firestick4k @192.168.178.39
*** Impossibile trovare l'indirizzo server per '@192.168.178.39':
Server:  RASPBERRY
Address:  192.168.178.39

Nome:    firestick4k
Address:  192.168.178.47
C:\Users\rob>ipconfig /all

Configurazione IP di Windows

   Nome host . . . . . . . . . . . . . . : NUC-i7
   Suffisso DNS primario . . . . . . . . :
   Tipo nodo . . . . . . . . . . . . . . : Ibrido
   Routing IP abilitato. . . . . . . . . : No
   Proxy WINS abilitato . . . . . . . .  : No
   Elenco di ricerca suffissi DNS. . . . : fritz.box

Scheda Ethernet Ethernet 2:

   Stato supporto. . . . . . . . . . . . : Supporto disconnesso
   Suffisso DNS specifico per connessione:
   Descrizione . . . . . . . . . . . . . : Intel(R) I210 Gigabit Network Connection
   Indirizzo fisico. . . . . . . . . . . : AA-AA-AA-AA-AA-AA
   DHCP abilitato. . . . . . . . . . . . : Sì
   Configurazione automatica abilitata   : Sì

Scheda Ethernet Ethernet:

   Suffisso DNS specifico per connessione: fritz.box
   Descrizione . . . . . . . . . . . . . : Intel(R) Ethernet Connection (2) I219-LM
   Indirizzo fisico. . . . . . . . . . . : AA-AA-AA-AA-AA-AA
   DHCP abilitato. . . . . . . . . . . . : Sì
   Configurazione automatica abilitata   : Sì
   Indirizzo IPv6 locale rispetto al collegamento . : aa80::a354:69oe:564f:7659%20(Preferenziale)
   Indirizzo IPv4. . . . . . . . . . . . : 192.168.178.32(Preferenziale)
   Subnet mask . . . . . . . . . . . . . : 255.255.255.0
   Lease ottenuto. . . . . . . . . . . . : giovedì 20 maggio 2021 22:11:05
   Scadenza lease . . . . . . . . . . .  : domenica 30 maggio 2021 22:11:05
   Gateway predefinito . . . . . . . . . : 192.168.178.1
   Server DHCP . . . . . . . . . . . . . : 192.168.178.1
   IAID DHCPv6 . . . . . . . . . . . : 106213891
   DUID Client DHCPv6. . . . . . . . : 00-00-00-00-08-00-AA-AA-44-A2-AA-AA-AA-AA
   Server DNS . . . . . . . . . . . . .  : 192.168.178.39
   NetBIOS su TCP/IP . . . . . . . . . . : Attivato

Scheda LAN wireless Wi-Fi:

   Stato supporto. . . . . . . . . . . . : Supporto disconnesso
   Suffisso DNS specifico per connessione:
   Descrizione . . . . . . . . . . . . . : Intel(R) Dual Band Wireless-AC 8265
   Indirizzo fisico. . . . . . . . . . . : AA-AA-AA-AA-AA-AA
   DHCP abilitato. . . . . . . . . . . . : Sì
   Configurazione automatica abilitata   : Sì

Scheda LAN wireless Connessione alla rete locale (LAN)* 1:

   Stato supporto. . . . . . . . . . . . : Supporto disconnesso
   Suffisso DNS specifico per connessione:
   Descrizione . . . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter
   Indirizzo fisico. . . . . . . . . . . : AA-AA-AA-AA-AA-AA
   DHCP abilitato. . . . . . . . . . . . : Sì
   Configurazione automatica abilitata   : Sì

Scheda LAN wireless Connessione alla rete locale (LAN)* 2:

   Stato supporto. . . . . . . . . . . . : Supporto disconnesso
   Suffisso DNS specifico per connessione:
   Descrizione . . . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter #2
   Indirizzo fisico. . . . . . . . . . . : AA-AA-AA-AA-AA-AA
   DHCP abilitato. . . . . . . . . . . . : No
   Configurazione automatica abilitata   : Sì

Scheda Ethernet VMware Network Adapter VMnet1:

   Suffisso DNS specifico per connessione:
   Descrizione . . . . . . . . . . . . . : VMware Virtual Ethernet Adapter for VMnet1
   Indirizzo fisico. . . . . . . . . . . : AA-AA-AA-AA-AA-AA
   DHCP abilitato. . . . . . . . . . . . : Sì
   Configurazione automatica abilitata   : Sì
   Indirizzo IPv6 locale rispetto al collegamento . : fe80::f157:37fd:e900:98b6%6(Preferenziale)
   Indirizzo IPv4. . . . . . . . . . . . : 192.168.204.1(Preferenziale)
   Subnet mask . . . . . . . . . . . . . : 255.255.255.0
   Lease ottenuto. . . . . . . . . . . . : giovedì 20 maggio 2021 22:11:10
   Scadenza lease . . . . . . . . . . .  : giovedì 20 maggio 2021 22:41:08
   Gateway predefinito . . . . . . . . . :
   Server DHCP . . . . . . . . . . . . . : 192.168.204.254
   IAID DHCPv6 . . . . . . . . . . . : 754995286
   DUID Client DHCPv6. . . . . . . . : 00-01-00-01-28-17-AC-AD-54-B2-03-18-A9-2D
   Server DNS . . . . . . . . . . . . .  : fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
   NetBIOS su TCP/IP . . . . . . . . . . : Attivato

Scheda Ethernet VMware Network Adapter VMnet8:

   Suffisso DNS specifico per connessione:
   Descrizione . . . . . . . . . . . . . : VMware Virtual Ethernet Adapter for VMnet8
   Indirizzo fisico. . . . . . . . . . . : AA-AA-AA-AA-AA-AA
   DHCP abilitato. . . . . . . . . . . . : Sì
   Configurazione automatica abilitata   : Sì
   Indirizzo IPv6 locale rispetto al collegamento . : fe80::54bc:5e2a:8a85:ae53%8(Preferenziale)
   Indirizzo IPv4. . . . . . . . . . . . : 192.168.86.1(Preferenziale)
   Subnet mask . . . . . . . . . . . . . : 255.255.255.0
   Lease ottenuto. . . . . . . . . . . . : giovedì 20 maggio 2021 22:11:10
   Scadenza lease . . . . . . . . . . .  : giovedì 20 maggio 2021 22:41:08
   Gateway predefinito . . . . . . . . . :
   Server DHCP . . . . . . . . . . . . . : 192.168.86.254
   IAID DHCPv6 . . . . . . . . . . . : 771772502
   DUID Client DHCPv6. . . . . . . . : 00-01-00-01-28-17-AC-AD-54-B2-03-18-A9-2D
   Server DNS . . . . . . . . . . . . .  : fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
   Server WINS primario . . . . . . . .  : 192.168.86.2
   NetBIOS su TCP/IP . . . . . . . . . . : Attivato

Scheda Ethernet Connessione di rete Bluetooth:

   Stato supporto. . . . . . . . . . . . : Supporto disconnesso
   Suffisso DNS specifico per connessione:
   Descrizione . . . . . . . . . . . . . : Bluetooth Device (Personal Area Network)
   Indirizzo fisico. . . . . . . . . . . : AA-AA-AA-AA-AA-AA
   DHCP abilitato. . . . . . . . . . . . : Sì
   Configurazione automatica abilitata   : Sì

This is the wrong format for this command. It should be

nslookup firestick4k 192.168.178.39

This shows that Pi-hole knows the IP for firestick 4k. Please try again to ping..


There are no other DNS servers configured at your PC, that's good.


Have a look here, how to distribute Pihole's IP via DHCP and save you from the need to manually configure it for all your clients.

No success for me.
i can't resolve:

ping firestick4k is impossible to solve host.

I didn't try to distribute pihole dns server via DHCP for now.
But i guess that isn't the problem.
Maybe fritzbox, block some things ?

And also about my last log, you see db error like my first debug log ?
https://tricorder.pi-hole.net/7dktjbc60i

C:\Users\rob>nslookup firestick4k 192.168.178.39
Server: RASPBERRY
Address: 192.168.178.39

Nome: firestick4k
Address: 192.168.178.47

But no luck, i can't ping it, so i must use 192.168... and not hostname.

No not anymore (But it is only a short snippet). You can check /var/log/pihole-FTL.log manually.


When you ping the hostname, do you see the query in Pi-hole's query log?

Add

Can you please post the output of

ping 192.168.178.47

When you ping the hostname, do you see the query in Pi-hole's query log?
Yes, i can see it and i guess is wrong, because there is fritz.box so maybe fritz box have something that block:

2021-05-21 21:30:31 A firestick4k.fritz.box 192.168.178.32 OK (forwarded to localhost#5053) NXDOMAIN (1.9ms)

Can you please post the output of
ping 192.168.178.47

Yes, this is from my windows 10 machine, with pihole dns. ( and i can ping ip of my firestick as you can see )

C:\Users\rob>ping 192.168.178.47

Esecuzione di Ping 192.168.178.47 con 32 byte di dati:
Risposta da 192.168.178.47: byte=32 durata<1ms TTL=64
Risposta da 192.168.178.47: byte=32 durata<1ms TTL=64
Risposta da 192.168.178.47: byte=32 durata<1ms TTL=64
Risposta da 192.168.178.47: byte=32 durata<1ms TTL=64

Statistiche Ping per 192.168.178.47:
Pacchetti: Trasmessi = 4, Ricevuti = 4,
Persi = 0 (0% persi),
Tempo approssimativo percorsi andata/ritorno in millisecondi:
Minimo = 0ms, Massimo = 0ms, Medio = 0ms

note. today I also install PiVPN with wireguard split tunneling, so i can use 2 profiles, one of them with full traffic, and another, with only dns. And works like a charm ! Only some things, like this local dns, not works for me, but i guess is fritz box and not pihole. Unfortunately i don't know where is the issue, of course.

It's ping.

It queries firestick4k.fritz.box and not firestick4k

Try ping firestick4k.

See

no way

but ping firestick4k. ( with dot at the end, works )

is windows...