Skip to content

Instantly share code, notes, and snippets.

@gene1wood
Last active June 26, 2022 16:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gene1wood/381582ec03d63b0b4770ed831de8e667 to your computer and use it in GitHub Desktop.
Save gene1wood/381582ec03d63b0b4770ed831de8e667 to your computer and use it in GitHub Desktop.
Portable docker based DHCP server

This is an easy method to spawn a portable DHCP server. It uses the https://github.com/networkboot/docker-dhcpd docker container.

  1. mkdir data
  2. wget -O data/dhcpd.conf https://gist.githubusercontent.com/gene1wood/381582ec03d63b0b4770ed831de8e667/raw/cd2b61c64e04934ec41c38b7a3cc53ead48aea5c/dhcpd.conf
  3. INTERFACE=eth0
  4. docker run -it --rm --init --net host -v "$(pwd)/data":/data networkboot/dhcpd $INTERFACE
option domain-name "mydomain.example";
option domain-name-servers 1.1.1.1, 8.8.8.8;
subnet 172.29.202.0 netmask 255.255.255.0 {
range 172.29.202.100 172.29.202.200;
option routers 172.29.202.1;
}
INTERFACE=eth0
mkdir data
docker run -it --rm --init --net host -v "$(pwd)/data":/data networkboot/dhcpd $INTERFACE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment