1dhclient(8)                 System Manager's Manual                dhclient(8)
2
3
4

NAME

6       dhclient - Dynamic Host Configuration Protocol Client
7

SYNOPSIS

9       dhclient  [ -4 | -6 ] [ -S ] [ -N [ -N...  ] ] [ -T [ -T...  ] ] [ -P [
10       -P...  ] ] [ -R ] [ -i ] [ -I ] [ -4o6 port ] [ -D LL|LLT ] [ -p  port-
11       number  ] [ -d ] [ -df duid-lease-file ] [ -e VAR=value ] [ -q ] [ -1 ]
12       [ -r | -x ] [ -lf lease-file ] [ -pf pid-file ] [ --no-pid ] [ -cf con‐
13       fig-file ] [ -sf script-file ] [ -s server-addr ] [ -g relay ] [ -n ] [
14       -nw ] [ -w ] [ -nc ] [ -B ] [ -C dhcp-client-identifier ]  [  -H  host-
15       name  ]  [  -F  fqdn.fqdn ] [ -V vendor-class-identifier ] [ --request-
16       options request-option-list ] [ --timeout timeout ]  [  --dad-wait-time
17       seconds  ] [ --prefix-len-hint length ] [ --decline-wait-time seconds ]
18       [ -v ] [ --version ] [ if0 [ ...ifN ] ]
19

DESCRIPTION

21       The Internet Systems Consortium DHCP Client, dhclient, provides a means
22       for  configuring  one or more network interfaces using the Dynamic Host
23       Configuration Protocol, BOOTP protocol, or if these protocols fail,  by
24       statically assigning an address.
25

OPERATION

27       The DHCP protocol allows a host to contact a central server which main‐
28       tains a list of IP addresses which may be assigned on one or more  sub‐
29       nets.   A  DHCP  client may request an address from this pool, and then
30       use it on a temporary basis for communication  on  network.   The  DHCP
31       protocol also provides a mechanism whereby a client can learn important
32       details about the network to which it is attached, such as the location
33       of a default router, the location of a name server, and so on.
34
35       There  are  two  versions  of  the DHCP protocol DHCPv4 and DHCPv6.  At
36       startup the client may be started for one or the other via the -4 or -6
37       options.
38
39       On startup, dhclient reads the dhclient.conf for configuration instruc‐
40       tions.  It then gets a list of all the network interfaces that are con‐
41       figured in the current system.  For each interface, it attempts to con‐
42       figure the interface using the DHCP protocol.
43
44       In order to keep track of  leases  across  system  reboots  and  server
45       restarts,  dhclient  keeps a list of leases it has been assigned in the
46       dhclient.leases file.  On  startup,  after  reading  the  dhclient.conf
47       file,  dhclient  reads  the  dhclient.leases file to refresh its memory
48       about what leases it has been assigned.
49
50       When a new lease is  acquired,  it  is  appended  to  the  end  of  the
51       dhclient.leases file.  In order to prevent the file from becoming arbi‐
52       trarily large, from time to time dhclient creates a new dhclient.leases
53       file  from  its  in-core  lease  database.   The  old  version  of  the
54       dhclient.leases file is retained under the name dhclient.leases~  until
55       the next time dhclient rewrites the database.
56
57       Old  leases are kept around in case the DHCP server is unavailable when
58       dhclient is first invoked (generally during  the  initial  system  boot
59       process).   In  that  event,  old  leases from the dhclient.leases file
60       which have not yet expired are tested, and if they are determined to be
61       valid,  they  are  used  until  either  they  expire or the DHCP server
62       becomes available.
63
64       A mobile host which may sometimes need to access a network on which  no
65       DHCP server exists may be preloaded with a lease for a fixed address on
66       that network.  When all attempts to contact a DHCP server have  failed,
67       dhclient  will  try  to  validate the static lease, and if it succeeds,
68       will use that lease until it is restarted.
69
70       A mobile host may also travel to some networks on  which  DHCP  is  not
71       available  but  BOOTP  is.   In  that  case,  it may be advantageous to
72       arrange with the network administrator for an entry on the BOOTP  data‐
73       base,  so  that  the  host can boot quickly on that network rather than
74       cycling through the list of old leases.
75

