summaryrefslogtreecommitdiff
path: root/server/dhcpd.conf.5
blob: a42f0cf0bac8e93fd0314b9f764f6d487be4ef71 (plain)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
.\"	dhcpd.conf.5
.\"
.\" Copyright (c) 1996-1999 Internet Software Consortium.
.\" Use is subject to license terms which appear in the file named
.\" ISC-LICENSE that should have accompanied this file when you
.\" received it.   If a file named ISC-LICENSE did not accompany this
.\" file, or you are not sure the one you have is correct, you may
.\" obtain an applicable copy of the license at:
.\"
.\"             http://www.isc.org/isc-license-1.0.html. 
.\"
.\" This file is part of the ISC DHCP distribution.   The documentation
.\" associated with this file is listed in the file DOCUMENTATION,
.\" included in the top-level directory of this release.
.\"
.\" Support and other services are available for ISC products - see
.\" http://www.isc.org for more information.
.TH dhcpd.conf 5
.SH NAME
dhcpd.conf - dhcpd configuration file
.SH DESCRIPTION
The dhcpd.conf file contains configuration information for
.IR dhcpd,
the Internet Software Consortium DHCP Server.
.PP
The dhcpd.conf file is a free-form ASCII text file.   It is parsed by
the recursive-descent parser built into dhcpd.   The file may contain
extra tabs and newlines for formatting purposes.  Keywords in the file
are case-insensitive.   Comments may be placed anywhere within the
file (except within quotes).   Comments begin with the # character and
end at the end of the line.
.PP
The file essentially consists of a list of statements.   Statements
fall into two broad categories - parameters and declarations.
.PP
Parameter statements either say how to do something (e.g., how long a
lease to offer), whether to do something (e.g., should dhcpd provide
addresses to unknown clients), or what parameters to provide to the
client (e.g., use gateway 220.177.244.7).
.PP
Declarations are used to describe the topology of the
network, to describe clients on the network, to provide addresses that
can be assigned to clients, or to apply a group of parameters to a
group of declarations.   In any group of parameters and declarations,
all parameters must be specified before any declarations which depend
on those parameters may be specified.
.PP
Declarations about network topology include the
 \fIshared-network\fR and the \fIsubnet\fR
declarations.   If clients on a subnet are to be assigned addresses
dynamically, a \fIrange\fR declaration must appear within the
\fIsubnet\fR declaration.   For clients with statically assigned
addresses, or for installations where only known clients will be
served, each such client must have a \fIhost\fR declaration.   If
parameters are to be applied to a group of declarations which are not
related strictly on a per-subnet basis, the \fIgroup\fR declaration
can be used.
.PP
For every subnet which will be served, and for every subnet
to which the dhcp server is connected, there must be one \fIsubnet\fR
declaration, which tells dhcpd how to recognize that an address is on
that subnet.  A \fIsubnet\fR declaration is required for each subnet
even if no addresses will be dynamically allocated on that subnet.
.PP
Some installations have physical networks on which more than one IP
subnet operates.   For example, if there is a site-wide requirement
that 8-bit subnet masks be used, but a department with a single
physical ethernet network expands to the point where it has more than
254 nodes, it may be necessary to run two 8-bit subnets on the same
ethernet until such time as a new physical network can be added.   In
this case, the \fIsubnet\fR declarations for these two networks may be
enclosed in a \fIshared-network\fR declaration.
.PP
Some sites may have departments which have clients on more than one
subnet, but it may be desirable to offer those clients a uniform set
of parameters which are different than what would be offered to
clients from other departments on the same subnet.   For clients which
will be declared explicitly with \fIhost\fR declarations, these
declarations can be enclosed in a \fIgroup\fR declaration along with
the parameters which are common to that department.   For clients
whose addresses will be dynamically assigned, there is currently no
way to group parameter assignments other than by network topology.
.PP
When a client is to be booted, its boot parameters are determined by
first consulting that client's \fIhost\fR declaration (if any), then
consulting the \fIgroup\fR declaration (if any) which enclosed that
\fIhost\fR declaration, then consulting the \fIsubnet\fR declaration
for the subnet on which the client is booting, then consulting the
\fIshared-network\fR declaration (if any) containing that subnet, and
finally consulting the top-level parameters which may be specified
outside of any declaration.
.PP
When dhcpd tries to find a \fIhost\fR declaration for a client, it
first looks for a \fIhost\fR declaration which has a
\fIfixed-address\fR parameter which matches the subnet or shared
network on which the client is booting.   If it doesn't find any such
entry, it then tries to find an entry which has no \fIfixed-address\fR
parameter.   If no such entry is found, then dhcpd acts as if there is
no entry in the dhcpd.conf file for that client, even if there is an
entry for that client on a different subnet or shared network.
.SH EXAMPLES
.PP
A typical dhcpd.conf file will look something like this:
.nf

.I global parameters...

subnet 204.254.239.0 netmask 255.255.255.224 {
  \fIsubnet-specific parameters...\fR
  range 204.254.239.10 204.254.239.30;
}

subnet 204.254.239.32 netmask 255.255.255.224 {
  \fIsubnet-specific parameters...\fR
  range 204.254.239.42 204.254.239.62;
}

