Devices randomly stop being able to access internet

Please follow the below template, it will help us to help you!

Expected Behaviour:

OS: Debian 11 (Bullseye)
HW: Raspberry Pi 3B+
Using router as DHCP server and pihole for DNS.
Connected to proper power source.

All devices should be able to resolve DNS to access the internet without random connection "drops".

Actual Behaviour:

At random devices on my network will stop being able to access the internet (for example, Android devices show "connected but without internet" or "connected, no internet"). I suspect this is a DNS resolution problem as devices stay connected to the network and can ping other devices by IP address but not using hostnames (e.g. pi.hole). As far as I can tell this happens at random intervals and doesn't affect all devices at once (e.g. PC works fine but phone is affected). I have checked the query log and it doesn't show any blocked requests when this happens either. This issue appears to be resolved by disabling pihole and using another DNS which leads me to believe that this is a pihole issue.

I found this post which describes something like my issue however nothing from that thread helped solve the issue.

Debug Token:

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

I wiped the pi's SD card to reinstall the OS and pihole in hopes it would solve the issue but the issue persists. Here is another debug log from the new system taken while the issue was happening on a device.

Disable the DHCP server and manually assign devices.

This debug log shows that Pi-hole is working normally:

*** [ DIAGNOSING ]: Name resolution (IPv4) using a random blocked domain and a known ad-serving domain
[✓] www.fundacja-pomoc.eu is 0.0.0.0 on lo (127.0.0.1)
[✓] No IPv4 address available on eth0
[✓] www.fundacja-pomoc.eu is 0.0.0.0 on wlan0 (192.168.1.29)
[✓] doubleclick.com is 216.58.212.206 via a remote, public DNS server (8.8.8.8)

Your router is providing the correct DNS server to clients:

     DHCP options:
      Message type: DHCPOFFER (2)
      server-identifier: 192.168.1.1
      lease-time: 86400 ( 1d )
      netmask: 255.255.255.0
      router: 192.168.1.1
      dns-server: 192.168.1.29
      dns-server: 192.168.1.29
      renewal-time: 43200 ( 12h )
      rebinding-time: 75600 ( 21h )
      broadcast: 192.168.1.255
         domain-name: "lan"
      --- end of options ---
    
   DHCP packets received on interface wlan0: 1
   DHCP packets received on interface lo: 0
   DHCP packets received on interface eth0: 0

There are a few database errors in your debug log - are you running any software that will interact with this database (gravity synch, scripts to inject domains or adlists, etc.)?

-rw-r--r-- 1 pihole pihole 52K Aug 28 06:00 /var/log/pihole/FTL.log
   -----head of FTL.log------
   [2022-08-28 00:00:03.876 12588M] SQLite3 message: database is locked in "SELECT hwaddr FROM network WHERE id = (SELECT network_id FROM network_addresses WHERE ip = ? GROUP BY ip HAVING max(lastSeen));" (5)
   [2022-08-28 00:00:03.876 12588M] getMACfromIP("192.168.1.11") - SQL error prepare: database is locked
   [2022-08-28 00:00:52.753 12588M] Gravity database is busy (whitelist)
   [2022-08-28 00:00:52.753 12588M] Gravity database is busy (blacklist)
   [2022-08-28 00:00:52.753 12588M] Gravity database is busy (gravity)

What is the output of the following:

sudo sqlite3 gravity.db "PRAGMA integrity_check"

Another possibility, since your Pi is connected via WiFi, is the WiFi interface sleeping. You have an available ethernet port on the device - if you can connect the device to your LAN via ethernet this will be more reliable.

I have not installed any software, this was from a clean install of the OS. The only software installed was the pihole software which was installed following the official installation instructions. I believe the gravity database appears busy in the log because I was importing adlists/whitelists/blacklists at that time after reinstalling the pi's OS and pihole.

Here is the output of the command:

pi@raspberrypi:~ $ sudo sqlite3 gravity.db "PRAGMA integrity_check"
ok

If this was the case then surely all devices using the pihole for DNS would fail to resolve DNS at the same time? This issue affects all devices but at different (random) times.

I may not be able to test if using ethernet would resolve the issue as there are no free power outlets near my router to power the pi. I also cannot move the router to a better location.

Thanks for the response!

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