Do not see DHCP devices in logs

Hi,

I can only see other docker services in logged, like service.pihole.
Devices from DHCP are not recognized (they all fall to 192.168.4.1, docker's internal network gateway).

Is there a way to fix this? I think it was working before last update?

Thank you.

Please follow at least the template

Please follow the below template, it will help us to help you!

If you are Experiencing issues with a Pi-hole install that has non-standard elements (e.g you are using nginx instead of lighttpd, or there is some other aspect of your install that is customised) - please use the Community Help category.

Expected Behaviour:

[Replace this text with what you think should be happening. Please include as much detail as possible including, but not limited to:
-operating system
-hardware]

Actual Behaviour:

[replace this text with what is actually happening]

Debug Token:

[Replace this text with the debug token provided from running pihole -d (or running the debug script through the web interface]

1 Like

Expected Behaviour:

The expected behaviour is having the devices using the DHCP service properly recognized and logged in the query log.

Actual Behaviour:

Acutally, only other docker services get properly recognized (service.pihole) and logged, while all of the DHCP devices get logged as the gateway IP of the intenal docker network (192.168.4.1)

Debug Token:

https://tricorder.pi-hole.net/oOMp0WMz/

Please, also post your compose file or docker run command used to start the container.

services:
  pihole:
    container_name: pihole
    domainname: docker
    hostname: pihole
    image: pihole/pihole:latest
    pull_policy: always
    restart: unless-stopped
    ports:
      - "53:53/tcp"
      - "53:53/udp"
    cap_add:
      - NET_ADMIN
    dns:
      - 127.0.0.1
    environment:
      - ServerIP=${SERVER_IP}
      - PROXY_LOCATION="pihole"
      - VIRTUAL_HOST=pihole.${DOMAINNAME_1}
      - VIRTUAL_PORT=80
      - TZ=${TZ}
      - WEBPASSWORD=piholeadmin
      - DNS1=192.168.4.101#5054
      - IPv6=false
      - DNS2=""
      - DNSMASQ_LISTENING=all
    volumes:
      - '$CONFIGDIR/pihole/pihole/:/etc/pihole/'
      - '$CONFIGDIR/pihole/dnsmasq.d/:/etc/dnsmasq.d/'
    depends_on:
      - dhcphelper
    networks:
      traefik:
        ipv4_address: '192.168.3.100'
      pihole:
        ipv4_address: '192.168.4.100'
    labels:
      - "org.label-schema.group=monitoring"
      - "traefik.enable=true"
      # HTTP Routers
      - "traefik.http.routers.pihole-rtr.entrypoints=websecure"
      - "traefik.http.routers.pihole-rtr.rule=Host(`pihole.$DOMAINNAME_1`)" # HostRegexp:pihole.${DOMAINNAME_1},{catchall:.*}" # Host(`pihole.$DOMAINNAME_1`)"
      # Middlewares
      - "traefik.http.routers.pihole-rtr.middlewares=middlewares-chain-no-auth@file"
      # HTTP Services
      - "traefik.http.routers.pihole-rtr.service=pihole-svc"
      - "traefik.http.services.pihole-svc.loadbalancer.server.port=80"

You have networks declared inside your services, but you need to declare your networks in the yml file like this:

services:
  pihole:
    ...
    networks:
    ...

networks:
  ...

Sorry, I only posted the pihole service yaml, here's the complete docker-compose, containing the networks:

version: "3.9"

# NETWORKS
networks:
  traefik:
    external: true
  pihole:
    external: true
  monitoring:
    external: true
#  dnet:
#    external: true

# SECRETS
secrets:
  cf_dns_api_token:
    file: $SECRETSDIR/cf_dns_api_token

# SERVICES

include:
# NETWORK
  # Traefik 2 - Reverse Proxy
  - compose/network/traefik.yaml

  #Cloudflared DNS DoH
  - compose/network/cloudflared.yaml

  #Pihole DNS DHCP server
  - compose/network/pihole.yaml
[...]

Is there anything I can do to fix/debug it?

Hi @rdwebdesign

Is there anything I can do to properly understand/debug/fix the situation?

It's also worth noting that I am not seeing any blocked query since some days, while I had mostly 10% blocked before. No configuration change worth mentioning on my side.

I'm keeping pihole up to date.

Hi,

I'm seeing all of the DHCP devices stopped querying as themselves on a precise date, and now they all query as the docker's network gateway:

It seems something happened, probably I triggered a configuration or something?

Hi,

I have a configuration made following this guide (DHCP with docker-compose and bridge networking), not working (still seeing only one IP for all DHCP devices, probably something wrong)

services:
  dhcphelper:
    container_name: dhcp-helper
    build: ./dhcp-helper
    restart: unless-stopped
    network_mode: "host"
    command: -s 192.168.4.100
    cap_add:
      - NET_ADMIN
    labels:
      - "org.label-schema.group=monitoring"

  pihole:
    container_name: pihole
    domainname: docker
    hostname: pihole
    image: pihole/pihole:latest
    pull_policy: always
#    security_opt:
#      - no-new-privileges:true
    restart: unless-stopped
    # profiles: ["core", "all"]
#    networks:
#      - dnet
#      - traefik
    ports:
      - "53:53/tcp"
      - "53:53/udp"
#      - "67:67/udp"
#      - "8081:80"
    cap_add:
      - NET_ADMIN
    dns:
      - 127.0.0.1
    environment:
#      - PUID=${PUID}
#      - GUID=${GUID}
      - ServerIP=${SERVER_IP}
      - PROXY_LOCATION="pihole"
      - VIRTUAL_HOST=pihole.${DOMAINNAME_1}
      - VIRTUAL_PORT=80
      - TZ=${TZ}
      - WEBPASSWORD=<password>
      - DNS1=192.168.4.101#5054
      - IPv6=false
      - DNS2=""
      - DNSMASQ_LISTENING=all
    volumes:
      - '$CONFIGDIR/pihole/pihole/:/etc/pihole/'
      - '$CONFIGDIR/pihole/dnsmasq.d/:/etc/dnsmasq.d/'
    depends_on:
      - dhcphelper
    networks:
      traefik:
        ipv4_address: '192.168.3.100'
      pihole:
        ipv4_address: '192.168.4.100'
    labels:
      - "org.label-schema.group=monitoring"
      - "traefik.enable=true"
      # HTTP Routers
      - "traefik.http.routers.pihole-rtr.entrypoints=websecure"
      - "traefik.http.routers.pihole-rtr.rule=Host(`pihole.$DOMAINNAME_1`)" # HostRegexp:pihole.${DOMAINNAME_1},{catchall:.*}" # Host(`pihole.$DOMAINNAME_1`)"
      # Middlewares
      - "traefik.http.routers.pihole-rtr.middlewares=middlewares-chain-no-auth@file"
      # HTTP Services
      - "traefik.http.routers.pihole-rtr.service=pihole-svc"
      - "traefik.http.services.pihole-svc.loadbalancer.server.port=80"
docker ps
CONTAINER ID   IMAGE                                    COMMAND                  CREATED          STATUS                    PORTS                                                              NAMES
138e2a9acedb   pihole/pihole:latest                     "/s6-init"               28 minutes ago   Up 28 minutes (healthy)   0.0.0.0:53->53/tcp, 0.0.0.0:53->53/udp, 67/udp, 80/tcp             pihole
[...]
a45e00f0907f   docker-compose-dhcphelper                "dhcp-helper -n -s 1…"   2 weeks ago      Up 2 weeks                                                                                   dhcp-helper
[...]
sudo netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      19119/docker-proxy
[...]
udp        0      0 0.0.0.0:53              0.0.0.0:*                           19134/docker-proxy
udp        0      0 0.0.0.0:67              0.0.0.0:*                           3306/dhcp-helper
[...]