subnet 204.254.239.64 netmask 255.255.255.224 {
  \fIsubnet-specific parameters...\fR
  range 204.254.239.74 204.254.239.94;
}

group {
  \fIgroup-specific parameters...\fR
  host zappo.test.isc.org {
    \fIhost-specific parameters...\fR
  }
  host beppo.test.isc.org {
    \fIhost-specific parameters...\fR
  }
  host harpo.test.isc.org {
    \fIhost-specific parameters...\fR
  }
}

.ce 1
Figure 1

.fi
.PP
Notice that at the beginning of the file, there's a place
for global parameters.   These might be things like the organization's
domain name, the addresses of the name servers (if they are common to
the entire organization), and so on.   So, for example:
.nf

	option domain-name "isc.org";
	option domain-name-servers ns1.isc.org, ns2.isc.org;

.ce 1
Figure 2
.fi
.PP
As you can see in Figure 2, you can specify host addresses in
parameters using their domain names rather than their numeric IP
addresses.  If a given hostname resolves to more than one IP address
(for example, if that host has two ethernet interfaces), then where
possible, both addresses are supplied to the client.
.PP
The most obvious reason for having subnet-specific parameters as
shown in Figure 1 is that each subnet, of necessity, has its own
router.   So for the first subnet, for example, there should be
something like:
.nf

	option routers 204.254.239.1;
.fi
.PP
Note that the address here is specified numerically.   This is not
required - if you have a different domain name for each interface on
your router, it's perfectly legitimate to use the domain name for that
interface instead of the numeric address.   However, in many cases
there may be only one domain name for all of a router's IP addresses, and
it would not be appropriate to use that name here.
.PP
In Figure 1 there is also a \fIgroup\fR statement, which provides
common parameters for a set of three hosts - zappo, beppo and harpo.
As you can see, these hosts are all in the test.isc.org domain, so it
might make sense for a group-specific parameter to override the domain
name supplied to these hosts:
.nf

	option domain-name "test.isc.org";
.fi
.PP
Also, given the domain they're in, these are probably test machines.
If we wanted to test the DHCP leasing mechanism, we might set the
lease timeout somewhat shorter than the default:

.nf
	max-lease-time 120;
	default-lease-time 120;
.fi
.PP
You may have noticed that while some parameters start with the
\fIoption\fR keyword, some do not.   Parameters starting with the
\fIoption\fR keyword correspond to actual DHCP options, while
parameters that do not start with the option keyword either control
the behaviour of the DHCP server (e.g., how long a lease dhcpd will
give out), or specify client parameters that are not optional in the
DHCP protocol (for example, server-name and filename).
.PP
In Figure 1, each host had \fIhost-specific parameters\fR.   These
could include such things as the \fIhostname\fR option, the name of a
file to upload (the \fIfilename parameter) and the address of the
server from which to upload the file (the \fInext-server\fR
parameter).   In general, any parameter can appear anywhere that
parameters are allowed, and will be applied according to the scope in
which the parameter appears.
.PP
Imagine that you have a site with a lot of NCD X-Terminals.   These
terminals come in a variety of models, and you want to specify the
boot files for each models.   One way to do this would be to have host
declarations for each server and group them by model:
.nf

group {
  filename "Xncd19r";
  next-server ncd-booter;

  host ncd1 { hardware ethernet 0:c0:c3:49:2b:57; }
  host ncd4 { hardware ethernet 0:c0:c3:80:fc:32; }
  host ncd8 { hardware ethernet 0:c0:c3:22:46:81; }
}

group {
  filename "Xncd19c";
  next-server ncd-booter;

  host ncd2 { hardware ethernet 0:c0:c3:88:2d:81; }
  host ncd3 { hardware ethernet 0:c0:c3:00:14:11; }
}

