PiHole loses internet when turning on DHCP server

My PiHole (hosted on Orange Pi 5) loses internet connection when I turn off the DHCP on the router and turn on the DHCP on the PiHole. This doesn't happen immediately and I can see that the DHCP is working for connecting devices, but within an hour or so the PiHole will lose connection to the internet and thus all devices on the network also lose access. If I go back to the router and turn on the DHCP then internet comes back on.

I installed PiHole following this tutorial:

Here is my docker-compose.yml:

  GNU nano 6.2                                       docker-compose.yml                                                 services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    network_mode: host
    environment:
      TZ: 'Europe/Berlin'
      WEBPASSWORD: 'xxxxxxxxx'
      PIHOLE_ADLISTS: 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts,https://mirror1.malwaredomains.>      
FTLCONF_REPLY_ADDR4: "192.168.0.31"   
    volumes:
      - './etc-pihole:/etc/pihole'
      - './etc-dnsmasq.d:/etc/dnsmasq.d'
    cap_add:
      - NET_ADMIN
    restart: unless-stopped

I also assigned static IP address to the Pihole device by editing file @ /etc/network/interfaces:

  GNU nano 6.2                                     /etc/network/interfaces                                              source /etc/network/interfaces.d/*

# Network is managed by Network manager
auto lo
iface lo inet loopback

# PRIMARY network interface
auto eth0
iface eth0 inet static
        address 192.168.0.31
        netmask 255.255.255.0
        gateway 192.168.0.1

Screenshots from Router page and Pihole (ignore enable/disable):



I suspect that the PiHole device is unable to get an IP address from the DHCP :/.

Please can someone help me :frowning:

There may be other network management tools that interfere with that configuration.
That would depend on your OS distribution and variant, so I'd recommend to consult your specific OS's documentation and support for details on how to configure a static IP.

Alternatively, you could try to have your router's DHCP server to coexist with Pi-hole's:
Limit the router's DHCP range to accommodate just for Pi-hole host machine and configure a respective fixed IP address/DHCP lease reservation.

Note that it would take a while for client machines to pick up the new DNS server information from a Pi-hole DHCP lease, as they would hold on to their existing router-issued lease until that expires. This may take hours, days or even weeks, depending on your router's lease lifetime. You may force clients to renew their lease, e.g. by dis- and reconnecting them to your network, or by power-cycling them.