COMMAND LINE

77       The names of the network interfaces that  dhclient  should  attempt  to
78       configure  may be specified on the command line.  If no interface names
79       are specified on the command line dhclient will normally  identify  all
80       network  interfaces,  eliminating non-broadcast interfaces if possible,
81       and attempt to configure each interface.
82
83       It is also possible to specify interfaces by name in the  dhclient.conf
84       file.   If  interfaces  are specified in this way, then the client will
85       only configure interfaces that are either specified in  the  configura‐
86       tion file or on the command line, and will ignore all other interfaces.
87
88       The  client  normally prints no output during its startup sequence.  It
89       can be made to emit verbose messages displaying  the  startup  sequence
90       events  until  it  has  acquired an address by supplying the -v command
91       line argument.  In either case, the client logs messages using the sys‐
92       log(3) facility.
93

OPTIONS

95       -4     Use the DHCPv4 protocol to obtain an IPv4 address and configura‐
96              tion parameters.  This is the default  and  cannot  be  combined
97              with -6.
98
99       -6     Use  the  DHCPv6  protocol to obtain whatever IPv6 addresses are
100              available along with configuration  parameters.   It  cannot  be
101              combined with -4.  The -S -T -P -N and -D arguments provide more
102              control over aspects of the DHCPv6 processing.  Note: it is  not
103              recommended  to  mix queries of different types together or even
104              to share the lease file between them.
105
106       -4o6 port
107              Participate in the DHCPv4 over DHCPv6 protocol specified by  RFC
108              7341.  This associates a DHCPv4 and a DHCPv6 client to allow the
109              v4 client to send v4 requests encapsulated in a v6 packet.  Com‐
110              munication  between  the  two  clients  is done on a pair of UDP
111              sockets bound to ::1 port and port + 1.  Both  clients  must  be
112              launched using the same port argument.
113
114       -1     Try  to  get  a  lease  once.   On failure exit with code 2.  In
115              DHCPv6 this sets the maximum duration of the initial exchange to
116              timeout (from dhclient.conf with a default of sixty seconds).
117
118       -d     Force  dhclient  to  run  as a foreground process.  Normally the
119              DHCP client will run in the foreground until is  has  configured
120              an  interface  at  which  time  it will revert to running in the
121              background.  This option is useful when running the client under
122              a  debugger,  or when running it out of inittab on System V sys‐
123              tems.  This implies -v.
124
125       -nw    Become a daemon immediately (nowait) rather than  waiting  until
126              an IP address has been acquired.
127
128       -q     Be quiet at startup, this is the default.
129
130       -v     Enable verbose log messages.
131
132       -w     Continue  running  even  if  no broadcast interfaces were found.
133              Normally DHCP client will exit if it isn't able to identify  any
134              network  interfaces to configure.  On laptop computers and other
135              computers with hot-swappable I/O buses, it is  possible  that  a
136              broadcast  interface  may  be  added after system startup.  This
137              flag can be used to cause the client not to exit when it doesn't
138              find  any  such  interfaces.  The omshell(1) program can then be
139              used to notify the client when  a  network  interface  has  been
140              added or removed, so that the client can attempt to configure an
141              IP address on that interface.
142
143       -nc    Do not drop capabilities.
144
145              Normally, if  dhclient  was  compiled  with  libcap-ng  support,
146              dhclient  drops  most  capabilities  immediately  upon  startup.
147              While more secure, this greatly restricts the additional actions
148              that  hooks  in dhclient-script (8) can take.  (For example, any
149              daemons that dhclient-script (8) starts or restarts will inherit
150              the  restricted  capabilities  as well, which may interfere with
151              their correct operation.)  Thus, the -nc option can be  used  to
152              prevent dhclient from dropping capabilities.
153
154              The -nc option is ignored if dhclient was not compiled with lib‐
155              cap-ng support.
156
157
158       -n     Do not configure any interfaces.  This is most likely to be use‐
159              ful in combination with the -w flag.
160
161       -e VAR=value
162              Define  additional  environment  variables  for  the environment
163              where dhclient-script executes.  You  may  specify  multiple  -e
164              options on the command line.
165
166       -r     Release  the  current  lease and stop the running DHCP client as
167              previously recorded in the PID file.   When  shutdown  via  this
168              method dhclient-script will be executed with the specific reason
169              for calling the script set.  The client normally doesn't release
170              the  current  lease as this is not required by the DHCP protocol
171              but some cable ISPs require their clients to notify  the  server
172              if they wish to release an assigned IP address.
173
174       -x     Stop  the  running  DHCP  client  without  releasing the current
175              lease.  Kills existing dhclient process as  previously  recorded
176              in  the PID file.  When shutdown via this method dhclient-script
177              will be executed with the specific reason for calling the script
178              set.
179
180       -p port-number
181              The  UDP  port number on which the DHCP client should listen and
182              transmit.  If unspecified, dhclient uses the default port of 68.
183              This  is  mostly  useful for debugging purposes.  If a different
184              port is specified on which the client should listen  and  trans‐
185              mit, the client will also use a different destination port - one
186              less than the specified port.
187
188       -s server-addr
189              Specify the server IP address or fully qualified domain name  to
190              use  as a destination for DHCP protocol messages before dhclient
191              has acquired an IP address.  Normally, dhclient transmits  these
192              messages  to 255.255.255.255 (the IP limited broadcast address).
193              Overriding this is mostly useful for debugging  purposes.   This
194              feature is not supported in DHCPv6 (-6) mode.
195
196       -g relay
197              Set the giaddr field of all packets to the relay IP address sim‐
198              ulating a relay agent.  This is for testing  purposes  only  and
199              should not be expected to work in any consistent or useful way.
200
201       -i     Use  a DUID with DHCPv4 clients.  If no DUID is available in the
202              lease file one will be constructed and saved.  The DUID will  be
203              used  to  construct  a  RFC4361  style  client  id  that will be
204              included in the client's messages.  This client id can be  over‐
205              ridden  by setting a client id in the configuration file.  Over‐
206              riding the client id in this fashion is discouraged.
207
208       -I     Use the standard DDNS scheme from RFCs 4701 & 4702.
209
210
211       --decline-wait-time seconds
212              Specify the time (in seconds) that an IPv4 client  should
213              wait  after  declining  an  address before issuing a dis‐
214              cover.  The default is 10 seconds as recommended  by  RFC
215              2131,  Section 3.1.5.  A value of zero equates to no wait
216              at all.
217
218       --version Print version number and exit.
219
220       Options available for DHCPv6 mode:
221
222       -S     Use Information-request to get only stateless  configura‐
223              tion  parameters  (i.e.,  without address).  This implies
224              -6.  It also doesn't rewrite the lease database.
225
226       -T     Ask for IPv6 temporary addresses, one set  per  -T  flag.
227              This  implies  -6  and  also  disables the normal address
228              query.  See -N to restore it.
229
230       -P     Enable IPv6 prefix delegation.  This implies -6 and  also
231              disables the normal address query.  See -N to restore it.
232              Multiple prefixes  can  be  requested  with  multiple  -P
233              flags.  Note only one requested interface is allowed.
234
235       -R     Require that responses include all of the items requested
236              by any -N, -T, or -P options.  Normally even if the  com‐
237              mand  line  includes a number of these the client will be
238              willing to accept the best lease it can even if the lease
239              doesn't  include all of the requested items.  This option
240              causes the client to only accept leases that include  all
241              of the requested items.
242
243              Note  well:  enabling  this  may  prevent the client from
244              using any leases it receives if the servers  aren't  con‐
245              figured to supply all of the items.
246
247       -D LL or LLT
248              Override  the  default when selecting the type of DUID to
249              use.  By default, DHCPv6 dhclient creates  an  identifier
250              based  on  the link-layer address (DUID-LL) if it is run‐
251              ning in  stateless  mode  (with  -S,  not  requesting  an
252              address),  or it creates an identifier based on the link-
253              layer address plus a timestamp (DUID-LLT) if it  is  run‐
254              ning   in   stateful  mode  (without  -S,  requesting  an
255              address).  When DHCPv4 is configured to use a DUID  using
256              -i option the default is to use a DUID-LLT.  -D overrides
257              these default, with a value of either LL or LLT.
258
259       -N     Restore normal address query for IPv6. This  implies  -6.
260              It  is used to restore normal operation after using -T or
261              -P.  Multiple addresses can be requested with multiple -N
262              flags.
263
264       --address-prefix-len length
265              Specify the length of the prefix for IPv6 addresses. This
266              value is passed by dhclient into the  client  script  via
267              the  environment  variable,  ip6_prefixlen,  when binding
268              IPv6 addresses.  The default value is 128.  Alternatively
269              you  may  change  the  default at compile time by setting
270              DHCLIENT_DEFAULT_PREFIX_LEN in includes/site.h.
271
272       --dad-wait-time seconds
273              Specify maximum time (in seconds) that the client  should
274              wait  for  the  duplicate address detection (DAD) to com‐
275              plete on an interface. This value is  propagated  to  the
276              dhclient  script in a dad_wait_time environment variable.
277              If any of the IPv6 addresses on the interface are  tenta‐
278              tive  (DAD  is in progress), the script will wait for the
279              specified number of seconds for DAD to complete.  If  the
280              script ignores this variable the parameter has no effect.
281
282       --prefix-len-hint length
283              When  used  in conjunction with -P, it directs the client
284              to use  the  given  length  to  use  a  prefix  hint  of,
285              "::/length", when requesting new prefixes.
286
287       Modifying  default  file locations: The following options can be
288       used to modify the locations a client uses for its files.   They
289       can be particularly useful if, for example, /var/lib/dhclient or
290       /var/run have not been mounted when the DHCP client is started.
291
292       -cf config-file
293              Path to the client configuration file.   If  unspecified,
294              the   default   /etc/dhcp/dhclient.conf   is  used.   See
295              dhclient.conf(5) for a description of this file.
296
297       -df duid-lease-file
298              Path to a secondary lease file.   If  the  primary  lease
299              file  doesn't  contain a DUID this file will be searched.
300              The DUID read from the secondary will be written  to  the
301              primary.   This  option  can  be  used  to  allow an IPv4
302              instance of the client to  share  a  DUID  with  an  IPv6
303              instance.  After starting one of the instances the second
304              can be started with this option  pointing  to  the  lease
305              file  of the first instance.  There is no default.  If no
306              file is specified no search is made for a DUID should one
307              not be found in the main lease file.
308
309       -lf lease-file
310              Path  to  the  lease  database file.  If unspecified, the
311              default /var/lib/dhclient/dhclient.leases is  used.   See
312              dhclient.leases(5) for a description of this file.
313
314       -pf pid-file
315              Path to the process ID file.  If unspecified, the default
316              /var/run/dhclient.pid is used.
317
318       --no-pid
319              Option to disable writing pid files.  By default the pro‐
320              gram  will  write  a pid file.  If the program is invoked
321              with this option it will not attempt to kill any existing
322              client processes even if invoked with -r or -x.
323
324       -sf script-file
325              Path  to  the  network  configuration  script  invoked by
326              dhclient when it  gets  a  lease.   If  unspecified,  the
327              default /usr/sbin/dhclient-script is used.  See dhclient-
328              script(8) for a description of this file.
329
330       -B     Always set the bootp broadcast flag in  request  packets,
331              so  that  servers  will  always  broadcast  replies. This
332              option is provided as an extension to enable dhclient  to
333              work on IBM s390 Linux guests.
334

