e78a85b12dfe0ddad36161c5497f9b32156b90b2
[dragonfly.git] / contrib / isc-dhcp / client / dhclient.8
1 .\"     dhclient.8
2 .\"
3 .\" Copyright (c) 1996-2002 Internet Software Consortium.
4 .\" Use is subject to license terms which appear in the file named
5 .\" ISC-LICENSE that should have accompanied this file when you
6 .\" received it.   If a file named ISC-LICENSE did not accompany this
7 .\" file, or you are not sure the one you have is correct, you may
8 .\" obtain an applicable copy of the license at:
9 .\"
10 .\"             http://www.isc.org/isc-license-1.0.html. 
11 .\"
12 .\" This file is part of the ISC DHCP distribution.   The documentation
13 .\" associated with this file is listed in the file DOCUMENTATION,
14 .\" included in the top-level directory of this release.
15 .\"
16 .\" Support and other services are available for ISC products - see
17 .\" http://www.isc.org for more information.
18 .\"
19 .\" $Id: dhclient.8,v 1.12.2.7 2002/11/17 02:25:43 dhankins Exp $
20 .\"
21 .\" Portions copyright (c) 2000 David E. O'Brien.
22 .\" All rights reserved.
23 .\" $FreeBSD: src/contrib/isc-dhcp/client/dhclient.8,v 1.14 2003/07/28 08:30:11 mbr Exp $
24 .\" $DragonFly: src/contrib/isc-dhcp/client/Attic/dhclient.8,v 1.4 2003/12/31 03:22:57 drhodus Exp $
25 .\"
26 .TH dhclient 8
27 .SH NAME
28 dhclient - Dynamic Host Configuration Protocol Client
29 .SH SYNOPSIS
30 .B dhclient
31 [
32 .B -p
33 .I port
34 ]
35 [
36 .B -d
37 ]
38 [
39 .B -q
40 ]
41 [
42 .B -v
43 ]
44 [
45 .B -1
46 ]
47 [
48 .B -r
49 ]
50 [
51 .B -lf
52 .I lease-file
53 ]
54 [
55 .B -pf
56 .I pid-file
57 ]
58 [
59 .B -cf
60 .I config-file
61 ]
62 [
63 .B -sf
64 .I script-file
65 ]
66 [
67 .B -s
68 server
69 ]
70 [
71 .B -g
72 relay
73 ]
74 [
75 .B -i
76 interval
77 ]
78 [
79 .B -n
80 ]
81 [
82 .B -nw
83 ]
84 [
85 .B -w
86 ]
87 [
88 .I if0
89 [
90 .I ...ifN
91 ]
92 ]
93 .SH DESCRIPTION
94 The Internet Software Consortium DHCP Client, dhclient, provides a
95 means for configuring one or more network interfaces using the Dynamic
96 Host Configuration Protocol, BOOTP protocol, or if these protocols
97 fail, by statically assigning an address.
98 .SH OPERATION
99 .PP
100 The DHCP protocol allows a host to contact a central server which
101 maintains a list of IP addresses which may be assigned on one or more
102 subnets.   A DHCP client may request an address from this pool, and
103 then use it on a temporary basis for communication on network.   The
104 DHCP protocol also provides a mechanism whereby a client can learn
105 important details about the network to which it is attached, such as
106 the location of a default router, the location of a name server, and
107 so on.
108 .PP
109 On startup, dhclient reads the
110 .IR dhclient.conf
111 for configuration instructions.   It then gets a list of all the
112 network interfaces that are configured in the current system.   For
113 each interface, it attempts to configure the interface using the DHCP
114 protocol.
115 .PP
116 In order to keep track of leases across system reboots and server
117 restarts, dhclient keeps a list of leases it has been assigned in the
118 dhclient.leases(5) file.   On startup, after reading the dhclient.conf
119 file, dhclient reads the dhclient.leases file to refresh its memory
120 about what leases it has been assigned.
121 .PP
122 When a new lease is acquired, it is appended to the end of the
123 dhclient.leases file.   In order to prevent the file from becoming
124 arbitrarily large, from time to time dhclient creates a new
125 dhclient.leases file from its in-core lease database.  The old version
126 of the dhclient.leases file is retained under the name
127 .IR dhclient.leases~
128 until the next time dhclient rewrites the database.
129 .PP
130 Old leases are kept around in case the DHCP server is unavailable when
131 dhclient is first invoked (generally during the initial system boot
132 process).   In that event, old leases from the dhclient.leases file
133 which have not yet expired are tested, and if they are determined to
134 be valid, they are used until either they expire or the DHCP server
135 becomes available.
136 .PP
137 A mobile host which may sometimes need to access a network on which no
138 DHCP server exists may be preloaded with a lease for a fixed
139 address on that network.   When all attempts to contact a DHCP server
140 have failed, dhclient will try to validate the static lease, and if it
141 succeeds, will use that lease until it is restarted.
142 .PP
143 A mobile host may also travel to some networks on which DHCP is not
144 available but BOOTP is.   In that case, it may be advantageous to
145 arrange with the network administrator for an entry on the BOOTP
146 database, so that the host can boot quickly on that network rather
147 than cycling through the list of old leases.
148 .SH COMMAND LINE
149 .PP
150 The names of the network interfaces that dhclient should attempt to
151 configure may be specified on the command line.  If no interface names
152 are specified on the command line dhclient will normally identify all
153 network interfaces, eliminating non-broadcast interfaces if
154 possible, and attempt to configure each interface.
155 .PP
156 It is also possible to specify interfaces by name in the
157 .B dhclient.conf(5)
158 file.   If interfaces are specified in this way, then the client will
159 only configure interfaces that are either specified in the
160 configuration file or on the command line, and will ignore all other
161 interfaces.
162 .PP
163 If the DHCP client should listen and transmit on a port other than the
164 standard (port 68), the
165 .B -p
166 flag may used.  It should be followed by the udp port number that
167 dhclient should use.  This is mostly useful for debugging purposes.
168 If a different port is specified for the client to listen on and
169 transmit on, the client will also use a different destination port -
170 one greater than the specified destination port.
171 .PP
172 The DHCP client normally transmits any protocol messages it sends
173 before acquiring an IP address to, 255.255.255.255, the IP limited
174 broadcast address.   For debugging purposes, it may be useful to have
175 the server transmit these messages to some other address.   This can
176 be specified with the 
177 .B -s
178 flag, followed by the IP address or domain name of the destination.
179 .PP
180 For testing purposes, the giaddr field of all packets that the client
181 sends can be set using the
182 .B -g
183 flag, followed by the IP address to send.   This is only useful for testing,
184 and should not be expected to work in any consistent or useful way.
185 .PP
186 On FreeBSD, dhclient can be enabled to automatically handle the
187 link status of the network card. Normally polling is done every
188 five seconds. The polling interval can be set using the
189 .B -i
190 flag, followed by the numbers of seconds. Minimum is one second.
191 .PP
192 The DHCP client will normally run in the foreground until it has
193 configured an interface, and then will revert to running in the
194 background.   To run force dhclient to always run as a foreground
195 process, the
196 .B -d
197 flag should be specified.  This is useful when running the client
198 under a debugger, or when running it out of inittab on System V
199 systems.
200 .PP
201 The client normally prints a startup message and displays the
202 protocol sequence to the standard error descriptor until it has
203 acquired an address, and then only logs messages using the
204 .B syslog (3)
205 facility.   The
206 .B -q
207 flag prevents any messages other than errors from being printed to the
208 standard error descriptor.
209 .B -v
210 flag turns on all messages.
211 Opposite of
212 .B -q .
213 .PP
214 The client normally doesn't release the current lease as it is not
215 required by the DHCP protocol.  Some cable ISPs require their clients
216 to notify the server if they wish to release an assigned IP address.
217 The
218 .B -r
219 flag explicitly releases the current lease, and once the lease has been
220 released, the client exits.
221 .PP
222 The
223 .B -1
224 flag cause dhclient to try once to get a lease.  If it fails, dhclient exits
225 with exit code two.
226 .PP
227 The DHCP client normally gets its configuration information from
228 .B ETCDIR/dhclient.conf,
229 its lease database from
230 .B DBDIR/dhclient.leases,
231 stores its process ID in a file called
232 .B RUNDIR/dhclient.pid,
233 and configures the network interface using
234 .B CLIENTBINDIR/dhclient-script
235 To specify different names and/or locations for these files, use the
236 .B -cf,
237 .B -lf,
238 .B -pf
239 and
240 .B -sf
241 flags, respectively, followed by the name of the file.   This can be
242 particularly useful if, for example,
243 .B DBDIR
244 or
245 .B RUNDIR
246 has not yet been mounted when the DHCP client is started.
247 .PP
248 The DHCP client normally exits if it isn't able to identify any
249 network interfaces to configure.   On laptop computers and other
250 computers with hot-swappable I/O buses, it is possible that a
251 broadcast interface may be added after system startup.   The
252 .B -w
253 flag can be used to cause the client not to exit when it doesn't find
254 any such interfaces.   The
255 .B omshell (8)
256 program can then be used to notify the client when a network interface
257 has been added or removed, so that the client can attempt to configure an IP
258 address on that interface.
259 .PP
260 The DHCP client can be directed not to attempt to configure any interfaces
261 using the
262 .B -n
263 flag.   This is most likely to be useful in combination with the
264 .B -w
265 flag.
266 .PP
267 The client can also be instructed to become a daemon immediately, rather
268 than waiting until it has acquired an IP address.   This can be done by
269 supplying the
270 .B -nw
271 flag.
272 .SH CONFIGURATION
273 The syntax of the dhclient.conf(5) file is discussed separately.
274 .SH OMAPI
275 The DHCP client provides some ability to control it while it is
276 running, without stopping it.  This capability is provided using OMAPI,
277 an API for manipulating remote objects.  OMAPI clients connect to the
278 client using TCP/IP, authenticate, and can then examine the client's
279 current status and make changes to it. 
280 .PP
281 Rather than implementing the underlying OMAPI protocol directly, user
282 programs should use the dhcpctl API or OMAPI itself.   Dhcpctl is a
283 wrapper that handles some of the housekeeping chores that OMAPI does
284 not do automatically.   Dhcpctl and OMAPI are documented in \fBdhcpctl(3)\fR
285 and \fBomapi(3)\fR.   Most things you'd want to do with the client can
286 be done directly using the \fBomshell(1)\fR command, rather than
287 having to write a special program.
288 .SH THE CONTROL OBJECT
289 The control object allows you to shut the client down, releasing all
290 leases that it holds and deleting any DNS records it may have added.
291 It also allows you to pause the client - this unconfigures any
292 interfaces the client is using.   You can then restart it, which
293 causes it to reconfigure those interfaces.   You would normally pause
294 the client prior to going into hibernation or sleep on a laptop
295 computer.   You would then resume it after the power comes back.
296 This allows PC cards to be shut down while the computer is hibernating
297 or sleeping, and then reinitialized to their previous state once the
298 computer comes out of hibernation or sleep.
299 .PP
300 The control object has one attribute - the state attribute.   To shut
301 the client down, set its state attribute to 2.   It will automatically
302 do a DHCPRELEASE.   To pause it, set its state attribute to 3.   To
303 resume it, set its state attribute to 4.
304 .PP
305 .SH FILES
306 .B CLIENTBINDIR/dhclient-script,
307 .B ETCDIR/dhclient.conf, DBDIR/dhclient.leases, RUNDIR/dhclient.pid,
308 .B DBDIR/dhclient.leases~.
309 .SH SEE ALSO
310 dhclient.conf(5), dhclient.leases(5), dhclient-script(8).
311 .SH AUTHOR
312 .B dhclient(8)
313 has been written for the Internet Software Consortium
314 by Ted Lemon in cooperation with Vixie
315 Enterprises.  To learn more about the Internet Software Consortium,
316 see
317 .B http://www.isc.org
318 To learn more about Vixie
319 Enterprises, see
320 .B http://www.vix.com.
321 .PP
322 This client was substantially modified and enhanced by Elliot Poger
323 for use on Linux while he was working on the MosquitoNet project at
324 Stanford.
325 .PP
326 The current version owes much to Elliot's Linux enhancements, but
327 was substantially reorganized and partially rewritten by Ted Lemon
328 so as to use the same networking framework that the Internet Software
329 Consortium DHCP server uses.   Much system-specific configuration code
330 was moved into a shell script so that as support for more operating
331 systems is added, it will not be necessary to port and maintain
332 system-specific configuration code to these operating systems - instead,
333 the shell script can invoke the native tools to accomplish the same
334 purpose.
335 .PP