Name resolution lost when restarting Fritzbox

I just had to restart the Fritzbox, and the problem ocurred again:

ssh: connect to host 192.168.178.92 port 22: No route to host

Power management should be disabled. Maybe the Pi doesn't automatically reconnect when the router restarts?

It's odd that although the Pi doesn't show up on the router's local network overview, I can still surf the web, but name resolving takes like 5 seconds.

When in trouble, post results from a ping from PC to Pi-hole,
and ping from PC to router,
and ping from Pi-hole to PC.

Post results from below one on your PC:

nslookup pi.hole

And post results from below one on Pi-hole:

ip link show; ip addr show; ip route show

EDIT: Ohw and when in trouble, what is displayed on Pi-hole with below one ?

sudo iwconfig

No need, I've split your conversation with @nixalsverdrus out to a new topic! Might need to edit the title...

Great, thank you, @PromoFaux! I'll change the title when I'm clear about what exactly is the issue.

On Topic:
I'm not in trouble at the moment. Not sure if you meant that I should only run any of these in that case. Here's what I get now:

pi@raspberrypi:~ $ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enxb827ebbf9bd6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
link/ether b8:27:eb:bf:9b:d6 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DORMANT group default qlen 1000
link/ether b8:27:eb:ea:ce:83 brd ff:ff:ff:ff:ff:ff

pi@raspberrypi:~ $ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enxb827ebbf9bd6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether b8:27:eb:bf:9b:d6 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:ea:ce:83 brd ff:ff:ff:ff:ff:ff
inet 192.168.178.92/24 brd 192.168.178.255 scope global wlan0
valid_lft forever preferred_lft forever
inet6 fe80::5cc8:f41e:77d9:40f3/64 scope link
valid_lft forever preferred_lft forever

pi@raspberrypi:~ $ ip route show
default via 192.168.178.1 dev wlan0 src 192.168.178.92 metric 303
192.168.178.0/24 dev wlan0 proto kernel scope link src 192.168.178.92 metric 303

When in trouble, it could be complicated to get the outputs, because the Pi is running headless. But if necessary I can try to move the Pi to a more suitable position before I get in trouble.

You were suppose to run the commands on the machines I indicated?
Is the "linux-ehou" machine your PC ?

And is 192.168.178.92 the IP address of Pi-hole ?
If so, its very weird you get address 0.0.0.0 returned for the nslookup command.

When in sh.t creek, I am only interested if you can ping indicated machines and want to know wlan status (connected or not) with the iwconfig command.

Yes, linux-ehou is my PC.
Sorry, I'm a bit tired (it's late in Germany), confused my shells... :face_with_raised_eyebrow:

I'll run the latter three commands on the Pi through ssh and edit the above post.

192.168.178.92 is the Pihole. Could the returned address be 0.0.0.0 because I didn't install the graphical web interface (so it doesn't conflict with my NextcloudPi installation)?

Whats in below file ?

/etc/pihole/local.list

interesting...

/etc/pihole/local.list

0.0.0.0 raspberrypi
0.0.0.0 pi.hole

Run below one and choose reconfigure:

pihole -r

And check again:

cat /etc/pihole/local.list

And check again on PC:

nslookup pi.hole

I reconfigured, still the same.

pi@raspberrypi:~ $ cat /etc/pihole/local.list
0.0.0.0 raspberrypi
0.0.0.0 pi.hole

robert@linux-ehou:~> nslookup pi.hole
Server: 192.168.178.92
Address: 192.168.178.92#53
Name: pi.hole
Address: 0.0.0.0

Could you still post results from below one on Pi-hole ?

ip link show; ip addr show; ip route show

I dont know whats going on with the reconfigure option but it should have populated that "local.list" file with proper IP address instead of 0.0.0.0.
You could alter that file manually for time being and put in the proper IP addresses (both entries the same IP!).
Will need to restart dnsmasq to apply:

sudo service dnsmasq restart

Maybe the @Developers know how come you have 0.0.0.0 in that file ?

Here you go:

pi@raspberrypi:~ $ ip link show; ip addr show; ip route show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enxb827ebbf9bd6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
link/ether b8:27:eb:bf:9b:d6 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DORMANT group default qlen 1000
link/ether b8:27:eb:ea:ce:83 brd ff:ff:ff:ff:ff:ff
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enxb827ebbf9bd6: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
link/ether b8:27:eb:bf:9b:d6 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:ea:ce:83 brd ff:ff:ff:ff:ff:ff
inet 192.168.178.92/24 brd 192.168.178.255 scope global wlan0
valid_lft forever preferred_lft forever
inet6 fe80::5cc8:f41e:77d9:40f3/64 scope link
valid_lft forever preferred_lft forever
default via 192.168.178.1 dev wlan0 src 192.168.178.92 metric 303
192.168.178.0/24 dev wlan0 proto kernel scope link src 192.168.178.92 metric 303

If you didn't install the web interface, then you should have 0.0.0.0 as your IP because there's no web server on the Pi-hole to redirect ads to.

I'm in trouble now. This time that means I cannot resolve any domains at all.

robert@linux-ehou:~> ping 192.168.178.92
PING 192.168.178.92 (192.168.178.92) 56(84) bytes of data.
From 192.168.178.100 icmp_seq=1 Destination Host Unreachable
From 192.168.178.100 icmp_seq=2 Destination Host Unreachable
From 192.168.178.100 icmp_seq=3 Destination Host Unreachable
^C
--- 192.168.178.92 ping statistics ---
4 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3059ms
pipe 4
robert@linux-ehou:~> ping 192.168.178.1
PING 192.168.178.1 (192.168.178.1) 56(84) bytes of data.
64 bytes from 192.168.178.1: icmp_seq=1 ttl=64 time=0.447 ms
64 bytes from 192.168.178.1: icmp_seq=2 ttl=64 time=0.512 ms
^C
--- 192.168.178.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1027ms
rtt min/avg/max/mdev = 0.447/0.479/0.512/0.039 ms
robert@linux-ehou:~> nslookup pi.hole
Server: 192.168.178.1
Address: 192.168.178.1#53
** server can't find pi.hole: NXDOMAIN

The Pi doesn't show up on the Fritzbox's local network overview, so I assume it is not connected.

Pi-hole would not have an impact on pinging external IP addresses. The issue would be in your gateway (router).

Have you tried restarting the Pi-hole? (might have to physically remove the power)

You must have changed something as before, your "linux-ehou" machine was resolving DNS names using Pi-hole 192.168.178.92 :

Now its resolving using your router 192.168.178.1 :

Do you remember what you changed ?
And what is in below file on the "linux-ehou" system:

cat /etc/resolv.conf

And who is doing DHCP when running below one on the "linux-ehou" system ?

sudo dhclient -r; sudo dhclient -v

Can you log in to Pi-hole and check network ?

Yes, that always helps. The problem is that at the moment it doesn't work reliably.

No, I didn't change any configurations in between these posts. I guess the router shows up as name server, because when the problem occurs, the Pi is disconnected from the network and so the "linux-ehou" "falls back" to the router as a name server.

@linux-ehou:~> cat /etc/resolv.conf
search fritz.box
nameserver 192.168.178.92
nameserver 192.168.178.1

And i get this:

@linux-ehou:~> sudo dhclient -r; sudo dhclient -v
/sbin/dhclient-script: unable to pre-init requested interface enp5s0
/sbin/dhclient-script: unable to pre-init requested interfaces -- see log messages

I will setup the Pi in a more suitable place in my room, so when the problem occurs again, I can connect peripherals and check the network.

Need to remove the Fritzbox DNS service (192.168.178.1) from the DHCP client/LAN settings on Fritzbox or ads will still leak through:

Dont forget to renew DHCP lease after on the clients by either disconnecting/reconnecting network or reboot the clients!

So far I didn't seem to have any issues with that, but thank you, I will adjust it. So far I had only set it up through Yast, so I wasn't entirely sure what's happening behind the scenes...