PORTS

336       During  operations the client may use multiple UDP ports to pro‐
337       vide different functions.  Which ports  are  opened  depends  on
338       both  the  way  you compiled your code and the configuration you
339       supply.  The following should provide you an idea of what  ports
340       may be in use.
341
342       Normally  a  DHCPv4 client will open a raw UDP socket to receive
343       and send most DHCPv4 packets.  It  also  opens  a  fallback  UDP
344       socket  for use in sending unicast packets.  Normally these will
345       both use the well known port number for BOOTPC.
346
347       For DHCPv6 the client opens a  UDP  socket  on  the  well  known
348       client  port  and a fallback UDP socket on a random port for use
349       in sending unicast  messages.   Unlike  DHCPv4  the  well  known
350       socket doesn't need to be opened in raw mode.
351
352       If  you have included an omapi port statement in your configura‐
353       tion file then the client will open a TCP socket on that port to
354       listen  for  OMPAI connections.  When something connects another
355       port will be used for the established connection.
356
357       When DDNS is enabled at compile time (see  includes/site.h)  the
358       client  will open both a v4 and a v6 UDP socket on random ports.
359       These  ports  are  not  opened  unless/until  the  client  first
360       attempts to do an update.  If the client is not configured to do
361       updates, the ports will never be opened.
362