group {
  filename "XncdHMX";
  next-server ncd-booter;

  host ncd1 { hardware ethernet 0:c0:c3:11:90:23; }
  host ncd4 { hardware ethernet 0:c0:c3:91:a7:8; }
  host ncd8 { hardware ethernet 0:c0:c3:cc:a:8f; }
}
.fi
.SH ADDRESS POOLS
.PP
The
.B pool
declaration can be used to specify a pool of addresses that will be
treated differently than another pool of addresses, even on the same
network segment or subnet.   For example, you may want to provide a
large set of addresses that can be assigned to DHCP clients that are
registered to your DHCP server, while providing a smaller set of
addresses, possibly with short lease times, that are available for
unknown clients.   If you have a firewall, you may be able to arrange
for addresses from one pool to be allowed access to the Internet,
while addresses in another pool are not, thus encouraging users to
register their DHCP clients.   To do this, you would set up a pair of
pool declarations:
.PP
.nf
subnet 10.0.0.0 netmask 255.255.255.0 {
  option routers 10.0.0.254;

  # Unknown clients get this pool.
  pool {
    option domain-name-servers bogus.example.com;
    max-lease-time 300;
    range 10.0.0.200 10.0.0.253;
    allow unknown clients;
  }

  # Known clients get this pool.
  pool {
    option domain-name-servers ns1.example.com, ns2.example.com;
    max-lease-time 28800;
    range 10.0.0.5 10.0.0.199;
    deny unknown clients;
  }
}
.fi
.PP
It is also possible to set up entirely different subnets for known and
unknown clients - address pools exist at the level of shared networks,
so address ranges within pool declarations can be on different
subnets.
.PP
As you can see in the preceding example, pools can have permit lists
that control which clients are allowed access to the pool and which
aren't.  Each entry in a pool's permit list is introduced with the
.I allow
or \fIdeny\fR keyword.   If a pool has a permit list, then only those
clients that match specific entries on the permit list will be
elegible to be assigned addresses from the pool.   If a pool has a
deny list, then only those clients that do not match any entries on
the deny list will be elegible.    If both permit and deny lists exist
for a pool, then only clients that match the permit list and do not
match the deny list will be allowed access.
.SH ADDRESS ALLOCATION
Address allocation is actually only done when a client is in the INIT
state and has sent a DHCPDISCOVER message.  If the client thinks it
has a valid lease and sends a DHCPREQUEST to initiate or renew that
lease, the server has only three choices - it can ignore the
DHCPREQUEST, send a DHCPNAK to tell the client it should stop using
the address, or send a DHCPACK, telling the client to go ahead and use
the address for a while.  If the server finds the address the client
is requesting, and that address is available to the client, the server
will send a DHCPACK.  If the address is no longer available, or the
client isn't permitted to have it, the server will send a DHCPNAK.  If
the server knows nothing about the, it will remain silent, unless the
address is incorrect for the network segment to which the client has
been attached and the server is authoritative for that network
segment, in which case the server will send a DHCPNAK even though it
doesn't know about the address.
.PP
When the DHCP server allocates a new address for a client (remember,
this only happens if the client has sent a DHCPDISCOVER), it first
looks to see if the client already has a valid lease on an IP address,
or if there is an old IP address the client had before that hasn't yet
been reassigned.  In that case, the server will take that address and
check it to see if the client is still permitted to use it.  If the
client is no longer permitted to use it, the lease is freed if the
server thought it was still in use - the fact that the client has sent
a DHCPDISCOVER proves to the server that the client is no longer using
the lease.
.PP
If no existing lease is found, or if the client is forbidden to
receive the existing lease, then the server will look in the list of
address pools for the network segment to which the client is attached
for a lease that is not in use and that the client is permitted to
have.   It looks through each pool declaration in sequence (all
.I range
declarations that appear outside of pool declarations are grouped into
a single pool with no permit list).   If the permit list for the pool
allows the client to be allocated an address from that pool, the pool
is examined to see if there is an address available.   If so, then the
client is tentatively assigned that address.   Otherwise, the next
pool is tested.   If no addresses are found that can be assigned to
the client, no response is sent to the client.
.PP
If an address is found that the client is permitted to have, and that
has never been assigned to any client before, the address is
immediately allocated to the client.   If the address is available for
allocation but has been previously assigned to a different client, the
server will keep looking in hopes of finding an address that has never
before been assigned to a client.
.SH CLIENT CLASSING
Clients can be seperated into classes, and treated differently
depending on what class they are in.   This seperation can be done
either with a conditional statement, or with a match statement within
the class declaration.   It is possible to specify a limit on the
total number of clients within a particular class or subclass that may
hold leases at one time, and it is possible to specify automatic
subclassing based on the contents of the client packet.
.PP
To add clients to classes based on conditional evaluation, you would
write an conditional statement to match the clients you wanted in the
class, and then put an
.B add
statement in the conditional's list of statements:
.PP
.nf
if substring (option dhcp-client-identifier, 0, 3) = "RAS" {
  add "ras-clients";
}
.fi
.PP
A nearly equivalent way to do this is to simply specify the conditional
expression as a matching expression in the class statement:
.PP
.nf
class "ras-clients" {
  match if substring (option dhcp-client-identifier, 0, 3) = "RAS";
}
.fi
Note that whether you use matching expressions or add statements (or
both) to classify clients, you must always write a class declaration
for any class that you use.   If there will be no match statement and
no in-scope statements for a class, the declaration should look like
this:
.nf
class "ras-clients" {
}
.fi
.PP
Also, the
.B add
statement adds the client to the class as the client's scopes are being
evaluated - after any address assignment decision has been made.   This means
that a client that's a member of a class due to an add statement will not
be affected by pool permits related to that class - when the pool permit list
is computed, the client will not yet be a member of the pool.   This is an
inconsistency that will probably be addressed in later versions of the DHCP
server, but it important to be aware of it at lease for the time being.
.PP
In addition to classes, it is possible to declare subclasses.   A
subclass is a class with the same name as a regular class, but with a
specific submatch expression which is hashed for quick matching.
This is essentially a speed hack - the main difference between five
classes with match expressions and one class with five subclasses is
that it will be quicker to find the subclasses.   Subclasses work as
follows:
.PP
.nf
class "vendor-classes" {
  match option vendor-class-identifier;
}

