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