Sign inSign up

lucashalbert/dhcp

By lucashalbert

Updated over 6 years ago

A multi-architecture dhcp image built on alpine linux.

Image
0

2.8K

lucashalbert/dhcp repository overview

docker-dhcp

A multi-architecture dhcp image built on alpine linux. This image is compatible with arm32v6, arm32v7, arm64v8, and x86_64.

Travis-CI Build Status Docker Layers Docker Pulls Docker Stars


Example dhcpd.conf

# Global DHCP Options
authoritative;
allow booting;
allow bootp;
#next-server 10.10.10.10; # TFTP Server
#filename "pxelinux.0";   # TFTP boot filename
default-lease-time 86400; # 1 day
max-lease-time 86400; # 1 day


# Failover Peer Options
failover peer "failover-dhcp" {
    primary; # This defines the master
    address 0.0.0.0;
    port 647;
    peer address dhcp02.domain.tld;
    peer port 647;
    max-response-delay 60;
    max-unacked-updates 10;
    mclt 3600;
    split 128; # 128 is balanced; use 255 if primary is 100% responsible until failure
    load balance max seconds 3;
}


# OMAPI Options
# insert this (with your own key text substituted) into dhcpd.conf on primary and secondary.
omapi-port 7911;
omapi-key omapi_key;

key omapi_key {
     algorithm hmac-md5;
     secret 0fakefakefakefakefakefakefake==;
}


# Dynamic DNS Update Options
ddns-updates on;
ddns-update-style interim;
ignore client-updates;
update-static-leases on;
one-lease-per-client on;

# Use dns01.domain.tld rndc key for dynamic updates
key "dns01.domain.tld" {
    algorithm hmac-sha512;
    secret "0fakefakefakefakefakefakefake==";
};

# Zone definitions for dynamic DNS updates
zone 70.22.172.in-addr.arpa {
    primary 172.22.70.201;
    secondary 172.22.70.202;
    key "dns01.domain.tld";
}



# Subnet Definitions
subnet 172.22.70.0 netmask 255.255.255.0 {
    option subnet-mask 255.255.255.0;
    option broadcast-address 172.22.70.255;
    option routers 172.22.70.1;
    option domain-name-servers 172.22.70.201, 172.22.70.202;
    option domain-search "domain.tld", "domain2.tld";
    option domain-name "domain.tld";
    pool {
        failover peer "failover-dhcp";
        range 172.22.70.2 172.22.70.199;
    }
}


# Static host definitions
host host01.domain.tld {
        hardware ethernet FF:FF:FF:00:00:00;
    fixed-address 172.22.70.101;
    option host-name "host01.domain.tld";
}
host host02.domain.tld {
    hardware ethernet 00:00:00:FF:FF:FF;
    fixed-address 172.22.70.102;
    option host-name "host02.domain.tld";
}

Docker Usage

Create the container
docker create --name=dhcp --network=host -e INTERFACES=ens192 -e TZ=America/New_York -e PUID=8675309 -e PGID=8675309 -v $(pwd)/config/dhcpd.conf:/etc/dhcp/dhcpd.conf -v $(pwd)/config/var:/var/lib/dhcp --restart=unless-stopped lucashalbert/dhcp
Start the container
docker start dhcp

Docker-Compose Usage

docker-compose.yaml

version: "3"

services:
  dhcp:
    container_name: dhcp
    image: lucashalbert/dhcp
    hostname: dhcp01
    domainname: domain.tld
    network_mode: host
    environment:
      - INTERFACES=ens192
      - TZ=America/New_York
      - PUID=8675309
      - PGID=8675309
    volumes:
      - './config/dhcpd.conf:/etc/dhcp/dhcpd.conf'
      - './config/var:/var/lib/dhcp'
    restart: unless-stopped
Start the container
docker-compose up -d

Tag summary

Content type

Image

Digest

Size

10.8 MB

Last updated

over 6 years ago

docker pull lucashalbert/dhcp