subclass "vendor-classes" "SUNW.Ultra-5_10" {
  option vendor-encapsulated-options 
	   2:AC:11:41:1:
	   3:12:73:75:6e:64:68:63:70:2d:73:65:72:76:65:72:31:37:2d:31:
	   4:12:2f:65:78:70:6f:72:74:2f:72:6f:6f:74:2f:73:70:61:72:63;
}

subclass "vendor-classes" "SUNW.i86pc" {
  option vendor-encapsulated-options
	   2:4:AC:11:41:1:
	   3:12:73:75:6e:64:68:63:70:2d:73:65:72:76:65:72:31:37:2d:31:
	   4:12:2f:65:78:70:6f:72:74:2f:72:6f:6f:74:2f:69:38:36:70:63;
}
.fi
.PP
The string following the class name for the subclasses specifies the
string that is expected to match the expression in the class
declaration for the vendor-classes class.
.PP
You may specify a limit to the number of clients in a class that can
be assigned leases.   The effect of this will be to make it difficult
for a new client in a class to get an address.   Once a class with
such a limit has reached its limit, the only way a new client in that
class can get a lease is for an existing client to relinquish its
lease, either by letting it expire, or by sending a DHCPRELEASE
packet.   Classes with lease limits are specified as follows:
.PP
.nf
class "limited-1" {
  lease limit 4;
}
.fi
.PP
This will produce a class in which a maximum of four members may hold
a lease at one time.
.PP
It is possible to declare a
.I spawning class\fR.
A spawning class is a class that automatically produces subclasses
based on what the client sends.   The reason that spawning classes
were created was to make it possible to create lease-limited classes
on the fly.   The envisioned application is a cable-modem environment
where the ISP wishes to provide clients at a particular site with more
than one IP address, but does not wish to provide such clients with
their own subnet, nor give them an unlimited number of IP addresses
from the network segment to which they are connected.
.PP
Many cable modem head-end systems can be configured to add a Relay
Agent Information option to DHCP packets when relaying them to the
DHCP server.   These systems typically add a circuit ID or remote ID
option that uniquely identifies the customer site.   To take advantage
of this, you can write a class declaration as follows:
.nf
class "customer" {
  match if exists agent.circuit-id;
  spawn with agent.circuit-id;
  lease limit 4;
}
.fi
.PP
Now whenever a request comes in from a customer site, the circuit ID
option will be checked against the class's hash table.   If a subclass
is found that matches the circuit ID, the client will be classified in
that subclass and treated accordingly.   If no subclass is found
matching the circuit ID, a new one will be created and logged in the
.B dhcpd.leases
file, and the client will be classified in this new class.   Once the
client has been classified, it will be treated according to the rules
of the class, including, in this case, being subject to the per-site
limit of four leases.
.PP
The use of the subclass spawning mechanism is not restricted to relay
agent options - this particular example is given only because it is a
fairly straightforward one.
.SH REFERENCE: DECLARATIONS
.PP
.B The 
.I shared-network
.B statement
.PP
.nf
 \fBshared-network\fR \fIname\fR \fB{\fR
   [ \fIparameters\fR ]
   [ \fIdeclarations\fR ]
 \fB}\fR
.fi
.PP
The \fIshared-network\fR statement is used to inform the DHCP server
that some IP subnets actually share the same physical network.  Any
subnets in a shared network should be declared within a
\fIshared-network\fR statement.  Parameters specified in the
\fIshared-network\fR statement will be used when booting clients on
those subnets unless parameters provided at the subnet or host level
override them.  If any subnet in a shared network has addresses
available for dynamic allocation, those addresses are collected into a
common pool for that shared network and assigned to clients as needed.
There is no way to distinguish on which subnet of a shared network a
client should boot.
.PP
.I Name
should be the name of the shared network.   This name is used when
printing debugging messages, so it should be descriptive for the
shared network.   The name may have the syntax of a valid domain name
(although it will never be used as such), or it may be any arbitrary
name, enclosed in quotes.
.PP
.B The 
.I subnet
.B statement
.PP
.nf
 \fBsubnet\fR \fIsubnet-number\fR \fBnetmask\fR \fInetmask\fR \fB{\fR
   [ \fIparameters\fR ]
   [ \fIdeclarations\fR ]
 \fB}\fR
.fi
.PP
The \fIsubnet\fR statement is used to provide dhcpd with enough
information to tell whether or not an IP address is on that subnet.
It may also be used to provide subnet-specific parameters and to
specify what addresses may be dynamically allocated to clients booting
on that subnet.   Such addresses are specified using the \fIrange\fR
declaration.
.PP
The
.I subnet-number
should be an IP address or domain name which resolves to the subnet
number of the subnet being described.   The 
.I netmask
should be an IP address or domain name which resolves to the subnet mask
of the subnet being described.   The subnet number, together with the
netmask, are sufficient to determine whether any given IP address is
on the specified subnet.
.PP
Although a netmask must be given with every subnet declaration, it is
recommended that if there is any variance in subnet masks at a site, a
subnet-mask option statement be used in each subnet declaration to set
the desired subnet mask, since any subnet-mask option statement will
override the subnet mask declared in the subnet statement.
.PP
.B The
.I range
.B statement
.PP
.nf
.B range\fR [ \fBdynamic-bootp\fR ] \fIlow-address\fR [ \fIhigh-address\fR]\fB;\fR
.fi
.PP
For any subnet on which addresses will be assigned dynamically, there
must be at least one \fIrange\fR statement.   The range statement
gives the lowest and highest IP addresses in a range.   All IP
addresses in the range should be in the subnet in which the
\fIrange\fR statement is declared.   The \fIdynamic-bootp\fR flag may
be specified if addresses in the specified range may be dynamically
assigned to BOOTP clients as well as DHCP clients.   When specifying a
single address, \fIhigh-address\fR can be omitted.
.PP
.B The
.I host
.B statement
.PP
.nf
 \fBhost\fR \fIhostname\fR {
   [ \fIparameters\fR ]
   [ \fIdeclarations\fR ]
 \fB}\fR
