xref: /dragonfly/sbin/dhclient/dhclient.8 (revision 92fe556d)
1.\" $OpenBSD: src/sbin/dhclient/dhclient.8,v 1.8 2011/03/02 07:44:42 jmc Exp $
2.\"
3.\" Copyright (c) 1997 The Internet Software Consortium.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\"
10.\" 1. Redistributions of source code must retain the above copyright
11.\"    notice, this list of conditions and the following disclaimer.
12.\" 2. Redistributions in binary form must reproduce the above copyright
13.\"    notice, this list of conditions and the following disclaimer in the
14.\"    documentation and/or other materials provided with the distribution.
15.\" 3. Neither the name of The Internet Software Consortium nor the names
16.\"    of its contributors may be used to endorse or promote products derived
17.\"    from this software without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
20.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23.\" DISCLAIMED.  IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
24.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31.\" SUCH DAMAGE.
32.\"
33.\" This software has been written for the Internet Software Consortium
34.\" by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
35.\" Enterprises.  To learn more about the Internet Software Consortium,
36.\" see ``http://www.isc.org/isc''.  To learn more about Vixie
37.\" Enterprises, see ``http://www.vix.com''.
38.Dd July 23, 2013
39.Dt DHCLIENT 8
40.Os
41.Sh NAME
42.Nm dhclient
43.Nd Dynamic Host Configuration Protocol (DHCP) client
44.Sh SYNOPSIS
45.Nm
46.Op Fl dquwx
47.Op Fl c Ar file
48.Op Fl l Ar file
49.Ar interface
50.Sh DESCRIPTION
51The Dynamic Host Configuration Protocol (DHCP) allows hosts on a TCP/IP network
52to configure one or more network interfaces based on information collected from
53a DHCP server.
54DHCP is often used, for example, by cable modem and DSL network
55providers to automate network configuration for their customers.
56.Pp
57Information typically provided via DHCP includes
58address and subnet mask for the interface,
59default route,
60and domain name server.
61.Pp
62To have
63.Dx
64configure an interface using DHCP
65(or its predecessor, BOOTP)
66the
67.Nm
68utility is used.
69.Nm
70is run on the command line with the name of the
71.Ar interface
72to be configured.
73If a
74.Nm
75is already running for the interface, the old process will be killed and
76replaced by the new invocation.
77.Pp
78The options are as follows:
79.Bl -tag -width "-p port"
80.It Fl c Ar file
81Specify an alternate location to
82.Pa /etc/dhclient.conf
83for the configuration file.
84.It Fl d
85Forces
86.Nm
87to always run as a foreground process.
88By default,
89.Nm
90runs in the foreground until it has configured the interface, and then
91will revert to running in the background.
92.It Fl l Ar file
93Specify an alternate location to
94.Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME
95for the leases file.
96.It Fl q
97Forces
98.Nm
99to be less verbose on startup.
100.It Fl u
101Forces
102.Nm
103to reject leases with unknown options in them.
104The default behaviour is to accept such lease offers.
105.It Fl w
106.Nm
107stays around permanently and will attempt to reconnect even if
108the interface does not exist, is down, or goes down.
109This is the default when interfaces are configured DHCP in
110.Pa /etc/dhclient.conf
111.It Fl x
112Kill any running
113.Nm
114on the specified interface.
115.El
116.Pp
117The DHCP protocol allows a host to contact a central server which
118maintains a list of IP addresses which may be assigned on one or more
119subnets.
120A DHCP client may request an address from this pool, and
121then use it on a temporary basis for communication on the network.
122The DHCP protocol also provides a mechanism whereby a client can learn
123important details about the network to which it is attached, such as
124the location of a default router, the location of a name server, and
125so on.
126.Pp
127On startup,
128.Nm
129reads
130.Pa /etc/dhclient.conf
131for configuration instructions.
132It then attempts to configure the network interface
133.Ar interface
134with DHCP.
135.Pp
136In order to keep track of leases across system reboots and server
137restarts,
138.Nm
139keeps a list of leases it has been assigned in the
140.Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME
141file.
142.Ar IFNAME
143represents the network interface of the DHCP client
144.Pq e.g. em0 ,
145one for each interface.
146On startup, after reading the
147.Xr dhclient.conf 5
148file,
149.Nm
150reads the leases file to refresh its memory about what leases it has been
151assigned.
152.Pp
153Old leases are kept around in case the DHCP server is unavailable when
154.Nm
155is first invoked (generally during the initial system boot
156process).
157In that event, old leases from the
158.Pa dhclient.leases. Ns Aq Ar IFNAME
159file which have not yet expired are tested, and if they are determined to
160be valid, they are used until either they expire or the DHCP server
161becomes available.
162.Pp
163A mobile host which may sometimes need to access a network on which no
164DHCP server exists may be preloaded with a lease for a fixed
165address on that network.
166When all attempts to contact a DHCP server have failed,
167.Nm
168will try to validate the static lease, and if it
169succeeds, it will use that lease until it is restarted.
170.Pp
171A mobile host may also travel to some networks on which DHCP is not
172available but BOOTP is.
173In that case, it may be advantageous to
174arrange with the network administrator for an entry on the BOOTP
175database, so that the host can boot quickly on that network rather
176than cycling through the list of old leases.
177.Pp
178.Nm
179requires at least one
180.Pa /dev/bpf*
181file for each broadcast network interface.
182See
183.Xr bpf 4
184for more information.
185.Sh FILES
186.Bl -tag -width "/var/db/dhclient.leases.<IFNAME>XXX" -compact
187.It Pa /etc/dhclient.conf
188DHCP client configuration file.
189.It Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME
190Database of acquired leases.
191.It Pa /var/run/dhclient.<IFNAME>.pid
192Pidfile for running instance.
193While active, the pidfile is
194.Fn flock Ap d
195by
196.Nm
197which can be tested by a program using
198.Fn flock
199or by a script using the
200.Xr lockf 1
201utility, via a non-blocking lock attempt.
202.El
203.Sh SEE ALSO
204.Xr bpf 4 ,
205.Xr dhclient.conf 5 ,
206.Xr dhclient.leases 5 ,
207.Xr dhclient-script 8 ,
208.Xr dhcp 8 ,
209.Xr dhcpd 8 Pq Pa net/isc-dhcp42-server ,
210.Xr dhcrelay 8 Pq Pa net/isc-dhcp42-relay
211.Sh STANDARDS
212.Rs
213.%A R. Droms
214.%D October 1993
215.%R RFC 1534
216.%T Interoperation Between DHCP and BOOTP
217.Re
218.Pp
219.Rs
220.%A R. Droms
221.%D March 1997
222.%R RFC 2131
223.%T Dynamic Host Configuration Protocol
224.Re
225.Pp
226.Rs
227.%A S. Alexander
228.%A R. Droms
229.%D March 1997
230.%R RFC 2132
231.%T DHCP Options and BOOTP Vendor Extensions
232.Re
233.Pp
234.Rs
235.%A T. Lemon
236.%A S. Cheshire
237.%D November 2002
238.%R RFC 3396
239.%T Encoding Long Options in the Dynamic Host Configuration Protocol (DHCPv4)
240.Re
241.Pp
242.Rs
243.%A T. Lemon
244.%A S. Cheshire
245.%A B. Volz
246.%D December 2002
247.%R RFC 3442
248.%T The Classless Static Route Option for Dynamic Host Configuration Protocol (DHCP) version 4
249.Re
250.Sh HISTORY
251.Nm
252was imported into
253.Dx 2.1 .
254.Sh AUTHORS
255.An -nosplit
256.Nm
257was written by
258.An Ted Lemon Aq Mt mellon@fugue.com
259and
260.An Elliot Poger Aq Mt elliot@poger.com .
261.Pp
262The current implementation was reworked by
263.An Henning Brauer Aq Mt henning@openbsd.org .
264