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