.fi
.PP
There must be at least one
.B host
statement for every BOOTP client that is to be served.   
.B host
statements may also be specified for DHCP clients, although this is
not required unless booting is only enabled for known hosts.
.PP
If it is desirable to be able to boot a DHCP or BOOTP
client on more than one subnet with fixed addresses, more than one
address may be specified in the
.I fixed-address
parameter, or more than one
.B host
statement may be specified.
.PP
If client-specific boot parameters must change based on the network
to which the client is attached, then multiple 
.B host
statements should
be used.
.PP
If a client is to be booted using a fixed address if it's
possible, but should be allocated a dynamic address otherwise, then a
.B host
statement must be specified without a
.B fixed-address
clause.
.I hostname
should be a name identifying the host.  If a \fIhostname\fR option is
not specified for the host, \fIhostname\fR is used.
.PP
\fIHost\fR declarations are matched to actual DHCP or BOOTP clients
by matching the \fRdhcp-client-identifier\fR option specified in the
\fIhost\fR declaration to the one supplied by the client, or, if the
\fIhost\fR declaration or the client does not provide a
\fRdhcp-client-identifier\fR option, by matching the \fIhardware\fR
parameter in the \fIhost\fR declaration to the network hardware
address supplied by the client.   BOOTP clients do not normally
provide a \fIdhcp-client-identifier\fR, so the hardware address must
be used for all clients that may boot using the BOOTP protocol.
.PP
.B The
.I group
.B statement
.PP
.nf
 \fBgroup\fR {
   [ \fIparameters\fR ]
   [ \fIdeclarations\fR ]
 \fB}\fR
.fi
.PP
The group statement is used simply to apply one or more parameters to
a group of declarations.   It can be used to group hosts, shared
networks, subnets, or even other groups.
.SH REFERENCE: ALLOW AND DENY
The
.I allow
and
.I deny
statements can be used to control the behaviour of dhcpd to various
sorts of requests.   The allow and deny keywords actually have
different meanings depending on the context.   In a pool context,
these keywords can be used to set up access lists for address
allocation pools.   In other contexts, the keywords simply control
general server behaviour with respect to clients based on scope.
.PP
.SH ALLOW AND DENY IN SCOPE
The following usages of allow and deny will work in any scope,
although it is not recommended that they be used in pool
declarations.
.PP
.B The
.I unknown-clients
.B keyword
.PP
 \fBallow unknown-clients;\fR
 \fBdeny unknown-clients;\fR
.PP
The \fBunknown-clients\fR flag is used to tell dhcpd whether
or not to dynamically assign addresses to unknown clients.   Dynamic
address assignment to unknown clients is \fBallow\fRed by default.
.PP
.B The
.I bootp
.B keyword
.PP
 \fBallow bootp;\fR
 \fBdeny bootp;\fR
.PP
The \fBbootp\fR flag is used to tell dhcpd whether
or not to respond to bootp queries.  Bootp queries are \fBallow\fRed
by default.
.PP
.B The
.I booting
.B keyword
.PP
 \fBallow booting;\fR
 \fBdeny booting;\fR
.PP
The \fBbooting\fR flag is used to tell dhcpd whether or not to respond
to queries from a particular client.  This keyword only has meaning
when it appears in a host declaration.   By default, booting is
\fBallow\fRed, but if it is disabled for a particular client, then
that client will not be able to get and address from the DHCP server.
.SH ALLOW AND DENY WITHIN POOL DECLARATIONS
.PP
The uses of the allow and deny keyword shown in the previous section
work pretty much the same way whether the client is sending a
DHCPDISCOVER or a DHCPREQUEST message - an address will be allocated
to the client (either the old address it's requesting, or a new
address) and then that address will be tested to see if it's okay to
let the client have it.   If the client requested it, and it's not
okay, the server will send a DHCPNAK message.   Otherwise, the server
will simply not respond to the client.   If it is okay to give the
address to the client, the server will send a DHCPACK message.
.PP
The primary motivation behind pool declarations is to have address
allocation pools whose allocation policies are different.   A client
may be denied access to one pool, but allowed access to another pool
on the same network segment.   In order for this to work, access
control has to be done during address allocation, not after address
allocation is done.
.PP
When a DHCPREQUEST message is processed, address allocation simply
consists of looking up the address the client is requesting and seeing
if it's still available for the client.  If it is, then the DHCP
server checks both the address pool permit lists and the relevant
in-scope allow and deny statements to see if it's okay to give the
lease to the client.  In the case of a DHCPDISCOVER message, the
allocation process is done as described previously in the ADDRESS
ALLOCATION section.
.PP
When declaring permit lists for address allocation pools, the
following syntaxes are recognized following the allow or deny keyword:
.PP
 \fBknown clients;\fR
.PP
If specified, this statement either allows or prevents allocation from
this pool to any client that has a host declaration (i.e., is known).
.PP
 \fBunknown clients;\fR
.PP
If specified, this statement either allows or prevents allocation from
this pool to any client that has no host declaration (i.e., is not
known).
.PP
 \fBmembers of "\fRclass\fB";\fR
.PP
If specified, this statement either allows or prevents allocation from
this pool to any client that is a member of the named class.
.PP
 \fBdynamic bootp clients;\fR
.PP
If specified, this statement either allows or prevents allocation from
this pool to any bootp client.
.PP
 \fBauthenticated clients;\fR
.PP
If specified, this statement either allows or prevents allocation from
this pool to any client that has been authenticated using the DHCP
authentication protocol.   This is not yet supported.
.PP
 \fBunauthenticated clients;\fR
.PP
If specified, this statement either allows or prevents allocation from
this pool to any client that has not been authenticated using the DHCP
authentication protocol.   This is not yet supported.
.PP
 \fBall clients;\fR
.PP
If specified, this statement either allows or prevents allocation from
this pool to all clients.   This can be used when you want to write a
pool declaration for some reason, but hold it in reserve, or when you
want to renumber your network quickly, and thus want the server to
force all clients that have been allocated addresses from this pool to
obtain new addresses immediately when they next renew.
.SH REFERENCE: PARAMETERS
.PP
.B The
.I default-lease-time
.B statement
.PP
 \fBdefault-lease-time\fR \fItime\fR\fB;\fR
.PP
.I Time
should be the length in seconds that will be assigned to a lease if
the client requesting the lease does not ask for a specific expiration
time.
.PP
.B The
.I max-lease-time
.B statement
.PP
 \fBmax-lease-time\fR \fItime\fR\fB;\fR
.PP
.I Time
should be the maximum length in seconds that will be assigned to a
lease.   The only exception to this is that Dynamic BOOTP lease
lengths, which are not specified by the client, are not limited by
this maximum.
.PP
.B The
.I min-lease-time
.B statement
.PP
 \fBmin-lease-time\fR \fItime\fR\fB;\fR
.PP
.I Time
should be the minimum length in seconds that will be assigned to a
lease.
.PP
.B The
.I min-secs
.B statement
.PP
 \fBmin-secs\fR \fIseconds\fR\fB;\fR
.PP
.I Seconds
should be the minimum number of seconds since a client began trying to
acquire a new lease before the DHCP server will respond to its request.
The number of seconds is based on what the client reports, and the maximum
value that the client can report is 255 seconds.   Generally, setting this
to one will result in the DHCP server not responding to the client's first
request, but always responding to its second request.
.PP
This can be used
to set up a secondary DHCP server which never offers an address to a client
until the primary server has been given a chance to do so.   If the primary
server is down, the client will bind to the secondary server, but otherwise
clients should always bind to the primary.   Note that this does not, by
itself, permit a primary server and a secondary server to share a pool of
dynamically-allocatable addresses.
.PP
.B The 
.I hardware
.B statement
.PP
 \fBhardware\fR \fIhardware-type\fR \fIhardware-address\fR\fB;\fR
.PP
In order for a BOOTP client to be recognized, its network hardware
address must be declared using a \fIhardware\fR clause in the
.I host
statement.
.I hardware-type
must be the name of a physical hardware interface type.   Currently,
only the
.B ethernet
and
.B token-ring
types are recognized, although support for a
.B fddi
hardware type (and others) would also be desirable.
The
.I hardware-address
should be a set of hexadecimal octets (numbers from 0 through ff)
seperated by colons.   The \fIhardware\fR statement may also be used
for DHCP clients.
.PP
.B The
.I filename
.B statement
.PP
 \fBfilename\fR \fB"\fR\fIfilename\fR\fB";\fR
.PP
The \fIfilename\fR statement can be used to specify the name of the
initial boot file which is to be loaded by a client.  The
.I filename
should be a filename recognizable to whatever file transfer protocol
the client can be expected to use to load the file.
.PP
.B The
.I server-name
.B statement
.PP
 \fBserver-name\fR \fB"\fR\fIname\fR\fB";\fR
.PP
The \fIserver-name\fR statement can be used to inform the client of
the name of the server from which it is booting.   \fIName\fR should
be the name that will be provided to the client.
.PP
.B The
.I next-server
.B statement
.PP
 \fBnext-server\fR \fIserver-name\fR\fB;\fR
.PP
The \fInext-server\fR statement is used to specify the host address of
the server from which the initial boot file (specified in the
\fIfilename\fR statement) is to be loaded.   \fIServer-name\fR should
be a numeric IP address or a domain name.   If no \fInext-server\fR
parameter applies to a given client, the DHCP server's IP address is
used.
.PP
.B The
.I fixed-address
.B statement
.PP
 \fBfixed-address\fR \fIaddress\fR [\fB,\fR \fIaddress\fR ... ]\fB;\fR
