Pihole can't connect to internet? DNS problem

Expected Behaviour:

Being able to connect to the internet.

Actual Behaviour:

For some reason my pihole (rpi3) suddenly fails to connect to the internet. I have restarted everything several times which includes the cable modem. Same setup has been working for a week so the sudden complete breakage is very puzzling.

can't update Ubuntu as apt update also fails to connect
can't ping google even when using IP address

intranet works fine which kind of rules out a defective cable or port.

One thing to mention about 2 weeks ago I got a new cable modem/router that has a hard coded 192.168.1.1 as gateway (vs previous 192.168.0.1). to make things work I had to adjust pihole as well to issue IPs accordingly. things were working just fine for a week now. (before it worked for years)

What I noticed is that when running ping still say FROM 192.168.0.11 emphasis mine even though netplan config was adjusted to use static IP of 192.168.1.11 which ifconfig also shows. So I wonder where this left-over parts from the old config is coming from?

Aby ideas or input how I could fix this?

If you previously set a static IP on the Pi in the 192.168.0.x range, it won't connect to the new router on the 192.168.1.x range.

From the Pi terminal, what are the output of the following commands:

ip addr

nmcli

pihole-FTL dhcp-discover

cat /etc/resolv.conf


pi@ubuntu:/etc/openvpn$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether b8:27:eb:62:20:51 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.52/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet 192.168.0.52/24 brd 192.168.0.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::ba27:ebff:fe62:2051/64 scope link
       valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000
    link/ether b8:27:eb:37:75:04 brd ff:ff:ff:ff:ff:ff

nmcli is not installed

pi@ubuntu:/etc/openvpn$ sudo pihole-FTL dhcp-discover
Scanning all your interfaces for DHCP servers
Timeout: 10 seconds

* Received 306 bytes from eth0:192.168.1.52
  Offered IP address: 192.168.1.99
  Server IP address: 192.168.1.52
  Relay-agent IP address: N/A
  BOOTP server: (empty)
  BOOTP file: (empty)
  DHCP options:
   Message type: DHCPOFFER (2)
   server-identifier: 192.168.1.52
   lease-time: 86400 ( 1d )
   renewal-time: 43200 ( 12h )
   rebinding-time: 75600 ( 21h )
   netmask: 255.255.255.0
   broadcast: 192.168.1.255
   dns-server: 192.168.1.52
   domain-name: "mydomain"
   hostname: "pihole"
   router: 192.168.1.1
   --- end of options ---


* Received 306 bytes from eth0:192.168.1.52
  Offered IP address: 192.168.1.99
  Server IP address: 192.168.1.52
  Relay-agent IP address: N/A
  BOOTP server: (empty)
  BOOTP file: (empty)
  DHCP options:
   Message type: DHCPOFFER (2)
   server-identifier: 192.168.1.52
   lease-time: 86400 ( 1d )
   renewal-time: 43200 ( 12h )
   rebinding-time: 75600 ( 21h )
   netmask: 255.255.255.0
   broadcast: 192.168.1.255
   dns-server: 192.168.1.52
   domain-name: "mydomain"
   hostname: "pihole"
   router: 192.168.1.1
   --- end of options ---


* Received 306 bytes from eth0:192.168.1.52
  Offered IP address: 192.168.1.99
  Server IP address: 192.168.1.52
  Relay-agent IP address: N/A
  BOOTP server: (empty)
  BOOTP file: (empty)
  DHCP options:
   Message type: DHCPOFFER (2)
   server-identifier: 192.168.1.52
   lease-time: 86400 ( 1d )
   renewal-time: 43200 ( 12h )
   rebinding-time: 75600 ( 21h )
   netmask: 255.255.255.0
   broadcast: 192.168.1.255
   dns-server: 192.168.1.52
   domain-name: "mydomain"
   hostname: "pihole"
   router: 192.168.1.1
   --- end of options ---


* Received 306 bytes from eth0:192.168.1.52
  Offered IP address: 192.168.1.99
  Server IP address: 192.168.1.52
  Relay-agent IP address: N/A
  BOOTP server: (empty)
  BOOTP file: (empty)
  DHCP options:
   Message type: DHCPOFFER (2)
   server-identifier: 192.168.1.52
   lease-time: 86400 ( 1d )
   renewal-time: 43200 ( 12h )
   rebinding-time: 75600 ( 21h )
   netmask: 255.255.255.0
   broadcast: 192.168.1.255
   dns-server: 192.168.1.52
   domain-name: "mydomain"
   hostname: "pihole"
   router: 192.168.1.1
   --- end of options ---

DHCP packets received on interface eth0: 2
DHCP packets received on interface eth0: 2

resolv.conf

pi@ubuntu:/etc/openvpn$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 127.0.0.53

this for sure is weird but can't say how it used to be

You have IP's from two different ranges assigned to the Pi. This may be part of the problem.

Is your Pi using dhcpcd for IP configuration?

Anything from this?

cat /etc/dhcpcd.conf

interface eth0
        static ip_address=192.168.0.52/24
        static routers=192.168.0.1
        static domain_name_servers=1.1.1.1 1.0.0.1

so this indeed might be the issue but weird why it worked fine for a week.

Agree. Edit that file, fix the IP addresses, save and exit.

Then restart dhcpcd (or better yet, reboot the Pi).

Then see if you have an nternet connection.

thanks you sir. this indeed fixed it, changing the file and the rebooting.

1 Like

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