]> git.ipfire.org Git - thirdparty/dhcp.git/blame - server/dhcpd.8
Rearrange startup code so as to print everything before daemonizing; Don't spew copyr...
[thirdparty/dhcp.git] / server / dhcpd.8
CommitLineData
08fe7cdb
TL
1.\" dhcpd.8
2.\"
3.\" Copyright (c) 1995, 1996 The Internet Software Consortium.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\"
10.\" 1. Redistributions of source code must retain the above copyright
11.\" notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\" notice, this list of conditions and the following disclaimer in the
14.\" documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of The Internet Software Consortium nor the names
16.\" of its contributors may be used to endorse or promote products derived
17.\" from this software without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
20.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23.\" DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
24.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
32.\"
33.\" This software has been written for the Internet Software Consortium
34.\" by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
35.\" Enterprises. To learn more about the Internet Software Consortium,
36.\" see ``http://www.isc.org/isc''. To learn more about Vixie
37.\" Enterprises, see ``http://www.vix.com''.
ee0cda4d
TL
38.TH dhcpd 8
39.SH NAME
5e6b52dc 40dhcpd - Dynamic Host Configuration Protocol Server
ee0cda4d
TL
41.SH SYNOPSIS
42.B dhcpd
43[
44.B -p
45.I port
46]
d27562c7
TL
47[
48.B -f
49]
50[
5e6b52dc
TL
51.B -d
52]
53[
e2ac5814
TL
54.B -cf
55.I config-file
56]
57[
58.B -lf
59.I lease-file
60]
61[
d27562c7
TL
62.I if0
63[
64.I ...ifN
65]
66]
ee0cda4d 67.SH DESCRIPTION
5e6b52dc
TL
68The Internet Software Consortium DHCP Server, dhcpd, implements the
69Dynamic Host Configuration Protocol (DHCP) and the Internet Bootstrap
70Protocol (BOOTP). DHCP allows hosts on a TCP/IP network to request
71and be assigned IP addresses, and also to discover information about
72the network to which they are attached. BOOTP provides similar
73functionality, with certain restrictions.
ee0cda4d
TL
74.SH OPERATION
75.PP
08fe7cdb
TL
76The DHCP protocol allows a host which is unknown to the network
77administrator to be automatically assigned a new IP address out of a
78pool of IP addresses for its network. In order for this to work, the
79network administrator allocates address pools in each subnet and
ee0cda4d
TL
80enters them into the dhcpd.conf(5) file.
81.PP
08fe7cdb 82On startup, dhcpd reads the
ee0cda4d 83.IR dhcpd.conf
5e6b52dc
TL
84file and stores a list of available addresses on each subnet in
85memory. When a client requests an address using the DHCP protocol,
86dhcpd allocates an address for it. Each client is assigned a lease,
87which expires after an amount of time chosen by the administrator (by
88default, one day). Before leases expire, the clients to which leases
89are assigned are expected to renew them in order to continue to use
90the addresses. Once a lease has expired, the client to which that
91lease was assigned is no longer permitted to use the leased IP
92address.
ee0cda4d 93.PP
08fe7cdb 94In order to keep track of leases across system reboots and server
ee0cda4d
TL
95restarts, dhcpd keeps a list of leases it has assigned in the
96dhcpd.leases(5) file. Before dhcpd grants a lease to a host, it
97records the lease in this file and makes sure that the contents of the
98file are flushed to disk. This ensures that even in the event of a
99system crash, dhcpd will not forget about a lease that it has
100assigned. On startup, after reading the dhcpd.conf file, dhcpd
101reads the dhcpd.leases file to refresh its memory about what leases
102have been assigned.
103.PP
104New leases are appended to the end of the dhcpd.leases
08fe7cdb 105file. In order to prevent the file from becoming arbitrarily large,
ee0cda4d
TL
106from time to time dhcpd creates a new dhcpd.leases file from its
107in-core lease database. Once this file has been written to disk, the
108old file is renamed
109.IR dhcpd.leases~ ,
110and the new file is renamed dhcpd.leases. If the system crashes in
111the middle of this process, whichever dhcpd.leases file remains will
112contain all the lease information, so there is no need for a special
113crash recovery process.
114.PP
5e6b52dc
TL
115BOOTP support is also provided by this server. Unlike DHCP, the BOOTP
116protocol does not provide a protocol for recovering
117dynamically-assigned addresses once they are no longer needed. It is
118still possible to dynamically assign addresses to BOOTP clients, but
119some administrative process for reclaiming addresses is required. By
120default, leases are granted to BOOTP clients in perpetuity, although
121the network administrator may set an earlier cutoff date or a shorter
122lease length for BOOTP leases if that makes sense.
123.PP
124BOOTP clients may also be served in the old standard way, which is to
125simply provide a declaration in the dhcpd.conf file for each
126BOOTP client, permanently assigning an address to each client.
ee0cda4d
TL
127.PP
128Whenever changes are made to the dhcpd.conf file, dhcpd must be
129restarted. To restart dhcpd, send a SIGTERM (signal 15) to the
130process ID contained in
5e6b52dc
TL
131.IR RUNDIR/dhcpd.pid ,
132and then re-invoke dhcpd. Because the DHCP server database is not as
133lightweight as a BOOTP database, dhcpd does not automatically restart
134itself when it sees a change to the dhcpd.conf file.
4e19a6df
TL
135.PP
136Note: We get a lot of complaints about this. We realize that it would
137be nice if one could send a SIGHUP to the server and have it reload
138the database. This is not technically impossible, but it would
139require a great deal of work, our resources are extremely limited, and
140they can be better spent elsewhere. So please don't complain about
141this on the mailing list unless you're prepared to fund a project to
142implement this feature, or prepared to do it yourself.
d27562c7
TL
143.SH COMMAND LINE
144.PP
5e6b52dc
TL
145The names of the network interfaces on which dhcpd should listen for
146broadcasts may be specified on the command line. This should be done
147on systems where dhcpd is unable to identify non-broadcast interfaces,
148but should not be required on other systems. If no interface names
149are specified on the command line dhcpd will identify all network
150interfaces which are up, elimininating non-broadcast interfaces if
151possible, and listen for DHCP broadcasts on each interface.
d27562c7 152.PP
5e6b52dc
TL
153If dhcpd should listen on a port other than the standard (port 67),
154the
d27562c7 155.B -p
5e6b52dc
TL
156flag may used. It should be followed by the udp port number on which
157dhcpd should listen. This is mostly useful for debugging purposes.
d27562c7 158.PP
5e6b52dc
TL
159To run dhcpd as a foreground process, rather than allowing it to run
160as a daemon in the background, the
d27562c7 161.B -f
5e6b52dc
TL
162flag should be specified. This is useful when running dhcpd under a
163debugger, or when running it out of inittab on System V systems.
164.PP
165To have dhcpd log to the standard error descriptor, specify the
166.B -d
167flag. This can be useful for debugging, and also at sites where a
168complete log of all dhcp activity must be kept but syslogd is not
169reliable or otherwise cannot be used. Normally, dhcpd will log all
170output using the syslog(3) function with the log facility set to
171LOG_DAEMON.
e2ac5814
TL
172.PP
173Dhcpd can be made to use an alternate configuration file with the
174.B -cf
175flag, or an alternate lease file with the
176.B -lf
177flag. Because of the importance of using the same lease database at
178all times when running dhcpd in production, these options should be
179used \fBonly\fR for testing lease files or database files in a
180non-production environment.
ee0cda4d 181.SH CONFIGURATION
ba7ed239 182The syntax of the dhcpd.conf(5) file is discussed seperately. This
ee0cda4d 183section should be used as an overview of the configuration process,
ba7ed239 184and the dhcpd.conf(5) documentation should be consulted for detailed
ee0cda4d
TL
185reference information.
186.PP
187.SH Subnets
188dhcpd needs to know the subnet numbers and netmasks of all subnets for
189which it will be providing service. In addition, in order to
190dynamically allocate addresses, it must be assigned one or more ranges
191of addresses on each subnet which it can in turn assign to client
192hosts as they boot. Thus, a very simple configuration providing DHCP
08fe7cdb
TL
193support might look like this:
194.nf
195.sp 1
5e6b52dc 196 subnet 239.252.197.0 netmask 255.255.255.0 {
08fe7cdb 197 range 239.252.197.10 239.252.197.250;
5e6b52dc 198 }
08fe7cdb 199.fi
ee0cda4d 200.PP
08fe7cdb
TL
201Multiple address ranges may be specified like this:
202.nf
203.sp 1
5e6b52dc
TL
204 subnet 239.252.197.0 netmask 255.255.255.0 {
205 range 239.252.197.10 239.252.197.107;
08fe7cdb 206 range 239.252.197.113 239.252.197.250;
5e6b52dc 207 }
08fe7cdb 208.fi
ee0cda4d 209.PP
08fe7cdb
TL
210If a subnet will only be provided with BOOTP service and no dynamic
211address assignment, the range clause can be left out entirely, but the
212subnet statement must appear.
ee0cda4d
TL
213.PP
214.SH Lease Lengths
08fe7cdb
TL
215DHCP leases can be assigned almost any length from zero seconds to
216infinity. What lease length makes sense for any given subnet, or for
217any given installation, will vary depending on the kinds of hosts
218being served.
ee0cda4d 219.PP
08fe7cdb
TL
220For example, in an office environment where systems are added from
221time to time and removed from time to time, but move relatively
222infrequently, it might make sense to allow lease times of a month of
223more. In a final test environment on a manufacturing floor, it may
224make more sense to assign a maximum lease length of 30 minutes -
225enough time to go through a simple test procedure on a network
226appliance before packaging it up for delivery.
ee0cda4d 227.PP
08fe7cdb
TL
228It is possible to specify two lease lengths: the default length that
229will be assigned if a client doesn't ask for any particular lease
230length, and a maximum lease length. These are specified as clauses
231to the subnet command:
232.nf
233.sp 1
5e6b52dc
TL
234 subnet 239.252.197.0 netmask 255.255.255.0 {
235 range 239.252.197.10 239.252.197.107;
236 default-lease-time 600;
08fe7cdb 237 max-lease-time 7200;
5e6b52dc 238 |
08fe7cdb 239.fi
ee0cda4d 240.PP
08fe7cdb
TL
241This particular subnet declaration specifies a default lease time of
242600 seconds (ten minutes), and a maximum lease time of 7200 seconds
243(two hours). Other common values would be 86400 (one day), 604800
244(one week) and 2592000 (30 days).
ee0cda4d 245.PP
08fe7cdb
TL
246Each subnet need not have the same lease\(emin the case of an office
247environment and a manufacturing environment served by the same DHCP
248server, it might make sense to have widely disparate values for
249default and maximum lease times on each subnet.
ee0cda4d
TL
250.SH BOOTP Support
251Each BOOTP client must be explicitly declared in the dhcpd.conf
08fe7cdb
TL
252file. A very basic client declaration will specify the client
253network interface's hardware address and the IP address to assign to
254that client. If the client needs to be able to load a boot file from
255the server, that file's name must be specified. A simple bootp
256client declaration might look like this:
257.nf
258.sp 1
fc5aedc9
TL
259 host haagen {
260 hardware ethernet 08:00:2b:4c:59:23;
5e6b52dc 261 fixed-address 239.252.197.9;
08fe7cdb 262 filename "/tftpboot/haagen.boot";
5e6b52dc 263 }
08fe7cdb 264.fi
ee0cda4d 265.SH Options
08fe7cdb
TL
266DHCP (and also BOOTP with Vendor Extensions) provide a mechanism
267whereby the server can provide the client with information about how
268to configure its network interface (e.g., subnet mask), and also how
269the client can access various network services (e.g., DNS, IP routers,
270and so on).
ee0cda4d 271.PP
08fe7cdb
TL
272These options can be specified on a per-subnet basis, and, for BOOTP
273clients, also on a per-client basis. In the event that a BOOTP
274client declaration specifies options that are also specified in its
275subnet declaration, the options specified in the client declaration
276take precedence. An reasonably complete DHCP configuration might
277look something like this:
278.nf
279.sp 1
5e6b52dc
TL
280 subnet 239.252.197.0 netmask 255.255.255.0 {
281 range 239.252.197.10 239.252.197.250;
282 default-lease-time 600 max-lease-time 7200;
283 option subnet-mask 255.255.255.0;
284 option broadcast-address 239.252.197.255;
285 option routers 239.252.197.1;
286 option domain-name-servers 239.252.197.2, 239.252.197.3;
08fe7cdb 287 option domain-name "isc.org";
5e6b52dc 288 }
08fe7cdb 289.fi
ee0cda4d 290.PP
08fe7cdb
TL
291A bootp host on that subnet that needs to be in a different domain and
292use a different name server might be declared as follows:
293.nf
294.sp 1
ba7ed239
TL
295 host haagen {
296 hardware ethernet 08:00:2b:4c:59:23;
5e6b52dc
TL
297 fixed-address 239.252.197.9;
298 filename "/tftpboot/haagen.boot";
299 option domain-name-servers 192.5.5.1;
08fe7cdb 300 option domain-name "vix.com";
5e6b52dc 301 }
08fe7cdb 302.fi
ee0cda4d 303.PP
5e6b52dc
TL
304A more complete description of the dhcpd.conf file syntax is provided
305in dhcpd.conf(5).
ee0cda4d
TL
306.SH FILES
307.B ETCDIR/dhcpd.conf, DBDIR/dhcpd.leases, RUNDIR/dhcpd.pid,
308.B DBDIR/dhcpd.leases~.
309.SH SEE ALSO
66b01364 310dhclient(8), dhcrelay(8), dhcpd.conf(5), dhcpd.leases(5)
ee0cda4d
TL
311.SH AUTHOR
312.B dhcpd(8)
313was written by Ted Lemon <mellon@vix.com>
08fe7cdb
TL
314under a contract with Vixie Labs. Funding
315for this project was provided by the Internet Software Corporation.
316Information about the Internet Software Consortium can be found at
ee0cda4d 317.B http://www.isc.org/isc.