.PP
The \fIfixed-address\fR statement is used to assign one or more fixed
IP addresses to a client.  It should only appear in a \fIhost\fR
declaration.  If more than one address is supplied, then when the
client boots, it will be assigned the address which corresponds to the
network on which it is booting.  If none of the addresses in the
\fIfixed-address\fR statement are on the network on which the client
is booting, that client will not match the \fIhost\fR declaration
containing that \fIfixed-address\fR statement.  Each \fIaddress\fR
should be either an IP address or a domain name which resolves to one
or more IP addresses.
.PP
.B The
.I dynamic-bootp-lease-cutoff
.B statement
.PP
 \fBdynamic-bootp-lease-cutoff\fR \fIdate\fR\fB;\fR
.PP
The \fIdynamic-bootp-lease-cutoff\fR statement sets the ending time
for all leases assigned dynamically to BOOTP clients.  Because BOOTP
clients do not have any way of renewing leases, and don't know that
their leases could expire, by default dhcpd assignes infinite leases
to all BOOTP clients.  However, it may make sense in some situations
to set a cutoff date for all BOOTP leases - for example, the end of a
school term, or the time at night when a facility is closed and all
machines are required to be powered off.
.PP
.I Date
should be the date on which all assigned BOOTP leases will end.  The
date is specified in the form:
.PP
.ce 1
W YYYY/MM/DD HH:MM:SS
.PP
W is the day of the week expressed as a number
from zero (Sunday) to six (Saturday).  YYYY is the year, including the
century.  MM is the month expressed as a number from 1 to 12.  DD is
the day of the month, counting from 1.  HH is the hour, from zero to
23.  MM is the minute and SS is the second.  The time is always in
Greenwich Mean Time (GMT), not local time.
.PP
.B The
.I dynamic-bootp-lease-length
.B statement
.PP
 \fBdynamic-bootp-lease-length\fR \fIlength\fR\fB;\fR
.PP
The \fIdynamic-bootp-lease-length\fR statement is used to set the
length of leases dynamically assigned to BOOTP clients.   At some
sites, it may be possible to assume that a lease is no longer in
use if its holder has not used BOOTP or DHCP to get its address within
a certain time period.   The period is specified in \fIlength\fR as a
number of seconds.   If a client reboots using BOOTP during the
timeout period, the lease duration is reset to \fIlength\fR, so a
BOOTP client that boots frequently enough will never lose its lease.
Needless to say, this parameter should be adjusted with extreme
caution.
.PP
.B The
.I get-lease-hostnames
.B statement
.PP
 \fBget-lease-hostnames\fR \fIflag\fR\fB;\fR
.PP
The \fIget-lease-hostnames\fR statement is used to tell dhcpd whether
or not to look up the domain name corresponding to the IP address of
each address in the lease pool and use that address for the DHCP
\fIhostname\fR option.  If \fIflag\fR is true, then this lookup is
done for all addresses in the current scope.   By default, or if
\fIflag\fR is false, no lookups are done.
.PP
.B The
.I use-host-decl-names
.B statement
.PP
 \fBuse-host-decl-names\fR \fIflag\fR\fB;\fR
.PP
If the \fIuse-host-decl-names\fR parameter is true in a given scope,
then for every host declaration within that scope, the name provided
for the host declaration will be supplied to the client as its
hostname.   So, for example,
.PP
.nf
    group {
      use-host-decl-names on;

      host joe {
	hardware ethernet 08:00:2b:4c:29:32;
	fixed-address joe.fugue.com;
      }
    }

is equivalent to

      host joe {
	hardware ethernet 08:00:2b:4c:29:32;
	fixed-address joe.fugue.com;
        option host-name "joe";
      }
.fi
.PP
An \fIoption host-name\fR statement within a host declaration will
override the use of the name in the host declaration.
.PP
.B The
.I authoritative
.B statement
.PP
 \fBauthoritative;\fR
.PP
 \fBnot authoritative;\fR
.PP
The DHCP server will normally assume that the configuration
information about a given network segment is known to be correct and
is authoritative.   So if a client requests an IP address on a given
network segment that the server knows is not valid for that segment,
the server will respond with a DHCPNAK message, causing the client to
forget its IP address and try to get a new one.
.PP
If a DHCP server is being configured by somebody who is not the
network administrator and who therefore does not wish to assert this
level of authority, then the statement "not authoritative" should be
written in the appropriate scope in the configuration file.
.PP
Usually, writing \fBnot authoritative;\fR at the top level of the file
should be sufficient.   However, if a DHCP server is to be set up so
that it is aware of some networks for which it is authoritative and
some networks for which it is not, it may be more appropriate to
declare authority on a per-network-segment basis.
.PP
Note that the most specific scope for which the concept of authority
makes any sense is the physical network segment - either a
shared-network statement or a subnet statement that is not contained
within a shared-network statement.  It is not meaningful to specify
that the server is authoritative for some subnets within a shared
network, but not authoritative for others, nor is it meaningful to
specify that the server is authoritative for some host declarations
and not others.
.PP
.B The
.I always-reply-rfc1048
.B statement
.PP
 \fBalways-reply-rfc1048\fR \fIflag\fR\fB;\fR
