Cannot get DHCP Working

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

Expected Behaviour:

DHCP give an ip adress

Actual Behaviour:

DHCP don't give an ip adress

Debug Token:

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

i'm running with the IOTstack image, i installed a network with macvlan driver, and i can ping, and see the pihole interface on 192.168.1.3 adress.

But when i try to get an adress from the DHCP with my computer or any other peripheral, i don't have any answer from the dhcp.

Thank you!

What is this image?

Hi,
IOT stack is a docker compose builder for raspberry : GitHub - gcgarner/IOTstack: docker stack for getting started on IOT on the Raspberry PI

The pihole image used by this builder is pihole/pihole:latest from docker hub.

pihole:
    container_name: pihole
    image: pihole/pihole:latest
    ports:
      - "53:53/tcp"
      - "53:53/udp"
      - "67:67/udp"
      - "8089:80/tcp"
      #- "443:443/tcp"
    env_file:
      - ./services/pihole/pihole.env
    volumes:
       - ./volumes/pihole/etc-pihole/:/etc/pihole/
       - ./volumes/pihole/etc-dnsmasq.d/:/etc/dnsmasq.d/
    dns:
      - 127.0.0.1
      - 1.1.1.1
    # Recommended but not required (DHCP needs NET_ADMIN)
    #   https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
    cap_add:
      - NET_ADMIN
    restart: unless-stopped

Thank you.

So i was still working at searching why this DHCP server was not working...

I tried TCPDUMP with the following command :

tcpdump -vnes0 -i eth0 port 67 or port 68

and at the moment i send this command...my phone got an IP from DHCP.

I stopped TCPDUMP, disconnect my phone, and reconnect it...no answer from DHCP for 5 minutes.

Send again the TCPDUMP command...and my phone immediatly got an ip again...

I don't know what's going but TCPDUMP seems to do something permitting the DHCP to work.

Was still searching for a solution and i found this article relating something similar :

https://tech.ahrefs.com/dhcp-working-only-when-tcpdump-is-running-e8247f11699

So i test a "sudo ifconfig eth0 promisc"on the raspberry and DHCP was working again with a macvlan configuration on the container, it's still not working with bridge

I still have some error, but i think it's my fault (misconfiguration), i'll continue to search.

There is no official support for IOT stack as build environment.

Still, since you are using the official image, it might be useful to check Pi-hole's documentation on Docker DHCP as well as Pi-hole Docker on GitHub.

Also, your observation that DHCP requests are successful once traffic is initiated from the machine running Pi-hole may hint at a port conflict or firewall issue, probably with your host OS.

Hi,
I read the Pi-Hole documentation for Docker DHCP, and decide to make it work with macvlan as mentioned in this link:

As the container got a dedicated IP with macvlan there is not port issue nor firewall issue as the container don't have any firewall.

The little problem i still had yesterday are solved, so i can confirm the "sudo ifconfig eth0 promisc" command solved the problem for me.

it's not ideal to let the NIC in promiscuous mode, but it works.

Promiscuous mode force the NIC to listen every packet even those with another target, so i think something in the raspbian kernel, or in the container drop DHCP packet if promiscuous mode is not enabled...but i don't know why.

Glad you've got it working. :slight_smile:

Just an observation:

Your Docker configuration as posted by you above significantly differs from Tony Lawrence's sample configuration that Pi-hole's aforementioned macvlan documentation ultimately links to.
Specifically, it is missing the networks relevant parts that may be crucial for your situation.

It may be worth revisiting Pi-hole's documentation and also to check out the documentation it links to: Tony Lawrence's blog is nicely detailing the necessary configuration.

Should you decide to give that another try, please let us know if that did help you to avoid putting an interface into promiscuous mode.

Ah, you are right, i missed this sample, i'll recheck it.

Thank you !

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