Git Product home page Git Product logo

docker-dhcpd's Introduction

Docker image for ISC DHCP server

  • Usage
sudo docker run -it --rm --net=host -v "$(pwd)/data":/data networkboot/dhcpd eno1

Where eno1 is your interface name.

  • To make your interface up with some static parameters, you can type:
sudo ifconfig eno1 192.168.0.200 netmask 255.255.255.0 up

How to build

  1. Install Docker with the instructions on https://www.docker.com.
  2. Run ./build to create the local docker image networkboot/dhcpd.

How to use

The most common use-case is to provide DHCP service to the host network of the machine running Docker. For that you need to create a configuration for the DHCP server, start the container with the --net host docker run option and specify the network interface you want to provide DHCP service on.

  1. Create data folder.
  2. Create data/dhcpd.conf with a subnet clause for the specified network interface. If you need assistance, you can run docker run -it --rm networkboot/dhcpd man dhcpd.conf for a description of the configuration file syntax.
  3. Run docker run -it --rm --init --net host -v "$(pwd)/data":/data networkboot/dhcpd eth0. dhcpd will automatically start and display its logs on the console. You can press Ctrl-C to terminate the server.

A simple run script is also included which makes it quick to iterate on a configuration until you're satisfied.

DHCPv6

To use a DHCPv6-Server you have to pass DHCPD_PROTOCOL=6 as enviroment variable

docker run -it --rm --init -e DHCPD_PROTOCOL=6 --net host -v "$(pwd)/data":/data networkboot/dhcpd eth0

Notes

The entrypoint script in the docker image takes care of running the DHCP server as the same user that owns the data folder. This ensures that the permissions on the files inside the data folder is kept consistent. If the data folder is owned by root, dhcpd is run as the normal dhcpd user.

If you forget to run the docker container with the --net host option a warning will be emitted informing you that you've probably forgotten it.

If a /data volume is not provided with a dhcpd.conf inside it, the container will exit early with an error message.

An additional Dockerfile has been added that allows building an image with the tag :ldap which contains the isc-dhcp-server-ldap package in addition to the normal DHCP server package. Other than that it behaves in exactly the same way as the :latest tag. Utility build and run scripts have also been added to work with this variant.

Acknowledgements

This image uses the following software components:

Copyright & License

This project is copyright 2022 Robin Smidsrød [email protected].

It is licensed under the Apache 2.0 license.

See the file LICENSE for full legal details.

docker-dhcpd's People

Contributors

robinsmidsrod avatar wickywaka avatar aplusman avatar sholzmayer avatar ooxi avatar cavazquez avatar yscialom avatar jakschu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.