devplayer0 / docker-net-dhcp

Docker network driver for networking on a host bridge with DHCP-allocated IP addresses
GNU General Public License v3.0
203 stars 55 forks source link

Documentation improvement #14

Closed blop closed 3 years ago

blop commented 3 years ago

Hello!

For some reason I had to perform the following setting in order to have the DHCP client working. sysctl -w net.bridge.bridge-nf-call-iptables=0

Otherwise I kept having the following error : NetworkDriver.CreateEndpoint: failed to get initial IP address via DHCP: context deadline exceeded.

;-)

blop commented 3 years ago

You can also add a docker-compose example like :

networks:
    my-dhcp-net:
        driver: ghcr.io/devplayer0/docker-net-dhcp:release-linux-amd64
        driver_opts:
            bridge: "my-bridge"
            lease_timeout: "60s"
        ipam:
            driver: "null"
devplayer0 commented 3 years ago

Hello!

For some reason I had to perform the following setting in order to have the DHCP client working. sysctl -w net.bridge.bridge-nf-call-iptables=0

Otherwise I kept having the following error : NetworkDriver.CreateEndpoint: failed to get initial IP address via DHCP: context deadline exceeded.

;-)

Hmmm perhaps this is something to do with the FORWARD policy in iptables being set to DROP by default? I'm not too familiar with this sysctl. If it's set to 1 by default Docker may expect this for its own built-in networking. I didn't run into this issue myself, can you check your iptables config? There's a minor note in the README about adding a FORWARD rule over the bridge, perhaps this could also solve your problem?