.PP
Some BOOTP clients expect RFC1048-style responses, but do not follow
RFC1048 when sending their requests.   You can tell that a client is
having this problem if it is not getting the options you have
configured for it and if you see in the server log the message
"(non-rfc1048)" printed with each BOOTREQUEST that is logged.
.PP
If you want to send rfc1048 options to such a client, you can set the
.B always-reply-rfc1048
option in that client's host declaration, and the DHCP server will
respond with an RFC-1048-style vendor options field.   This flag can
be set in any scope, and will affect all clients covered by that
scope.
.PP
.B The
.I use-lease-addr-for-default-route
.B statement
.PP
 \fBuse-lease-addr-for-default-route\fR \fIflag\fR\fB;\fR
.PP
If the \fIuse-lease-addr-for-default-route\fR parameter is true in a
given scope, then instead of sending the value specified in the
routers option (or sending no value at all), the IP address of the
lease being assigned is sent to the client.   This supposedly causes
Win95 machines to ARP for all IP addresses, which can be helpful if
your router is configured for proxy ARP.
.PP
.B The
.I server-identifier
.B statement
.PP
 \fBserver-identifier \fIhostname\fR\fB;\fR
.PP
The server-identifier statement can be used to define the value that
is sent in the DHCP Server Identifier option for a given scope.   The
value specified \fBmust\fR be an IP address for the DHCP server, and
must be reachable by all clients served by a particular scope.
.PP
The use of the server-identifier statement is not recommended - the only
reason to use it is to force a value other than the default value to be
sent on occasions where the default value would be incorrect.   The default
value is the first IP address associated with the physical network interface
on which the request arrived.
.PP
The usual case where the
\fIserver-identifier\fR statement needs to be sent is when a physical
interface has more than one IP address, and the one being sent by default
isn't appropriate for some or all clients served by that interface.
Another common case is when an alias is defined for the purpose of
having a consistent IP address for the DHCP server, and it is desired
that the clients use this IP address when contacting the server.
.PP
Supplying a value for the dhcp-server-identifier option is equivalent
to using the server-identifier statement.
.SH REFERENCE: OPTION STATEMENTS
.PP
DHCP option statements are documented in the
.B dhcp-options(5)
manual page.
.SH VENDOR ENCAPSULATED OPTIONS
The DHCP protocol defines the \fB vendor-encapsulated-options\fR
option, which allows vendors to define their own options that will be
sent encapsulated in a standard DHCP option.   The format of the
.B vendor-encapsulated-options
option is either a hunk of opaque data, or an actual option buffer
just like a standard DHCP option buffer.   
.PP
You can send this option to clients in one of two ways - either define
the data directly, using a text string or a colon-seperated list of
hexadecimal values, or define an option space, define some options in
that option space, provide values for them, and specify that that
option space should be used to generate the
.B vendor-encapsulated-options
option in some scope.
.PP
To send a simple clump of data, simply provide a value for the option
in the right scope, as in the example shown earlier in the \fBCLIENT
CLASSING\fR section.
.PP
To define a new option space in which vendor options can be stored,
use the \fRoption space\fP statement:
.PP
.B option
.B space
.I name
.B ;
.PP
The name can then be used in option definitions, as described in
the
.B dhcp-options(5)
manual page.   For example:
.nf

	option space SUNW;
	option SUNW.server-address code 2 = ip-address;
	option SUNW.server-name code 3 = text;
	option SUNW.root-path code 4 = text;

.fi
Once you have defined an option space and some options, you can set up
scopes that define values for those options, and you can say when to
use them.   For example, suppose you want to handle two different
classes of clients, as in the example in the \fBCLIENT CLASSING\fR
section.   Using the option space definition we just did, the
.B CLIENT
.B CLASSING
example can be implemented more legibly as follows:
.nf
class "vendor-classes" {
  match option vendor-class-identifier;
}

option SUNW.server-address 172.17.65.1;
option SUNW.server-name "sundhcp-server17-1";

subclass "vendor-classes" "SUNW.Ultra-5_10" {
  vendor-option-space SUNW;
  option SUNW.root-path "/export/root/sparc";
}

subclass "vendor-classes" "SUNW.i86pc" {
  vendor-option-space SUNW;
  option SUNW.root-path "/export/root/i86pc";
}

.fi
As you can see in the preceding example, regular scoping rules apply,
so you can define values that are global in the global scope, and only
define values that are specific to a particular class in the local
scope.   The \fBvendor-option-space\fR declaration indicates that in
that scope, the \fBvendor-encapsulated-options\fR option should be
constructed using the values of all the options in the SUNW option
space.
.SH SEE ALSO
dhcpd.conf(5), dhcpd.leases(5), RFC2132, RFC2131.
.SH AUTHOR
.B dhcpd(8)
was written by Ted Lemon <mellon@vix.com>
under a contract with Vixie Labs.   Funding
for this project was provided by the Internet Software Consortium.
Information about the Internet Software Consortium can be found at
.B http://www.isc.org/isc.