1dhclient(8) System Manager's Manual dhclient(8)
2
3
4
6 dhclient - Dynamic Host Configuration Protocol Client
7
9 dhclient [ -4 | -6 ] [ -S ] [ -N [ -N... ] ] [ -T [ -T... ] ] [ -P [
10 -P... ] ] [ -D LL|LLT ] [ -p port ] [ -d ] [ -e VAR=value ] [ -q ] [
11 -1 ] [ -r | -x ] [ -lf lease-file ] [ -pf pid-file ] [ -cf config-file
12 ] [ -sf script-file ] [ -s server ] [ -g relay ] [ -n ] [ -nc ] [ -nw ]
13 [ -w ] [ -B ] [ -I dhcp-client-identifier ] [ -H host-name ] [ -F
14 fqdn.fqdn ] [ -V vendor-class-identifier ] [ -R request-option-list ] [
15 -timeout timeout ] [ -v ] [ --version ] [ if0 [ ...ifN ] ]
16
18 The Internet Systems Consortium DHCP Client, dhclient, provides a means
19 for configuring one or more network interfaces using the Dynamic Host
20 Configuration Protocol, BOOTP protocol, or if these protocols fail, by
21 statically assigning an address.
22
24 The DHCP protocol allows a host to contact a central server which main‐
25 tains a list of IP addresses which may be assigned on one or more sub‐
26 nets. A DHCP client may request an address from this pool, and then
27 use it on a temporary basis for communication on network. The DHCP
28 protocol also provides a mechanism whereby a client can learn important
29 details about the network to which it is attached, such as the location
30 of a default router, the location of a name server, and so on.
31
32 On startup, dhclient reads the dhclient.conf for configuration instruc‐
33 tions. It then gets a list of all the network interfaces that are
34 configured in the current system. For each interface, it attempts to
35 configure the interface using the DHCP protocol.
36
37 In order to keep track of leases across system reboots and server
38 restarts, dhclient keeps a list of leases it has been assigned in the
39 dhclient.leases(5) file. On startup, after reading the dhclient.conf
40 file, dhclient reads the dhclient.leases file to refresh its memory
41 about what leases it has been assigned.
42
43 When a new lease is acquired, it is appended to the end of the
44 dhclient.leases file. In order to prevent the file from becoming
45 arbitrarily large, from time to time dhclient creates a new
46 dhclient.leases file from its in-core lease database. The old version
47 of the dhclient.leases file is retained under the name dhclient.leases~
48 until the next time dhclient rewrites the database.
49
50 Old leases are kept around in case the DHCP server is unavailable when
51 dhclient is first invoked (generally during the initial system boot
52 process). In that event, old leases from the dhclient.leases file
53 which have not yet expired are tested, and if they are determined to be
54 valid, they are used until either they expire or the DHCP server
55 becomes available.
56
57 A mobile host which may sometimes need to access a network on which no
58 DHCP server exists may be preloaded with a lease for a fixed address on
59 that network. When all attempts to contact a DHCP server have failed,
60 dhclient will try to validate the static lease, and if it succeeds,
61 will use that lease until it is restarted.
62
63 A mobile host may also travel to some networks on which DHCP is not
64 available but BOOTP is. In that case, it may be advantageous to
65 arrange with the network administrator for an entry on the BOOTP data‐
66 base, so that the host can boot quickly on that network rather than
67 cycling through the list of old leases.
68
70 The names of the network interfaces that dhclient should attempt to
71 configure may be specified on the command line. If no interface names
72 are specified on the command line dhclient will normally identify all
73 network interfaces, eliminating non-broadcast interfaces if possible,
74 and attempt to configure each interface.
75
76 It is also possible to specify interfaces by name in the
77 dhclient.conf(5) file. If interfaces are specified in this way, then
78 the client will only configure interfaces that are either specified in
79 the configuration file or on the command line, and will ignore all
80 other interfaces.
81
83 -4 Use the DHCPv4 protocol to obtain an IPv4 address and configura‐
84 tion parameters (default).
85
86
87 -6 Use the DHCPv6 protocol to obtain whatever IPv6 addresses are
88 available along with configuration parameters. The functional‐
89 ity of DHCPv6 mode may be modified with the -S , -T , and -N
90 options.
91
92
93 -S Perform an information-only request over DHCPv6 to get stateless
94 configuration parameters. It is not recommended to combine this
95 option with the -N , -P , or -T options or to share lease files
96 between different modes of operation. Only valid with the -6
97 option.
98
99
100 -N Perform a normal (IA_NA) address query over DHCPv6. It is not
101 recommended to combine this option with the -P , -S , or -T
102 options or to share lease files between different modes of oper‐
103 ation. Only valid with the -6 option.
104
105
106 -T Perform a temporary (IA_TA) address query over DHCPv6 (disables
107 normal address query). It is not recommended to combine this
108 option with the -N , -P , or -S options or to share lease files
109 between different modes of operation. Only valid with the -6
110 option.
111
112
113 -P Enable IPv6 prefix delegation (disables normal address query).
114 It is not not recommended to combine this option with the -N ,
115 -S , or -T options or to share lease files between different
116 modes of operation. Only valid with the -6 option.
117
118
119 -D By default, DHCPv6 dhclient creates an identifier based on the
120 link-layer address (DUID-LL) if it is running in stateless mode
121 (with -S, not requesting an address), or it creates an identi‐
122 fier based on the link-layer address plus a timestamp (DUID-LLT)
123 if it is running in stateful mode (without -S, requesting an
124 address). -D overrides this default, with a value of either
125 "LL" or "LLT".
126
127
128 -p <port number>
129 The UDP port number the DHCP client should listen and transmit
130 on. If unspecified, dhclient uses the default port 68. This
131 option is mostly useful for debugging purposes. If a different
132 port is specified for the client to listen and transmit on, the
133 client will also use a different destination port - one less
134 than the specified port.
135
136
137 -d Force dhclient to run as a foreground process. This is useful
138 when running the client under a debugger, or when running it out
139 of inittab on System V systems.
140
141
142 -e VAR=value
143 Define additional environment variables for the environment
144 where dhclient-script executes. You may specify multiplate -e
145 options on the command line. For example: -e IF_METRIC=1
146
147
148 -q Suppress all terminal and log output except error messages.
149
150
151 -1 Try once to get a lease. One failure, exit with code 2.
152
153
154 -r Tell dhclient to release the current lease it has from the
155 server. This is not required by the DHCP protocol, but some
156 ISPs require their clients to notify the server if they wish to
157 release an assigned IP address.
158
159
160 -lf <lease-file>
161 Path to the lease database file. If unspecified, the default
162 /var/lib/dhclient/dhclient.leases is used.
163
164
165 -pf <pid-file>
166 Path to the process ID file. If unspecified, the default
167 /var/run/dhclient.pid is used.
168
169
170 -cf <config-file>
171 Path to the client configuration file. If unspecified, the
172 default /etc/dhcp/dhclient.conf is used.
173
174
175 -sf <script-file>
176 Path to the network configuration script invoked by dhclient
177 when it gets a lease. If unspecified, the default
178 /sbin/dhclient-script is used.
179
180
181 -s <server>
182 Specifiy the server IP address or fully qualified domain name to
183 transmit DHCP protocol messages to. Normally, dhclient trans‐
184 mits these messages to 255.255.255.255 (the IP limited broadcast
185 address). Overriding this is mostly useful for debugging pur‐
186 poses.
187
188
189 -g <relay>
190 Only for debugging. Set the giaddr field of all packets the
191 client sends to the IP address specified. This should not be
192 expected to work in any consistent or useful way.
193
194
195 -n Do not configure any interfaces. Most useful combined with the
196 -w option.
197
198
199 -nc Do not drop capabilities.
200
201 Normally, if dhclient was compiled with libcap-ng support,
202 dhclient drops most capabilities immediately upon startup.
203 While more secure, this greatly restricts the additional actions
204 that hooks in dhclient-script (8) can take. (For example, any
205 daemons that dhclient-script (8) starts or restarts will inherit
206 the restricted capabilities as well, which may interfere with
207 their correct operation.) Thus, the -nc option can be used to
208 prevent dhclient from dropping capabilities.
209
210 The -nc option is ignored if dhclient was not compiled with lib‐
211 cap-ng support.
212
213
214 -nw Become a daemon process immediately (nowait) rather than waiting
215 until an IP address has been acquired.
216
217
218 -w Keep running even if no network interfaces are found. The
219 omshell program can be used to notify the client when a network
220 interface has been added or removed so it can attempt to config‐
221 ure an IP address on that interface.
222
223
224 -B Set the BOOTP broadcast flag in request packets so servers will
225 always broadcast replies.
226
227
228 -I <dhcp-client-identifier>
229 Specify the dhcp-client-identifier option to send to the DHCP
230 server.
231
232
233 -H <host-name>
234 Specify the host-name option to send to the DHCP server. The
235 host-name string only contains the client's hostname prefix, to
236 which the server will append the ddns-domainname or domain-name
237 options, if any, to derive the fully qualified domain name of
238 the client. The -H option cannot be used with the -F option.
239
240
241 -F <fqdn.fqdn>
242 Specify the fqdn.fqdn option to send to the DHCP server. This
243 option cannot be used with the -H option. The fqdn.fqdn option
244 must specify the complete domain name of the client host, which
245 the server may use for dynamic DNS updates.
246
247
248 -V <vendor-class-identifier>
249 Specify the vendor-class-identifier option to send to the DHCP
250 server.
251
252
253 -R <option>[,<option>...]
254 Specify the list of options the client is to request from the
255 server. The option list must be a single string consisting of
256 option names separated by at least one command and optional
257 space characters. The default option list is:
258
259
260 subnet-mask, broadcast-address, time-offset, routers,
261 domain-search, domain-name, domain-name-servers, host-name,
262 nis-domain, nis-servers, ntp-servers, interface-mtu
263
264 The -R option does not append options to the default request, it
265 overrides the default request list. Keep this in mind if you
266 want to request an additional option besides the default request
267 list. You will have to specify all option names for the -R
268 parameter.
269
270
271 -timeout <timeout>
272 Specify the time after which dhclient will decide that no DHCP
273 servers can be contacted when no responses have been received.
274
275
276 -v Enable verbose log messages.
277
278
279 If the client is killed by a signale (for example at shutdown or
280 reboot), it will not execute the dhclient-script (8) at exit. However,
281 if you shut the client down gracefully with -r or -x it will execute
282 dhclient-script (8) at shutdown with the specific reason for calling
283 the script set in the environment table.
284
286 The syntax of the dhclient.conf(5) file is discussed separately.
287
289 The DHCP client provides some ability to control it while it is run‐
290 ning, without stopping it. This capability is provided using OMAPI, an
291 API for manipulating remote objects. OMAPI clients connect to the
292 client using TCP/IP, authenticate, and can then examine the client's
293 current status and make changes to it.
294
295 Rather than implementing the underlying OMAPI protocol directly, user
296 programs should use the dhcpctl API or OMAPI itself. Dhcpctl is a
297 wrapper that handles some of the housekeeping chores that OMAPI does
298 not do automatically. Dhcpctl and OMAPI are documented in dhcpctl(3)
299 and omapi(3). Most things you'd want to do with the client can be
300 done directly using the omshell(1) command, rather than having to write
301 a special program.
302
304 The control object allows you to shut the client down, releasing all
305 leases that it holds and deleting any DNS records it may have added.
306 It also allows you to pause the client - this unconfigures any inter‐
307 faces the client is using. You can then restart it, which causes it
308 to reconfigure those interfaces. You would normally pause the client
309 prior to going into hibernation or sleep on a laptop computer. You
310 would then resume it after the power comes back. This allows PC cards
311 to be shut down while the computer is hibernating or sleeping, and then
312 reinitialized to their previous state once the computer comes out of
313 hibernation or sleep.
314
315 The control object has one attribute - the state attribute. To shut
316 the client down, set its state attribute to 2. It will automatically
317 do a DHCPRELEASE. To pause it, set its state attribute to 3. To
318 resume it, set its state attribute to 4.
319
321 /sbin/dhclient-script, /etc/dhcp/dhclient.conf,
322 /var/lib/dhclient/dhclient.leases, /var/run/dhclient.pid,
323 /var/lib/dhclient/dhclient.leases~.
324
326 dhcpd(8), dhcrelay(8), dhclient-script(8), dhclient.conf(5),
327 dhclient.leases(5), dhcp-eval(5).
328
330 dhclient(8) has been written for Internet Systems Consortium by Ted
331 Lemon in cooperation with Vixie Enterprises. To learn more about
332 Internet Systems Consortium, see https://www.isc.org To learn more
333 about Vixie Enterprises, see http://www.vix.com.
334
335 This client was substantially modified and enhanced by Elliot Poger for
336 use on Linux while he was working on the MosquitoNet project at Stan‐
337 ford.
338
339 The current version owes much to Elliot's Linux enhancements, but was
340 substantially reorganized and partially rewritten by Ted Lemon so as to
341 use the same networking framework that the Internet Systems Consortium
342 DHCP server uses. Much system-specific configuration code was moved
343 into a shell script so that as support for more operating systems is
344 added, it will not be necessary to port and maintain system-specific
345 configuration code to these operating systems - instead, the shell
346 script can invoke the native tools to accomplish the same purpose.
347
348 dhclient(8)