No Internet connection if the router is not ready during startup

Hello all,
I have a question about my piHole, which I am running on a RaspiPi 1.
I have the problem that my Raspi has no internet connection when I start the Pi and the router is not fully started (or not yet fully booted).
I.e. if I have a power failure and both my router (FritzBox) and my Pi reboot at the same time, my Pi has no internet connection because the router takes 1 minute to become fully functional. So I have to reboot my Pi whenever the router is functional.

Unfortunately, I am a typical Windows user without any experience with Linux :/.

Is there a script or command I can run where after 5 minutes after startup my Pi checks if the internet connection is working and if not, it should reboot or at least disable and re-enable the Lan connection to get the internet connection working properly.

Does anyone else have this problem? I have reinstalled the software on my Pi several times but the problem is still there.

I am really looking forward to some experienced Linux users :slight_smile: I hope you guys can understand my problem and help me.

Thanks a lot in advance!

Fox-Jet

Does this setting help? In /etc/pihole/pihole-FTL.conf

DELAY_STARTUP=0

During startup, in some configurations, network interfaces appear only late during system startup and are not ready when FTL tries to bind to them. Therefore, you may want FTL to wait a given amount of time before trying to start the DNS revolver. This setting takes any integer value between 0 and 300 seconds.

This sounds like your Pi device gets its IP from your router via DHCP instead of having a static IP. And while the router boots and DHCP is not available, your Pi is auto-configuring to use a fallback IP address (IPv4LL).

Did you configure your Pi device with a static IP address (not fixed DHCP assignment)?

During installation pihole gives itself a static IP which I accepted, I kept the router as DHCP server. After installing pihole I set the IP address of pihole outside the DHCP range of the router and set it to fixed "Always use this address", so the router gives pihole the same IP every time.

How can I see what IP my Raspi is using if it doesn't get the selected IP from the router? (If the router is not ready when the pihole starts up)

Fox-Jet

This is a useful freeware utility to have on Windows. It shows all the devices, with IPs and other details, on your network (wireless or wired).

On Linux or Mac with Nmap installed use the command below, adjust the 192.168.1 part to match your network.

nmap -sn 192.168.1.0/24

When my router is online i know which Ip it has, but when my pi start at the same time as my router does, i can‘t see the device in my Router. Or do I? Hmm…let me check that…

In below example you can see my Pi "using static address 10.0.0.4/24":

pi@ph5b:~ $ journalctl -b --no-pager --full -u dhcpcd
-- Journal begins at Sat 2021-10-30 13:29:42 CEST, ends at Wed 2022-10-26 20:20:25 CEST. --
Sep 12 04:58:09 ph5b systemd[1]: Starting DHCP Client Daemon...
Sep 12 04:58:09 ph5b dhcpcd[255]: dev: loaded udev
Sep 12 04:58:12 ph5b dhcpcd[255]: eth0: waiting for carrier
Sep 12 04:58:13 ph5b dhcpcd[255]: eth0: waiting for carrier
Sep 12 04:58:14 ph5b dhcpcd[255]: eth0: carrier acquired
Sep 12 04:58:14 ph5b dhcpcd[255]: DUID 00:01:00:01:29:XX:XX:XX:XX:XX:XX:XX:XX:XX
Sep 12 04:58:14 ph5b dhcpcd[255]: eth0: IAID eb:81:XX:XX
Sep 12 04:58:14 ph5b dhcpcd[255]: eth0: adding address fe80::22e5:XX:XX:XX
Sep 12 04:58:14 ph5b dhcpcd[255]: eth0: probing address 10.0.0.4/24
Sep 12 04:58:15 ph5b dhcpcd[255]: eth0: soliciting an IPv6 router
Sep 12 04:58:20 ph5b dhcpcd[255]: eth0: using static address 10.0.0.4/24
Sep 12 04:58:20 ph5b dhcpcd[255]: eth0: adding route to 10.0.0.0/24
Sep 12 04:58:20 ph5b dhcpcd[255]: eth0: adding default route via 10.0.0.1
Sep 12 04:58:21 ph5b dhcpcd[255]: forked to background, child pid 400
Sep 12 04:58:21 ph5b systemd[1]: Started DHCP Client Daemon.
Sep 12 04:58:28 ph5b dhcpcd[400]: eth0: no IPv6 Routers available

Vs the same Pi configured to acquire an IP automatically via DHCP:

pi@ph5b:~ $ journalctl -b --no-pager --full -u dhcpcd
[..]
Oct 26 20:33:30 ph5b systemd[1]: Starting DHCP Client Daemon...
Oct 26 20:33:30 ph5b dhcpcd[27469]: dev: loaded udev
Oct 26 20:33:30 ph5b dhcpcd[27469]: DUID 00:01:00:01:29:XX:XX:XX:XX:XX:XX:XX:XX:XX
Oct 26 20:33:30 ph5b dhcpcd[27469]: eth0: IAID eb:81:XX:XX
Oct 26 20:33:30 ph5b dhcpcd[27469]: eth0: soliciting an IPv6 router
Oct 26 20:33:30 ph5b dhcpcd[27469]: eth0: soliciting a DHCP lease
Oct 26 20:33:30 ph5b dhcpcd[27469]: eth0: offered 10.0.0.4 from 10.0.0.2
Oct 26 20:33:30 ph5b dhcpcd[27469]: eth0: leased 10.0.0.4 for 86400 seconds
Oct 26 20:33:30 ph5b dhcpcd[27469]: eth0: adding route to 10.0.0.0/24
Oct 26 20:33:30 ph5b dhcpcd[27469]: eth0: adding default route via 10.0.0.1
Oct 26 20:33:32 ph5b dhcpcd[27469]: forked to background, child pid 27533
Oct 26 20:33:33 ph5b systemd[1]: Started DHCP Client Daemon.
Oct 26 20:33:42 ph5b dhcpcd[27533]: eth0: no IPv6 Routers available

EDIT: Ow below one also displays a bunch of info:

pi@ph5b:~ $ dhcpcd -T
dhcp6_listen: Permission denied
DUID 00:01:00:01:29:XX:XX:XX:XX:XX:XX:XX:XX:XX
eth0: IAID eb:81:XX:XX
eth0: using static address 10.0.0.2/24
[..]

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