CONFIGURATION

364       The syntax of the dhclient.conf(5) file is discussed separately.
365

OMAPI

367       The DHCP client provides some ability to control it while it  is
368       running, without stopping it.  This capability is provided using
369       OMAPI, an API for manipulating remote  objects.   OMAPI  clients
370       connect  to  the client using TCP/IP, authenticate, and can then
371       examine the client's current status and make changes to it.
372
373       Rather than implementing the underlying OMAPI protocol directly,
374       user  programs  should  use  the  dhcpctl  API  or OMAPI itself.
375       Dhcpctl is a wrapper  that  handles  some  of  the  housekeeping
376       chores  that OMAPI does not do automatically.  Dhcpctl and OMAPI
377       are documented in dhcpctl(3) and omapi(3).   Most  things  you'd
378       want  to  do  with  the  client  can  be done directly using the
379       omshell(1) command, rather than having to write a  special  pro‐
380       gram.
381

THE CONTROL OBJECT

383       The control object allows you to shut the client down, releasing
384       all leases that it holds and deleting any  DNS  records  it  may
385       have  added.   It  also  allows  you  to pause the client - this
386       unconfigures any interfaces the client is using.  You  can  then
387       restart  it,  which  causes  it to reconfigure those interfaces.
388       You would normally pause the client prior to going into hiberna‐
389       tion  or  sleep  on a laptop computer.  You would then resume it
390       after the power comes back.  This allows PC  cards  to  be  shut
391       down  while  the  computer  is hibernating or sleeping, and then
392       reinitialized to their previous state once  the  computer  comes
393       out of hibernation or sleep.
394
395       The  control object has one attribute - the state attribute.  To
396       shut the client down, set its state attribute  to  2.   It  will
397       automatically  do  a  DHCPRELEASE.   To  pause it, set its state
398       attribute to 3.  To resume it, set its state attribute to 4.
399

