PiHole falls off network after reboot

Hi,

I've had this problem since PiHole 4 and I was wondering if there was a solution.

I have a Velop router (consumer grade) which my RPi4 connects to via ethernet. I run unbound on the Pi as well as PiHole (also WireGuard but I don't think that has anything to do with this). PiHole is also my DHCP server. If I ever reboot the RPi4, it disappears from my network. As in no SSH, no PiHole web access, no pings, nada. As if it's physically unplugged. Obviously, the whole house then loses internet connectivity. The only way to fix this is to turn on the router's DHCP server, wait a while and then my RPi4 re-appears. Then I have to turn the router's DHCP server off again. Everything works fine until I reboot again (which I try to avoid).

What could be causing this?

The obvious thing would be that the RPi isnt configured with a static IP and still depends on DHCP to acquire an IP:

pi@ph5:~ $ tail /etc/dhcpcd.conf
[..]
interface eth0
  static ip_address=10.0.0.4/24
  static routers=10.0.0.1
  static domain_name_servers=10.0.0.1

pi@ph5:~ $ ip -4 -br address show eth0
eth0             UP             10.0.0.4/24

pi@ph5:~ $ journalctl | grep eth0 | tail
[..]
May 17 00:07:31 ph5.dehakkelaar.nl dhcpcd[8185]: eth0: removing interface
May 17 00:07:32 ph5.dehakkelaar.nl dhcpcd[8509]: eth0: IAID xx:xx:xx:xx
May 17 00:07:32 ph5.dehakkelaar.nl dhcpcd[8509]: eth0: using static address 10.0.0.4/24
May 17 00:07:32 ph5.dehakkelaar.nl dhcpcd[8509]: eth0: adding route to 10.0.0.0/24
May 17 00:07:32 ph5.dehakkelaar.nl dhcpcd[8509]: eth0: adding default route via 10.0.0.1
May 17 00:07:32 ph5.dehakkelaar.nl dhcpcd[8556]: eth0: soliciting an IPv6 router
May 17 00:07:44 ph5.dehakkelaar.nl dhcpcd[8556]: eth0: no IPv6 Routers available

Upload a debug token so the mods/devs can have closer look ?

I think that the PiHole has a static IP address. Anyway, here's my debug token:

https://tricorder.pi-hole.net/7pfo5mkkdv

The debug log is normal.

Whats that about assumptions being the mother of something :wink:
What does below three output for you ?

pi@raspberrypi4:~ $ tail /etc/dhcpcd.conf

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

interface eth0
static routers=192.168.0.1
static domain_name_servers=127.0.0.1
inform 192.168.0.222/24
static ip6_address=2403:5800:7101:f00:xxxx:xxxx:xxxx:xxxx

pi@raspberrypi4:~ $ ip -4 -br address show eth0
eth0             UP             192.168.0.222/24 

pi@raspberrypi4:~ $ journalctl | grep eth0 | tail
May 22 10:55:01 raspberrypi4 dhcpcd[466]: eth0: Router Advertisement from fe80::5aef:68ff:fe2f:b2f6
May 22 10:55:01 raspberrypi4 dhcpcd[466]: eth0: adding address 2403:5800:7101:f00:xxxx:xxxx:xxxx:xxxx/64
May 22 10:55:28 raspberrypi4 dhcpcd[466]: eth0: Router Advertisement from fe80::5aef:68ff:fe2f:b2f6
May 22 10:55:28 raspberrypi4 dhcpcd[466]: eth0: adding address 2403:5800:7101:f00:xxxx:xxxx:xxxx:xxxx/64
May 22 10:56:10 raspberrypi4 dhcpcd[466]: eth0: Router Advertisement from fe80::5aef:68ff:fe2f:b2f6
May 22 10:56:10 raspberrypi4 dhcpcd[466]: eth0: adding address 2403:5800:7101:f00:xxxx:xxxx:xxxx:xxxx/64
May 22 10:56:49 raspberrypi4 dhcpcd[466]: eth0: Router Advertisement from fe80::5aef:68ff:fe2f:b2f6
May 22 10:56:49 raspberrypi4 dhcpcd[466]: eth0: adding address 2403:5800:7101:f00:xxxx:xxxx:xxxx:xxxx/64
May 22 10:58:33 raspberrypi4 dhcpcd[466]: eth0: Router Advertisement from fe80::5aef:68ff:fe2f:b2f6
May 22 10:58:33 raspberrypi4 dhcpcd[466]: eth0: adding address 2403:5800:7101:f00:xxxx:xxxx:xxxx:xxxx/64

Above is DHCP:

pi@ph5:~ $ man dhcpcd5
[..]
     -s, --inform address[/cidr[/broadcast_address]]
             Behaves like -r, --request as above, but sends a DHCP IN‐
             FORM instead of DISCOVER/REQUEST.  This does not get a
             lease as such, just notifies the DHCP server of the
             address in use.  You should also include the optional
             cidr network number in case the address is not already
             configured on the interface.  dhcpcd remains running and
             pretends it has an infinite lease.  dhcpcd will not de-
             configure the interface when it exits.  If dhcpcd fails
             to contact a DHCP server then it returns a failure in‐
             stead of falling back on IPv4LL.

Replace that line with below:

static ip_address=192.168.0.222/24

And restart to apply:

sudo service dhcpcd restart

EDIT:

Ow ps, I wouldnt recommend using IPv6 as it complicates matters.
Disable anything IPv6 related on the LAN side of the router settings as well as on Pi-hole.

Why is that? Shouldn't we be moving to IPv6? Is Pi-Hole not compatible with IPv6?

Using IPv6 you need a good understanding of IPv6 which most of the users, including me, just dont have.
Setup is more complicated.
Wrong mistake and your devices are accessible from the internet by anyone.
If not plugged IPv6 properly, ads/blocked domains still leak through.

EDIT: Ow ps, I believe Pi-hole fully supports IPv6.
Also see here:

1 Like

The title of your post is " PiHole falls off network after reboot", but it appears that the problem is not with Pi-hole (software), but rather with the underlying OS or device. On boot, that device has to connect to the network, at which point Pi-hole can operate.

Given that your debug log is normal, there is no obvious problem with Pi-hole.

You may find a better source for the connectivity problem is a Pi forum.

Hi again. I found setup relatively simple (to get it to work) and I made sure the recommended firewalls on the router were on to make sure that people can't just access my PiHole (or other IPv6 devices) from anywhere. My IPv6 prefix is also fixed so I don't need to worry about the slow loading etc from random IP changes. I am sure with your knowledge you could make sure your IPv6 deployment is secure. Just remember that NAT feels safer but really isn't.

In any case, thank you for your help, the static IP did the trick, I'm not sure why that line became "inform", all my other Pis have "static". Weird.

1 Like

Sure. I thought it may have been related to Pi-Hole being the DHCP server, hence I posted here. Anyway, problem is solved, thank you.

One note from your debug log. Your DHCP IP range overlaps the static IP of the Pi. This is not likely to cause a problem, but to be certain it will not you could change the upper end of the IP range on the Pi-hole DHCP server to something less than 222.

Spoke too soon. It seemed to work well after one reboot, now it's back to its old tricks! What a pain.

Might below have been altered again by some software ?

tail /etc/dhcpcd.conf

Check the logs what happened at time of reboot:

grep eth0 /var/log/daemon.log*

Or:

grep dhcpcd /var/log/daemon.log*

Is it only IPv4 connectivity issue or also when trying the IPv6 address ?

Hi again. It's a huge log file, I'm not sure how to interpret it. I lose all connectivity when I reboot.

Check your watch, reboot to get disconnected, restore connectivity and check logs just after the reboot was executed.
You already have an example how should look like for IPv4:

Old tricks like in you have to enable DHCP service on the router again to get connectivity back ?
This would indicate the host is still somehow configured as a DHCP client.
Did you check below ?

It might be that you have another network manager running alongside dhcpcd5.
Below some that I know of:

sudo service network-manager status

sudo service connman status

sudo service systemd-networkd status

sudo which netplan

Also you can still connect keyboard video to see what goes wrong.

Hi. There don't seem to be any other services running along dhcpcd5. I'll try to look at the log again when I can (family around at the moment, they'll get annoyed if I disconnect them right now). Thank you.

Ok, so I think I figured it out (with your help). My dhcpcd.conf file had a space after the "=" sign in "static ip_address=192.168.0.222/24". Once I removed that, I can reboot repeatedly and the Pi comes back. Thanks for your help.

1 Like

I believe I'm debit to that mistake.
When I first copy/pasted your IP into that static line, a space sneaked in between.
I corrected that maybe within a minute but probably too late for you to have copied it already :smiley:
Nice you got it sorted.