Skip to content

Commit 5b420aa

Browse files
author
David Vølker
committed
kea: T6211: add vrf support for KEA dhcp server
1 parent 0801bc6 commit 5b420aa

27 files changed

+1513
-833
lines changed

data/templates/dhcp-server/kea-dhcp-ddns.conf.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
"ip-address": "127.0.0.1",
44
"port": 53001,
55
"control-socket": {
6+
{% if vrf_context is vyos_defined %}
7+
"socket-type": "unix",
8+
"socket-name": "/run/kea/kea-ddns-{{ vrf_context }}-ctrl-socket"
9+
{% else %}
610
"socket-type": "unix",
711
"socket-name": "/run/kea/kea-ddns-ctrl-socket"
12+
{% endif %}
813
},
914
"tsig-keys": {{ dynamic_dns_update | kea_dynamic_dns_update_tsig_key_json }},
1015
"forward-ddns" : {

data/templates/dhcp-server/kea-dhcp4.conf.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@
1515
"service-sockets-retry-wait-time": 5000
1616
},
1717
"control-socket": {
18+
{% if vrf_context is vyos_defined %}
19+
"socket-type": "unix",
20+
"socket-name": "/run/kea/dhcp4-{{ vrf_context }}-ctrl-socket"
21+
{% else %}
1822
"socket-type": "unix",
1923
"socket-name": "/run/kea/dhcp4-ctrl-socket"
24+
{% endif %}
2025
},
2126
"lease-database": {
2227
"type": "memfile",

data/templates/dhcp-server/kea-dhcp6.conf.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@
1010
"service-sockets-retry-wait-time": 5000
1111
},
1212
"control-socket": {
13+
{% if vrf_context is vyos_defined %}
14+
"socket-type": "unix",
15+
"socket-name": "/run/kea/dhcp6-{{ vrf_context }}-ctrl-socket"
16+
{% else %}
1317
"socket-type": "unix",
1418
"socket-name": "/run/kea/dhcp6-ctrl-socket"
19+
{% endif %}
1520
},
1621
"lease-database": {
1722
"type": "memfile",
Lines changed: 342 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,342 @@
1+
<!-- include start from dhcp/dhcp-server-common-config.xml.i -->
2+
#include <include/generic-disable-node.xml.i>
3+
<node name="dynamic-dns-update">
4+
<properties>
5+
<help>Dynamically update Domain Name System (RFC4702)</help>
6+
</properties>
7+
<children>
8+
#include <include/dhcp/ddns-settings.xml.i>
9+
<tagNode name="tsig-key">
10+
<properties>
11+
<help>TSIG key definition for DNS updates</help>
12+
<constraint>
13+
#include <include/constraint/alpha-numeric-hyphen-underscore.xml.i>
14+
</constraint>
15+
<constraintErrorMessage>Invalid TSIG key name. May only contain letters, numbers, hyphen and underscore</constraintErrorMessage>
16+
</properties>
17+
<children>
18+
<leafNode name="algorithm">
19+
<properties>
20+
<help>TSIG key algorithm</help>
21+
<completionHelp>
22+
<list>md5 sha1 sha224 sha256 sha384 sha512</list>
23+
</completionHelp>
24+
<valueHelp>
25+
<format>md5</format>
26+
<description>MD5 HMAC algorithm</description>
27+
</valueHelp>
28+
<valueHelp>
29+
<format>sha1</format>
30+
<description>SHA1 HMAC algorithm</description>
31+
</valueHelp>
32+
<valueHelp>
33+
<format>sha224</format>
34+
<description>SHA224 HMAC algorithm</description>
35+
</valueHelp>
36+
<valueHelp>
37+
<format>sha256</format>
38+
<description>SHA256 HMAC algorithm</description>
39+
</valueHelp>
40+
<valueHelp>
41+
<format>sha384</format>
42+
<description>SHA384 HMAC algorithm</description>
43+
</valueHelp>
44+
<valueHelp>
45+
<format>sha512</format>
46+
<description>SHA512 HMAC algorithm</description>
47+
</valueHelp>
48+
<constraint>
49+
<regex>(md5|sha1|sha224|sha256|sha384|sha512)</regex>
50+
</constraint>
51+
<constraintErrorMessage>Invalid TSIG key algorithm</constraintErrorMessage>
52+
</properties>
53+
</leafNode>
54+
<leafNode name="secret">
55+
<properties>
56+
<help>TSIG key secret (base64-encoded)</help>
57+
<constraint>
58+
<validator name="base64"/>
59+
</constraint>
60+
</properties>
61+
</leafNode>
62+
</children>
63+
</tagNode>
64+
<tagNode name="forward-domain">
65+
<properties>
66+
<help>Forward DNS domain name</help>
67+
<constraint>
68+
<validator name="fqdn"/>
69+
</constraint>
70+
<constraintErrorMessage>Invalid forward DNS domain name</constraintErrorMessage>
71+
</properties>
72+
<children>
73+
<leafNode name="key-name">
74+
<properties>
75+
<help>TSIG key name for forward DNS updates</help>
76+
<constraint>
77+
#include <include/constraint/alpha-numeric-hyphen-underscore.xml.i>
78+
</constraint>
79+
<constraintErrorMessage>Invalid TSIG key name. May only contain letters, numbers, numbers, hyphen and underscore</constraintErrorMessage>
80+
</properties>
81+
</leafNode>
82+
#include <include/dhcp/ddns-dns-server.xml.i>
83+
</children>
84+
</tagNode>
85+
<tagNode name="reverse-domain">
86+
<properties>
87+
<help>Reverse DNS domain name</help>
88+
<constraint>
89+
<validator name="fqdn"/>
90+
</constraint>
91+
<constraintErrorMessage>Invalid reverse DNS domain name</constraintErrorMessage>
92+
</properties>
93+
<children>
94+
<leafNode name="key-name">
95+
<properties>
96+
<help>TSIG key name for reverse DNS updates</help>
97+
<constraint>
98+
#include <include/constraint/alpha-numeric-hyphen-underscore.xml.i>
99+
</constraint>
100+
<constraintErrorMessage>Invalid TSIG key name. May only contain letters, numbers, numbers, hyphen and underscore</constraintErrorMessage>
101+
</properties>
102+
</leafNode>
103+
#include <include/dhcp/ddns-dns-server.xml.i>
104+
</children>
105+
</tagNode>
106+
</children>
107+
</node>
108+
<node name="high-availability">
109+
<properties>
110+
<help>DHCP high availability configuration</help>
111+
</properties>
112+
<children>
113+
#include <include/source-address-ipv4.xml.i>
114+
<leafNode name="mode">
115+
<properties>
116+
<help>Configure high availability mode</help>
117+
<completionHelp>
118+
<list>active-active active-passive</list>
119+
</completionHelp>
120+
<valueHelp>
121+
<format>active-active</format>
122+
<description>Both server attend DHCP requests</description>
123+
</valueHelp>
124+
<valueHelp>
125+
<format>active-passive</format>
126+
<description>Only primary server attends DHCP requests</description>
127+
</valueHelp>
128+
<constraint>
129+
<regex>(active-active|active-passive)</regex>
130+
</constraint>
131+
<constraintErrorMessage>Invalid DHCP high availability mode</constraintErrorMessage>
132+
</properties>
133+
<defaultValue>active-active</defaultValue>
134+
</leafNode>
135+
<leafNode name="remote">
136+
<properties>
137+
<help>IPv4 remote address used for connection</help>
138+
<valueHelp>
139+
<format>ipv4</format>
140+
<description>IPv4 address of high availability peer</description>
141+
</valueHelp>
142+
<constraint>
143+
<validator name="ipv4-address"/>
144+
</constraint>
145+
</properties>
146+
</leafNode>
147+
<leafNode name="name">
148+
<properties>
149+
<help>Peer name used to identify connection</help>
150+
<constraint>
151+
#include <include/constraint/alpha-numeric-hyphen-underscore-dot.xml.i>
152+
</constraint>
153+
<constraintErrorMessage>Invalid failover peer name. May only contain letters, numbers and .-_</constraintErrorMessage>
154+
</properties>
155+
</leafNode>
156+
<leafNode name="status">
157+
<properties>
158+
<help>High availability hierarchy</help>
159+
<completionHelp>
160+
<list>primary secondary</list>
161+
</completionHelp>
162+
<valueHelp>
163+
<format>primary</format>
164+
<description>Configure this server to be the primary node</description>
165+
</valueHelp>
166+
<valueHelp>
167+
<format>secondary</format>
168+
<description>Configure this server to be the secondary node</description>
169+
</valueHelp>
170+
<constraint>
171+
<regex>(primary|secondary)</regex>
172+
</constraint>
173+
<constraintErrorMessage>Invalid DHCP high availability peer status</constraintErrorMessage>
174+
</properties>
175+
</leafNode>
176+
#include <include/pki/ca-certificate.xml.i>
177+
#include <include/pki/certificate.xml.i>
178+
</children>
179+
</node>
180+
<leafNode name="hostfile-update">
181+
<properties>
182+
<help>Updating /etc/hosts file (per client lease)</help>
183+
<valueless/>
184+
</properties>
185+
</leafNode>
186+
#include <include/listen-address-ipv4.xml.i>
187+
#include <include/listen-interface-multi-broadcast.xml.i>
188+
<tagNode name="shared-network-name">
189+
<properties>
190+
<help>Name of DHCP shared network</help>
191+
<constraint>
192+
#include <include/constraint/alpha-numeric-hyphen-underscore-dot.xml.i>
193+
</constraint>
194+
<constraintErrorMessage>Invalid shared network name. May only contain letters, numbers and .-_</constraintErrorMessage>
195+
</properties>
196+
<children>
197+
<node name="dynamic-dns-update">
198+
<properties>
199+
<help>Dynamically update Domain Name System (RFC4702)</help>
200+
</properties>
201+
<children>
202+
#include <include/dhcp/ddns-settings.xml.i>
203+
</children>
204+
</node>
205+
<leafNode name="authoritative">
206+
<properties>
207+
<help>Option to make DHCP server authoritative for this physical network</help>
208+
<valueless/>
209+
</properties>
210+
</leafNode>
211+
#include <include/dhcp/option-v4.xml.i>
212+
#include <include/dhcp/ping-check.xml.i>
213+
#include <include/generic-description.xml.i>
214+
#include <include/generic-disable-node.xml.i>
215+
<tagNode name="subnet">
216+
<properties>
217+
<help>DHCP subnet for shared network</help>
218+
<valueHelp>
219+
<format>ipv4net</format>
220+
<description>IPv4 address and prefix length</description>
221+
</valueHelp>
222+
<constraint>
223+
<validator name="ipv4-prefix"/>
224+
</constraint>
225+
<constraintErrorMessage>Invalid IPv4 subnet definition</constraintErrorMessage>
226+
</properties>
227+
<children>
228+
#include <include/dhcp/option-v4.xml.i>
229+
#include <include/dhcp/ping-check.xml.i>
230+
#include <include/generic-description.xml.i>
231+
#include <include/generic-disable-node.xml.i>
232+
<node name="dynamic-dns-update">
233+
<properties>
234+
<help>Dynamically update Domain Name System (RFC4702)</help>
235+
</properties>
236+
<children>
237+
#include <include/dhcp/ddns-settings.xml.i>
238+
</children>
239+
</node>
240+
<leafNode name="exclude">
241+
<properties>
242+
<help>IP address to exclude from DHCP lease range</help>
243+
<valueHelp>
244+
<format>ipv4</format>
245+
<description>IPv4 address to exclude from lease range</description>
246+
</valueHelp>
247+
<constraint>
248+
<validator name="ipv4-address"/>
249+
</constraint>
250+
<multi/>
251+
</properties>
252+
</leafNode>
253+
<leafNode name="ignore-client-id">
254+
<properties>
255+
<help>Ignore client identifier for lease lookups</help>
256+
<valueless/>
257+
</properties>
258+
</leafNode>
259+
<leafNode name="lease">
260+
<properties>
261+
<help>Lease timeout in seconds</help>
262+
<valueHelp>
263+
<format>u32</format>
264+
<description>DHCP lease time in seconds</description>
265+
</valueHelp>
266+
<constraint>
267+
<validator name="numeric" argument="--range 0-4294967295"/>
268+
</constraint>
269+
<constraintErrorMessage>DHCP lease time must be between 0 and 4294967295 (49 days)</constraintErrorMessage>
270+
</properties>
271+
<defaultValue>86400</defaultValue>
272+
</leafNode>
273+
<tagNode name="range">
274+
<properties>
275+
<help>DHCP lease range</help>
276+
<constraint>
277+
#include <include/constraint/alpha-numeric-hyphen-underscore-dot.xml.i>
278+
</constraint>
279+
<constraintErrorMessage>Invalid range name, may only be alphanumeric, dot and hyphen</constraintErrorMessage>
280+
</properties>
281+
<children>
282+
#include <include/dhcp/option-v4.xml.i>
283+
<leafNode name="start">
284+
<properties>
285+
<help>First IP address for DHCP lease range</help>
286+
<valueHelp>
287+
<format>ipv4</format>
288+
<description>IPv4 start address of pool</description>
289+
</valueHelp>
290+
<constraint>
291+
<validator name="ipv4-address"/>
292+
</constraint>
293+
</properties>
294+
</leafNode>
295+
<leafNode name="stop">
296+
<properties>
297+
<help>Last IP address for DHCP lease range</help>
298+
<valueHelp>
299+
<format>ipv4</format>
300+
<description>IPv4 end address of pool</description>
301+
</valueHelp>
302+
<constraint>
303+
<validator name="ipv4-address"/>
304+
</constraint>
305+
</properties>
306+
</leafNode>
307+
</children>
308+
</tagNode>
309+
<tagNode name="static-mapping">
310+
<properties>
311+
<help>Hostname for static mapping reservation</help>
312+
<constraint>
313+
<validator name="fqdn"/>
314+
</constraint>
315+
<constraintErrorMessage>Invalid static mapping hostname</constraintErrorMessage>
316+
</properties>
317+
<children>
318+
#include <include/dhcp/option-v4.xml.i>
319+
#include <include/generic-description.xml.i>
320+
#include <include/generic-disable-node.xml.i>
321+
#include <include/ip-address.xml.i>
322+
#include <include/interface/mac.xml.i>
323+
#include <include/interface/duid.xml.i>
324+
</children>
325+
</tagNode>
326+
<leafNode name="subnet-id">
327+
<properties>
328+
<help>Unique ID mapped to leases in the lease file</help>
329+
<valueHelp>
330+
<format>u32</format>
331+
<description>Unique subnet ID</description>
332+
</valueHelp>
333+
<constraint>
334+
<validator name="numeric" argument="--range 1-4294967295"/>
335+
</constraint>
336+
</properties>
337+
</leafNode>
338+
</children>
339+
</tagNode>
340+
</children>
341+
</tagNode>
342+
<!-- include end -->

0 commit comments

Comments
 (0)