1dhclient(8) System Manager's Manual dhclient(8)
2
3
4
6 dhclient - Dynamic Host Configuration Protocol Client
7
9 dhclient [ -p port ] [ -d ] [ -e VAR=value ] [ -q ] [ -1 ] [ -r ] [ -lf
10 lease-file ] [ -pf pid-file ] [ -cf config-file ] [ -sf script-file ] [
11 -s server ] [ -g relay ] [ -n ] [ -nw ] [ -w ] [ -x ] [ -I dhcp-client-
12 identifier ] [ -H host-name | -F fqdn.fqdn ] [ -V vendor-class-identi‐
13 fier ] [ -R request option list ] [ -T timeout ] [ if0 [ ...ifN ] ]
14
16 The Internet Systems Consortium DHCP Client, dhclient, provides a means
17 for configuring one or more network interfaces using the Dynamic Host
18 Configuration Protocol, BOOTP protocol, or if these protocols fail, by
19 statically assigning an address.
20
22 The DHCP protocol allows a host to contact a central server which main‐
23 tains a list of IP addresses which may be assigned on one or more sub‐
24 nets. A DHCP client may request an address from this pool, and then
25 use it on a temporary basis for communication on network. The DHCP
26 protocol also provides a mechanism whereby a client can learn important
27 details about the network to which it is attached, such as the location
28 of a default router, the location of a name server, and so on.
29
30 On startup, dhclient reads the dhclient.conf for configuration instruc‐
31 tions. It then gets a list of all the network interfaces that are
32 configured in the current system. For each interface, it attempts to
33 configure the interface using the DHCP protocol.
34
35 In order to keep track of leases across system reboots and server
36 restarts, dhclient keeps a list of leases it has been assigned in the
37 dhclient.leases(5) file. On startup, after reading the dhclient.conf
38 file, dhclient reads the dhclient.leases file to refresh its memory
39 about what leases it has been assigned.
40
41 When a new lease is acquired, it is appended to the end of the
42 dhclient.leases file. In order to prevent the file from becoming
43 arbitrarily large, from time to time dhclient creates a new
44 dhclient.leases file from its in-core lease database. The old version
45 of the dhclient.leases file is retained under the name dhclient.leases~
46 until the next time dhclient rewrites the database.
47
48 Old leases are kept around in case the DHCP server is unavailable when
49 dhclient is first invoked (generally during the initial system boot
50 process). In that event, old leases from the dhclient.leases file
51 which have not yet expired are tested, and if they are determined to be
52 valid, they are used until either they expire or the DHCP server
53 becomes available.
54
55 A mobile host which may sometimes need to access a network on which no
56 DHCP server exists may be preloaded with a lease for a fixed address on
57 that network. When all attempts to contact a DHCP server have failed,
58 dhclient will try to validate the static lease, and if it succeeds,
59 will use that lease until it is restarted.
60
61 A mobile host may also travel to some networks on which DHCP is not
62 available but BOOTP is. In that case, it may be advantageous to
63 arrange with the network administrator for an entry on the BOOTP data‐
64 base, so that the host can boot quickly on that network rather than
65 cycling through the list of old leases.
66
68 The names of the network interfaces that dhclient should attempt to
69 configure may be specified on the command line. If no interface names
70 are specified on the command line dhclient will normally identify all
71 network interfaces, eliminating non-broadcast interfaces if possible,
72 and attempt to configure each interface.
73
74 It is also possible to specify interfaces by name in the
75 dhclient.conf(5) file. If interfaces are specified in this way, then
76 the client will only configure interfaces that are either specified in
77 the configuration file or on the command line, and will ignore all
78 other interfaces.
79
80 If the DHCP client should listen and transmit on a port other than the
81 standard (port 68), the -p flag may used. It should be followed by the
82 udp port number that dhclient should use. This is mostly useful for
83 debugging purposes. If a different port is specified for the client to
84 listen on and transmit on, the client will also use a different desti‐
85 nation port - one greater than the specified destination port.
86
87 The DHCP client normally transmits any protocol messages it sends
88 before acquiring an IP address to, 255.255.255.255, the IP limited
89 broadcast address. For debugging purposes, it may be useful to have
90 the server transmit these messages to some other address. This can be
91 specified with the -s flag, followed by the IP address or domain name
92 of the destination.
93
94 For testing purposes, the giaddr field of all packets that the client
95 sends can be set using the -g flag, followed by the IP address to send.
96 This is only useful for testing, and should not be expected to work in
97 any consistent or useful way.
98
99 The DHCP client will normally run in the foreground until it has con‐
100 figured an interface, and then will revert to running in the back‐
101 ground. To run force dhclient to always run as a foreground process,
102 the -d flag should be specified. This is useful when running the
103 client under a debugger, or when running it out of inittab on System V
104 systems.
105
106 The dhclient daemon creates its own environment when executing the
107 dhclient-script to do the grunt work of interface configuration. To
108 define extra environment variables and their values, use the -e flag,
109 followed by the environment variable name and value assignment, just as
110 one would assign a variable in a shell. Eg: -e IF_METRIC=1
111
112 The client normally prints a startup message and displays the protocol
113 sequence to the standard error descriptor until it has acquired an
114 address, and then only logs messages using the syslog (3) facility.
115 The -q flag prevents any messages other than errors from being printed
116 to the standard error descriptor.
117
118 The client normally doesn't release the current lease as it is not
119 required by the DHCP protocol. Some cable ISPs require their clients
120 to notify the server if they wish to release an assigned IP address.
121 The -r flag explicitly releases the current lease, and once the lease
122 has been released, the client exits.
123
124 The -1 flag cause dhclient to try once to get a lease. If it fails,
125 dhclient exits with exit code two.
126
127 The DHCP client normally gets its configuration information from
128 /etc/dhclient.conf, its lease database from
129 /var/lib/dhcpd/dhclient.leases, stores its process ID in a file called
130 /var/run/dhclient.pid, and configures the network interface using
131 /sbin/dhclient-script To specify different names and/or locations for
132 these files, use the -cf, -lf, -pf and -sf flags, respectively, fol‐
133 lowed by the name of the file. This can be particularly useful if,
134 for example, /var/lib/dhcpd or /var/run has not yet been mounted when
135 the DHCP client is started.
136
137 The DHCP client normally exits if it isn't able to identify any network
138 interfaces to configure. On laptop computers and other computers with
139 hot-swappable I/O buses, it is possible that a broadcast interface may
140 be added after system startup. The -w flag can be used to cause the
141 client not to exit when it doesn't find any such interfaces. The
142 omshell (1) program can then be used to notify the client when a net‐
143 work interface has been added or removed, so that the client can
144 attempt to configure an IP address on that interface.
145
146 The DHCP client can be directed not to attempt to configure any inter‐
147 faces using the -n flag. This is most likely to be useful in combina‐
148 tion with the -w flag.
149
150 The client can also be instructed to become a daemon immediately,
151 rather than waiting until it has acquired an IP address. This can be
152 done by supplying the -nw flag.
153
154 The -x argument enables extended option information to be created in
155 the -s dhclient-script environment, which would allow applications run‐
156 ning in that environment to handle options they do not know about in
157 advance - this is a Red Hat extension to support dhcdbd and NetworkMan‐
158 ager.
159
160 The -I <id> argument allows you to specify the dhcp-client-identifier
161 string, <id>, to be sent to the dhcp server on the command line. It is
162 equivalent to the top level dhclient.conf statement:
163 send dhcp-client-identifier "<id>";
164 The -I <id> command line option will override any top level
165 dhclient.conf
166 'send dhcp-client-identifier' statement, but more specific per-inter‐
167 face
168 'interface "X" { send dhcp-client-identifier...; }' statements in
169 dhclient.conf will override the -I <id> command line option for inter‐
170 face "X". This option is provided as a Red Hat extension to enable
171 dhclient to work on IBM zSeries z/OS Linux guests.
172
173 The -B option instructs dhclient to set the bootp broadcast flag in
174 request packets, so that servers will always broadcast replies. This is
175 equivalent to specifying the 'bootp-broadcast-always' option in
176 dhclient.conf, and has the same effect as specifying 'always-broadcast'
177 in the server's dhcpd.conf. This option is provided as a Red Hat
178 extension to enable dhclient to work on IBM zSeries z/OS Linux guests.
179
180 The -H <host-name> option allows you to specify the DHCP host-name
181 option to send to the server on the dhclient command line. It is equiv‐
182 alent to the top level dhclient.conf statement:
183 send host-name "<host-name>";
184 The -H <host-name> option will override any top level dhclient.conf
185 'send host-name' statement, but more specific per-interface
186 'interface "X" { send host-name...;' statements in dhclient.conf will
187 override the -H <host-name> command line option for interface "X". The
188 host-name option only specifies the client's host name prefix, to which
189 the server will append the 'ddns-domainname' or 'domain-name' options,
190 if any, to derive the fully qualified domain name of the client host.
191 The -H <host-name> option cannot be used with the -F <fqdn.fqdn>
192 option. Only one -H <host-name> option may be specified. The -H
193 <host-name> option is provided as a Red Hat extension to simplify con‐
194 figuration of clients of DHCP servers that require the host-name option
195 to be sent (eg. some modern cable modems), and for dynamic DNS updates
196 (DDNS).
197
198 The -F <fqdn.fqdn> option allows you to specify the DHCP fqdn.fqdn
199 option to send to the server on the dhclient command line. It is equiv‐
200 alent to the top level dhclient.conf statement:
201 send fqdn.fqdn "<domain-name>";
202 The -F <fqdn.fqdn> option will override any top level dhclient.conf
203 'send fqdn.fqdn' statement, but more specific per-interface
204 'interface "X" { send fqdn.fqdn...;' statements in dhclient.conf will
205 override the -F <fqdn.fqdn> command line option for interface "X".
206 This option cannot be used with the -H <host-name> option. The DHCP
207 fqdn.fqdn option must specify the complete domain name of the client
208 host, which the server may use for dynamic DNS updates. Only one -F
209 <fqdn.fqdn> option may be specified. The -F <fqdn.fqdn> option is pro‐
210 vided as a Red Hat extension to simplify configuration of DDNS.
211
212 The -T <timeout> option allows you to specify the time after which the
213 dhclient will decide that no DHCP servers can be contacted when no
214 responses have been received. It is equivalent to the
215 timeout <integer>;
216 dhclient.conf statement, and will override any such statements in
217 dhclient.conf.
218 This option is provided as a Red Hat extension.
219
220 The -V <vendor-class-identifier> option allows you to specify the DHCP
221 vendor-class-identifier option to send to the server on the dhclient
222 command line. It is equivalent to the top level dhclient.conf state‐
223 ment:
224 send vendor-class-identifier "<vendor-class-identifier>";
225 The -V <vendor-class-identifier> option will override any top level
226 dhclient.conf
227 'send vendor-class-identifier' statement, but more specific per-inter‐
228 face
229 'interface "X" { send vendor-class-identifier...;' statements in
230 dhclient.conf will override the -V <vendor-class-identifier> command
231 line option for interface "X". The -V <vendor-class-identifier> option
232 is provided as a Red Hat extension to simplify configuration of clients
233 of DHCP servers that require the vendor-class-identifier option to be
234 sent.
235
236 The -R <request option list> option allows you to specify the list of
237 options the client is to request from the server on the dhclient com‐
238 mand line. The option list must be a single string, consisting of
239 option names separated by at least one comma and optional space charac‐
240 ters. The default option list is :
241 subnet-mask, broadcast-address, time-offset, routers,
242 domain-name, domain-name-servers, host-name, nis-domain,
243 nis-servers, ntp-servers
244 You can specify a different list of options to request with the -R
245 <option list> argument. This is equivalent to the dhclient.conf state‐
246 ment:
247 request <option list> ;
248 The -R argument is provided as a Red Hat extension to ISC dhclient to
249 facilitate requesting a list of options from the server different to
250 the default.
251
253 The syntax of the dhclient.conf(5) file is discussed separately.
254
256 The DHCP client provides some ability to control it while it is run‐
257 ning, without stopping it. This capability is provided using OMAPI, an
258 API for manipulating remote objects. OMAPI clients connect to the
259 client using TCP/IP, authenticate, and can then examine the client's
260 current status and make changes to it.
261
262 Rather than implementing the underlying OMAPI protocol directly, user
263 programs should use the dhcpctl API or OMAPI itself. Dhcpctl is a
264 wrapper that handles some of the housekeeping chores that OMAPI does
265 not do automatically. Dhcpctl and OMAPI are documented in dhcpctl(3)
266 and omapi(3). Most things you'd want to do with the client can be
267 done directly using the omshell(1) command, rather than having to write
268 a special program.
269
271 The control object allows you to shut the client down, releasing all
272 leases that it holds and deleting any DNS records it may have added.
273 It also allows you to pause the client - this unconfigures any inter‐
274 faces the client is using. You can then restart it, which causes it
275 to reconfigure those interfaces. You would normally pause the client
276 prior to going into hibernation or sleep on a laptop computer. You
277 would then resume it after the power comes back. This allows PC cards
278 to be shut down while the computer is hibernating or sleeping, and then
279 reinitialized to their previous state once the computer comes out of
280 hibernation or sleep.
281
282 The control object has one attribute - the state attribute. To shut
283 the client down, set its state attribute to 2. It will automatically
284 do a DHCPRELEASE. To pause it, set its state attribute to 3. To
285 resume it, set its state attribute to 4.
286
288 /sbin/dhclient-script, /etc/dhclient.conf,
289 /var/lib/dhcpd/dhclient.leases, /var/run/dhclient.pid,
290 /var/lib/dhcpd/dhclient.leases~.
291
293 dhcpd(8), dhcrelay(8), dhclient-script(8), dhclient.conf(5),
294 dhclient.leases(5).
295
297 dhclient(8) has been written for Internet Systems Consortium by Ted
298 Lemon in cooperation with Vixie Enterprises. To learn more about
299 Internet Systems Consortium, see http://www.isc.org To learn more about
300 Vixie Enterprises, see http://www.vix.com.
301
302 This client was substantially modified and enhanced by Elliot Poger for
303 use on Linux while he was working on the MosquitoNet project at Stan‐
304 ford.
305
306 The current version owes much to Elliot's Linux enhancements, but was
307 substantially reorganized and partially rewritten by Ted Lemon so as to
308 use the same networking framework that the Internet Systems Consortium
309 DHCP server uses. Much system-specific configuration code was moved
310 into a shell script so that as support for more operating systems is
311 added, it will not be necessary to port and maintain system-specific
312 configuration code to these operating systems - instead, the shell
313 script can invoke the native tools to accomplish the same purpose.
314
315 dhclient(8)