pi-hole / docker-pi-hole

Pi-hole in a docker container
https://pi-hole.net
Other
8.47k stars 1.13k forks source link

PiHole with DHCP - no address range available for DHCP request via eth0 #1119

Closed iAmSaugata closed 2 years ago

iAmSaugata commented 2 years ago

This is a: Bug

Details

Hi Everyone,

I am running PiHole with DHCP using DHCP Helper. I am also using PiHole as primary DNS for WireGuard VPN. I am using following Docker-Compose to deploying this, and this setup was working perfectly fine for last 3/4 months. Day before yesterday, while working with RPI hardware watchdog settings, I set it into a boot loop because of wrong configuration. Thankfully I am able to restore RPI using previous image backup. Most of the applications started working just after booting, but for some reason, one SQL db and pihole-FTL.db got corrupted, and I had to reconfigure it. This time I use Portainer Stack to deploy the setup using this Docker-Compose file, and all the container booted successfully, there was little issue with permission, which I had to fix manually.

Now the entire setup is working as expected, and I am am able to get IP address for my clients, but all on a sudden PiHole gets flooded with following warning messages. These messages referring to eth0, which is having container IP (172.33.0.100), and dhcp-helper forwarding DHCP request to this IP, hence if I use no-dhcp-interface=eth0, it will disable the IP allocation for clients.

no address range available for DHCP request via eth0

Any solution for this?

Related Issues

How to reproduce the issue

  1. Environment data

    • Operating System: PiOS 64Bit
    • Hardware: Raspberry Pi 4
    • Kernel Architecture: ArmV8 64bit
    • Docker Install Info and version: Docker version 20.10.17, build 100c701
    • Software source:
    • Supplimentary Software:
    • Hardware architecture:
  2. docker-compose.yml contents, docker run shell command, or paste a screenshot of any UI based configuration of containers here

version: "3"
services:
  pihole:
    container_name: pihole
    image: pihole/pihole:latest
    hostname: pihole.dns
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "8008:80/tcp"
    restart: unless-stopped
    cap_add:
        - NET_ADMIN
        - SYS_NICE
    environment:
      TZ: 'Asia/Kolkata'
      WEBPASSWORD: "MyPassword"
      FTLCONF_REPLY_ADDR4: "192.168.0.111"
      ServerIP: "192.168.0.111"
      VIRTUAL_HOST:  "pihole.dns"
      PIHOLE_DNS_: "XX.XX.XX.XX#553;XX.XX.XX.XX#553"
      DNSMASQ_LISTENING: "all"
      PIHOLE_DOMAIN: "local"
      DNSMASQ_USER: "root"
      CUSTOM_CACHE_SIZE: "10000"
      DHCP_ACTIVE: "true"
      DHCP_IPv6: "false"
      IPv6: "false"
      DHCP_START: "192.168.0.10"
      DHCP_END: "192.168.0.249"
      DHCP_ROUTER: "192.168.0.1"
      DHCP_LEASETIME: "24"
      DHCP_rapid_commit: "true"
      DNS_BOGUS_PRIV: "true"
      DNS_FQDN_REQUIRED: "true"
    volumes:
      - '/home/pi/pihole-install/pihole/:/etc/pihole/'
      - '/home/pi/pihole-install/dnsmasq.d/:/etc/dnsmasq.d/'
    depends_on:
      - dhcphelper
    networks:
      backend:
        ipv4_address: '172.33.0.100'
      #frontproxy_proxy-tier: {}
  wg-easy:
    environment:
      # Change this to your host's public address
      - WG_HOST=000.000.000.000
      # Optional:
      - PASSWORD=MyPassword
      - WG_DEFAULT_ADDRESS=10.8.0.x
      - WG_DEFAULT_DNS=172.33.0.100      
    image: weejewel/wg-easy
    container_name: wireguard
    volumes:
      - /home/pi/wireguard:/etc/wireguard
    ports:
      - "51820:51820/udp"
      - "51821:51821/tcp"
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    sysctls:
      - net.ipv4.ip_forward=1
      - net.ipv4.conf.all.src_valid_mark=1
    depends_on:
      - pihole
    networks:
      backend:
  dhcphelper:
    image: pi_dhcphelper:latest
    container_name: pihole-dhcp-helper
    hostname: dhcp-helper-svr
    restart: unless-stopped
    network_mode: "host"
    command: -s 172.33.0.100
    cap_add:
      - NET_ADMIN
networks:
  backend:
    ipam:
      config:
        - subnet: 172.33.0.0/16
  1. any additional info to help reproduce

These common fixes didn't work for my issue

If the above debugging / fixes revealed any new information note it here. Add any other debugging steps you've taken or theories on root cause that may help.

rdwebdesign commented 2 years ago

Please, generate a debug token and paste only the token URL, found a few lines before the end of the log.

iAmSaugata commented 2 years ago

My debug token is : https://tricorder.pi-hole.net/glKsvdM3/

iAmSaugata commented 2 years ago

Now I am having 830+ logs in just 10 hours. https://imgur.com/a/NAUiICT

And currently 27 clients are getting IP from this DHCP server. https://imgur.com/a/5FGurpq

iAmSaugata commented 2 years ago

This is the Dockerfile for DHCP helper, which I am using.

FROM alpine:latest RUN apk --no-cache add dhcp-helper EXPOSE 67 67/udp ENTRYPOINT ["dhcp-helper", "-n"]

iAmSaugata commented 2 years ago

Anyone have any suggestion on this?

phajder commented 2 years ago

The problem is that your DHCP server is listening on the network interface, whose IP is from different range than defined in env variables (DHCP_START, DHCP_END), and it can't assign any valid address for containers in backend network. I do not know how to solve this, because of my lack of knowledge in networking. However, I tried to make a workaround. I tested it only with two containers in backend network: dhcp-helper and pihole, and it works fine.

I managed to get rid of these log message by adding another dhcp-range parameter do dnsmasq config. In dnsmasq.d I created new file 99-tmp.conf with additional IP range for DHCP: dhcp-range=172.33.0.10,172.33.0.20,24h. This range should match the range of your pihole's IP. After a fresh start, no dnsmasq_warnings appear in log section. In settings->dhcp you should see one additional record, with IP from range 172.33.0.x, assigned to your machine's hostname.

Maybe shared-network feature of dnsmasq is the way to go. I tried it with different combinations, but to no avail.

iAmSaugata commented 2 years ago

Hi, Thanks for your response, I will try it by adding one more range as you suggested. I still don't understand, why it is started all on a sudden, it was working without any such working for months, only throwing error since last 15+ days.

Update : After applying this, no more messages logged, and yes, there is one assignment for 172.33.0.18 | RaspberryPi

Regards, Saugata D.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days.