dhcpd.j2 1.83 KB
Newer Older
julian.gethmann's avatar
julian.gethmann committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# dhcpd.conf
#
# {{ ansible_managed }}
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp/dhcpd.conf.example
# see dhcpd.conf(5) man page
#

# option definitions common to all supported networks...
option domain-name "las.kit.edu";
option domain-name-servers 129.13.64.5, 129.13.96.2;

default-lease-time 60;
max-lease-time 720;

# Use this to enble / disable dynamic dns updates globally.
ddns-update-style none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

# failover https://www.madboa.com/geek/dhcp-failover/
# https://kb.isc.org/article/AA-00502/0/A-Basic-Guide-to-Configuring-DHCP-Failover.html
failover peer "dhcp-failover" {
{% if primary_dhcpd == ansible_default_ipv4.address %}
  primary;
  address {{ primary_dhcpd }};
{% else %}
  secondary;
  address {{ secondary_dhcpd }};
{% endif %}
  port 647;
  peer address
{% if primary_dhcpd == ansible_default_ipv4.address %}
{{ secondary_dhcpd }};
{% else %}
{{ primary_dhcpd }};
{% endif %}
  peer port 647;
  max-response-delay 30;
  max-unacked-updates 10;
  load balance max seconds 3;
{% if primary_dhcpd == ansible_default_ipv4.address %}
  mclt 1800;
  split 128;
{% endif %}
}

# A slightly different configuration for an internal subnet.
subnet 129.13.108.0 netmask 255.255.255.0 {
  option routers 129.13.108.254;
  option broadcast-address 129.13.255.255;
  option domain-name "las.kit.edu";
  option domain-name-servers 129.13.64.5, 129.13.96.2;
  pool {
    failover peer "dhcp-failover";
    default-lease-time 1800;
    max-lease-time 7200;
    range 129.13.108.70 129.13.108.89;
    deny unknown-clients;
  }
}

include "/etc/dhcp/host-list-las";