ENVIRONMENT VARIABLES

401       The following environment variables may be defined  to  override
402       the  builtin  defaults for file locations.  Note that use of the
403       related command-line options will ignore the corresponding envi‐
404       ronment variable settings.
405
406       PATH_DHCLIENT_CONF
407              The dhclient.conf configuration file.
408
409       PATH_DHCLIENT_DB
410              The dhclient.leases database.
411
412       PATH_DHCLIENT_PID
413              The dhclient PID file.
414
415       PATH_DHCLIENT_SCRIPT
416              The dhclient-script file.
417

FILES

419       /usr/sbin/dhclient-script,              /etc/dhcp/dhclient.conf,
420       /var/lib/dhclient/dhclient.leases,        /var/run/dhclient.pid,
421       /var/lib/dhclient/dhclient.leases~.
422

SEE ALSO

424       dhcpd(8),   dhcrelay(8),  dhclient-script(8),  dhclient.conf(5),
425       dhclient.leases(5), dhcp-eval(5).
426

AUTHOR

428       dhclient(8) To learn more about Internet Systems Consortium, see
429       https://www.isc.org
430
431       This  client  was  substantially modified and enhanced by Elliot
432       Poger for use on Linux while he was working on  the  MosquitoNet
433       project at Stanford.
434
435       The  current  version  owes much to Elliot's Linux enhancements,
436       but was substantially reorganized and partially rewritten by Ted
437       Lemon so as to use the same networking framework that the Inter‐
438       net Systems Consortium DHCP server uses.   Much  system-specific
439       configuration code was moved into a shell script so that as sup‐
440       port for more operating systems is added, it will not be  neces‐
441       sary  to port and maintain system-specific configuration code to
442       these operating systems - instead, the shell script  can  invoke
443       the native tools to accomplish the same purpose.
444
445                                                                   dhclient(8)
Impressum