6 # Sample configuration file for ISC dhcpd for Debian
8 # Attention: If /etc/ltsp/dhcpd.conf exists, that will be used as
9 # configuration file instead of this file.
11 # $Id: dhcpd.conf,v 1.1.1.1 2002/05/21 00:07:44 peloy Exp $
14 # The ddns-updates-style parameter controls whether or not the server will
15 # attempt to do a DNS update when a lease is confirmed. We default to the
16 # behavior of the version 2 packages ('none', since DHCP v2 didn't
17 # have support for DDNS.)
18 ddns-update-style none;
20 # option definitions common to all supported networks...
21 option domain-name \"example.org\";
22 option domain-name-servers ns1.example.org, ns2.example.org;
24 default-lease-time 600;
27 # If this DHCP server is the official DHCP server for the local
28 # network, the authoritative directive should be uncommented.
34 # Use this to send dhcp log messages to a different log file (you also
35 # have to hack syslog.conf to complete the redirection).
38 # No service will be given on this subnet, but declaring it helps the
39 # DHCP server to understand the network topology.
41 subnet 10.152.187.0 netmask 255.255.255.0 {
44 # This is a very basic subnet declaration.
46 subnet 10.254.239.0 netmask 255.255.255.224 {
47 range 10.254.239.10 10.254.239.20;
48 option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
51 # This declaration allows BOOTP clients to get dynamic addresses,
52 # which we don't really recommend.
54 subnet 10.254.239.32 netmask 255.255.255.224 {
55 range dynamic-bootp 10.254.239.40 10.254.239.60;
56 option broadcast-address 10.254.239.31;
57 option routers rtr-239-32-1.example.org;
60 # A slightly different configuration for an internal subnet.
61 subnet 10.5.5.0 netmask 255.255.255.224 {
62 range 10.5.5.26 10.5.5.30;
63 option domain-name-servers ns1.internal.example.org;
64 option domain-name \"internal.example.org\";
65 option routers 10.5.5.1;
66 option broadcast-address 10.5.5.31;
67 default-lease-time 600;
71 # Hosts which require special configuration options can be listed in
72 # host statements. If no address is specified, the address will be
73 # allocated dynamically (if possible), but the host-specific information
74 # will still come from the host declaration.
77 hardware ethernet 0:0:c0:5d:bd:95;
78 filename \"vmunix.passacaglia\";
79 server-name \"toccata.fugue.com\";
82 # Fixed IP addresses can also be specified for hosts. These addresses
83 # should not also be listed as being available for dynamic assignment.
84 # Hosts for which fixed IP addresses have been specified can boot using
85 # BOOTP or DHCP. Hosts for which no fixed address is specified can only
86 # be booted with DHCP, unless there is an address range on the subnet
87 # to which a BOOTP client is connected which has the dynamic-bootp flag
90 hardware ethernet 08:00:07:26:c0:a5;
91 fixed-address fantasia.fugue.com;
94 # You can declare a class of clients and then do address allocation
95 # based on that. The example below shows a case where all clients
96 # in a certain class get addresses on the 10.17.224/24 subnet, and all
97 # other clients get addresses on the 10.0.29/24 subnet.
100 # match if substring (option vendor-class-identifier, 0, 4) = \"SUNW\";
103 shared-network 224-29 {
104 subnet 10.17.224.0 netmask 255.255.255.0 {
105 option routers rtr-224.example.org;
107 subnet 10.0.29.0 netmask 255.255.255.0 {
108 option routers rtr-29.example.org;
111 allow members of \"foo\";
112 range 10.17.224.10 10.17.224.250;
115 deny members of \"foo\";
116 range 10.0.29.10 10.0.29.230;
121 test lns get "authoritative;" = { "authoritative" }
122 test lns get "ddns-update-style none;" = { "ddns-update-style" = "none" }
123 test lns get "option domain-name \"example.org\";" =
126 { "arg" = "example.org" }
130 test lns get "option domain-name-servers ns1.example.org, ns2.example.org;" =
132 { "domain-name-servers"
133 { "arg" = "ns1.example.org" }
134 { "arg" = "ns2.example.org" }
138 test lns get "default-lease-time 600;" = { "default-lease-time" = "600" }
139 test lns get "range 10.254.239.60;" =
141 { "to" = "10.254.239.60" }
144 test lns get "range dynamic-bootp 10.254.239.60;" =
146 { "flag" = "dynamic-bootp" }
147 { "to" = "10.254.239.60" }
150 test lns get "range dynamic-bootp 10.254.239.40 10.254.239.60;" =
152 { "flag" = "dynamic-bootp" }
153 { "from" = "10.254.239.40" }
154 { "to" = "10.254.239.60" }
157 test lns get "subnet 10.152.187.0 netmask 255.255.255.0 {}\n" =
159 { "network" = "10.152.187.0" }
160 { "netmask" = "255.255.255.0" }
163 test lns get " pool {
173 test lns get "group { host some-host {hardware ethernet 00:00:aa:bb:cc:dd;
174 fixed-address 10.1.1.1;}}" =
176 { "host" = "some-host"
178 { "type" = "ethernet" }
179 { "address" = "00:00:aa:bb:cc:dd" }
181 { "fixed-address" = "10.1.1.1" }
185 test lns get "group fan-tas_tic { }" =
186 { "group" = "fan-tas_tic" }
188 test Dhcpd.stmt_secu get "allow members of \"foo\";" = { "allow-members-of" = "foo" }
189 test Dhcpd.stmt_secu get "allow booting;" = { "allow" = "booting" }
190 test Dhcpd.stmt_secu get "allow bootp;" = { "allow" = "bootp" }
191 test Dhcpd.stmt_option get "option voip-boot-server code 66 = string;" =
193 { "label" = "voip-boot-server" }
195 { "type" = "string" }
198 test Dhcpd.stmt_option get "option special-option code 25 = array of string;" =
200 { "label" = "special-option" }
202 { "type" = "array of string" }
205 test Dhcpd.stmt_option get "option special-option code 25 = integer 32;" =
207 { "label" = "special-option" }
209 { "type" = "integer 32" }
213 test Dhcpd.stmt_option get "option special-option code 25 = array of integer 32;" =
215 { "label" = "special-option" }
217 { "type" = "array of integer 32" }
222 test Dhcpd.lns get "authoritative;
224 ddns-update-style none;
225 default-lease-time 21600;
226 max-lease-time 43200;
228 # Additional options for VOIP
229 option voip-boot-server code 66 = string;
230 option voip-vlan-id code 128 = string;
233 { "log-facility" = "local7" }
234 { "ddns-update-style" = "none" }
235 { "default-lease-time" = "21600" }
236 { "max-lease-time" = "43200"
237 { "#comment" = "Additional options for VOIP" }
240 { "label" = "voip-boot-server" }
242 { "type" = "string" }
245 { "label" = "voip-vlan-id" }
247 { "type" = "string" }
252 option domain-name-servers 10.1.1.1, 10.11.2.1, 10.1.3.1;
253 next-server 10.1.1.1;
255 failover peer \"redondance01\" {
259 peer address 10.1.1.1;
261 max-response-delay 20;
262 max-unacked-updates 10;
265 load balance max seconds 3;
270 { "domain-name-servers"
271 { "arg" = "10.1.1.1" }
272 { "arg" = "10.11.2.1" }
273 { "arg" = "10.1.3.1" }
276 { "next-server" = "10.1.1.1" }
277 { "failover peer" = "redondance01"
279 { "address" = "10.1.1.1" }
281 { "peer address" = "10.1.1.1" }
282 { "peer port" = "647" }
283 { "max-response-delay" = "20" }
284 { "max-unacked-updates" = "10" }
286 { "#comment" = "comment." }
289 { "#comment" = "comment." }
291 { "load balance max seconds" = "3" }
295 (* test get and put for record types *)
296 let record_test = "option test_records code 123 = { string, ip-address, integer 32, ip6-address, domain-list };"
298 test Dhcpd.lns get record_test =
300 { "label" = "test_records" }
304 { "2" = "ip-address" }
305 { "3" = "integer 32" }
306 { "4" = "ip6-address" }
307 { "5" = "domain-list" }
311 test Dhcpd.lns put record_test after set "/rfc-code[1]/code" "124" =
312 "option test_records code 124 = { string, ip-address, integer 32, ip6-address, domain-list };"
315 option CallManager code 150 = ip-address;
316 option slp-directory-agent true 10.1.1.1, 10.2.2.2;
317 option slp-service-scope true \"SLP-GLOBAL\";
318 option nds-context \"EXAMPLE\";
319 option nds-tree-name \"EXAMPLE\";
323 { "label" = "CallManager" }
325 { "type" = "ip-address" }
328 { "slp-directory-agent" = "true"
329 { "arg" = "10.1.1.1" }
330 { "arg" = "10.2.2.2" }
334 { "slp-service-scope" = "true"
335 { "arg" = "SLP-GLOBAL" }
340 { "arg" = "EXAMPLE" }
345 { "arg" = "EXAMPLE" }
350 test Dhcpd.lns get "option voip-vlan-id \"VLAN=1234;\";" =
353 { "arg" = "VLAN=1234;" }
357 test Dhcpd.lns get "option domain-name \"x.example.com y.example.com z.example.com\";" =
360 { "arg" = "x.example.com y.example.com z.example.com" }
364 test Dhcpd.lns get "include \"/etc/dhcpd.master\";" =
365 { "include" = "/etc/dhcpd.master" }
367 test Dhcpd.lns put "\n" after set "/include" "/etc/dhcpd.master" =
368 "\ninclude \"/etc/dhcpd.master\";\n"
370 test Dhcpd.fct_args get "(option dhcp-client-identifier, 1, 3)" =
372 { "arg" = "option dhcp-client-identifier" }
377 test Dhcpd.stmt_match get "match if substring (option dhcp-client-identifier, 1, 3) = \"RAS\";" =
379 { "function" = "substring"
381 { "arg" = "option dhcp-client-identifier" }
389 test Dhcpd.stmt_match get "match if suffix (option dhcp-client-identifier, 4) = \"RAS\";" =
391 { "function" = "suffix"
393 { "arg" = "option dhcp-client-identifier" }
400 test Dhcpd.stmt_match get "match if option vendor-class-identifier=\"RAS\";" =
402 { "option" = "vendor-class-identifier"
408 test Dhcpd.lns get "match pick-first-value (option dhcp-client-identifier, hardware);" =
410 { "function" = "pick-first-value"
412 { "arg" = "option dhcp-client-identifier" }
413 { "arg" = "hardware" }
418 test Dhcpd.fct_args get "(16, 32, \"\", substring(hardware, 0, 4))" =
423 { "arg" = "substring(hardware, 0, 4)" }
426 test Dhcpd.stmt_match get "match if binary-to-ascii(16, 32, \"\", substring(hardware, 0, 4)) = \"1525400\";" =
428 { "function" = "binary-to-ascii"
433 { "arg" = "substring(hardware, 0, 4)" }
436 { "value" = "1525400" }
439 test Dhcpd.lns get "subclass allocation-class-1 1:8:0:2b:4c:39:ad;" =
441 { "name" = "allocation-class-1" }
442 { "value" = "1:8:0:2b:4c:39:ad" }
446 test Dhcpd.lns get "subclass \"allocation-class-1\" 1:8:0:2b:4c:39:ad;" =
448 { "name" = "allocation-class-1" }
449 { "value" = "1:8:0:2b:4c:39:ad" }
452 test Dhcpd.lns get "subclass \"quoted class\" \"quoted value\";" =
454 { "name" = "quoted class" }
455 { "value" = "quoted value" }
460 test Dhcpd.lns put conf after rm "/x" = conf
462 (* bug #293: primary should support argument *)
463 let input293 = "zone EXAMPLE.ORG. {
467 test Dhcpd.lns get input293 =
468 { "zone" = "EXAMPLE.ORG."
469 { "primary" = "127.0.0.1" }
472 (* bug #311: filename should be quoted *)
473 let input311 = "subnet 172.16.0.0 netmask 255.255.255.0 {
474 filename \"pxelinux.0\";
477 test Dhcpd.lns put "subnet 172.16.0.0 netmask 255.255.255.0 {
479 set "subnet/filename" "pxelinux.0" = input311
481 (* GH issue #34: support conditional structures *)
482 let gh34_empty = "if exists dhcp-parameter-request-list {
485 test Dhcpd.lns get gh34_empty =
486 { "@if" = "exists dhcp-parameter-request-list" }
488 let gh34_empty_multi = "subnet 192.168.100.0 netmask 255.255.255.0 {
495 test Dhcpd.lns get gh34_empty_multi =
497 { "network" = "192.168.100.0" }
498 { "netmask" = "255.255.255.0" }
500 { "@elsif" = "false" }
504 let gh34_simple = "if exists dhcp-parameter-request-list {
505 default-lease-time 600;
507 default-lease-time 200;
510 test Dhcpd.lns get gh34_simple =
511 { "@if" = "exists dhcp-parameter-request-list"
512 { "default-lease-time" = "600" }
514 { "default-lease-time" = "200" } } }
516 test Dhcpd.lns get "omapi-key fookey;" =
517 { "omapi-key" = "fookey" }
519 (* almost all DHCP groups should support braces starting on the next line *)
520 test Dhcpd.lns get "class introduction
523 { "class" = "introduction" }
525 (* equals should work the same *)
526 test Dhcpd.lns get "option test_records code 123 =
529 { "label" = "test_records" }
531 { "type" = "string" }
534 test Dhcpd.lns get "deny members of \"Are things like () allowed?\";" =
535 { "deny-members-of" = "Are things like () allowed?" }
537 test Dhcpd.lns get "deny unknown clients;" =
538 { "deny" = "unknown clients" }
539 test Dhcpd.lns get "deny known-clients;" =
540 { "deny" = "known-clients" }
542 test Dhcpd.lns get "set ClientMac = binary-to-ascii(16, 8, \":\" , substring(hardware, 1, 6));" =
543 { "set" = "ClientMac"
544 { "value" = "binary-to-ascii(16, 8, \":\" , substring(hardware, 1, 6))" }
547 test Dhcpd.lns get "set myvariable = foo;" =
548 { "set" = "myvariable"
552 test Dhcpd.stmt_hardware get "hardware fddi 00:01:02:03:04:05;" =
555 { "address" = "00:01:02:03:04:05" }
558 test Dhcpd.lns get "on commit
564 { "value" = "thing" }
568 (* key block get/put/set test *)
569 let key_tests = "key sample {
574 key \"interesting\" { };
580 test Dhcpd.lns get key_tests =
581 { "key_block" = "sample"
582 { "algorithm" = "hmac-md5" }
583 { "secret" = "secret==" }
585 { "key_block" = "interesting" }
586 { "key_block" = "third key"
587 { "secret" = "two==" }
590 test Dhcpd.lns put key_tests after set "/key_block[1]" "sample2" =
596 key \"interesting\" { };
602 test Dhcpd.lns get "group \"hello\" { }" =
603 { "group" = "hello" }
605 test Dhcpd.lns get "class \"testing class with spaces and quotes and ()\" {}" =
606 { "class" = "testing class with spaces and quotes and ()" }