xref: /freebsd/sbin/dhclient/dhclient.8 (revision 4543ef516683042d46f3bd3bb8a4f3f746e00499)
1.\" $OpenBSD: dhclient.8,v 1.3 2004/04/09 18:30:15 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.\"
39.Dd August 4, 2018
40.Dt DHCLIENT 8
41.Os
42.Sh NAME
43.Nm dhclient
44.Nd "Dynamic Host Configuration Protocol (DHCP) client"
45.Sh SYNOPSIS
46.Nm
47.Op Fl bdqu
48.Op Fl c Ar file
49.Op Fl l Ar file
50.Op Fl p Ar file
51.Ar interface
52.Sh DESCRIPTION
53The
54.Nm
55utility provides a means for configuring network interfaces using DHCP, BOOTP,
56or if these protocols fail, by statically assigning an address.
57.Pp
58The name of the network interface that
59.Nm
60should attempt to
61configure must be specified on the command line.
62.Pp
63The options are as follows:
64.Bl -tag -width ".Fl c Ar file"
65.It Fl b
66Forces
67.Nm
68to immediately move to the background.
69.It Fl c Ar file
70Specify an alternate location,
71.Ar file ,
72for the configuration file.
73.It Fl d
74Forces
75.Nm
76to always run as a foreground process.
77By default,
78.Nm
79runs in the foreground until it has configured the interface, and then
80will revert to running in the background.
81.It Fl l Ar file
82Specify an alternate location,
83.Ar file ,
84for the leases file.
85.It Fl p Ar file
86Specify an alternate location for the PID file.
87The default is
88.Pa /var/run/dhclient/dhclient. Ns Ar interface Ns Pa .pid .
89.It Fl q
90Forces
91.Nm
92to be less verbose on startup.
93.It Fl u
94Forces
95.Nm
96to reject leases with unknown options in them.
97The default behaviour is to accept such lease offers.
98.El
99.Pp
100The DHCP protocol allows a host to contact a central server which
101maintains a list of IP addresses which may be assigned on one or more
102subnets.
103A DHCP client may request an address from this pool, and
104then use it on a temporary basis for communication on the network.
105The DHCP protocol also provides a mechanism whereby a client can learn
106important details about the network to which it is attached, such as
107the location of a default router, the location of a name server, and
108so on.
109.Pp
110On startup,
111.Nm
112reads
113.Pa /etc/dhclient.conf
114for configuration instructions.
115It then gets a list of all the
116network interfaces that are configured in the current system.
117It then attempts to configure each interface with DHCP.
118.Pp
119In order to keep track of leases across system reboots and server
120restarts,
121.Nm
122keeps a list of leases it has been assigned in the
123.Pa /var/db/dhclient.leases. Ns Ar IFNAME
124file.
125.Ar IFNAME
126represents the network interface of the DHCP client
127(e.g.,
128.Li em0 ) ,
129one for each interface.
130On startup, after reading the
131.Xr dhclient.conf 5
132file,
133.Nm
134reads the leases file to refresh its memory about what leases it has been
135assigned.
136.Pp
137Old leases are kept around in case the DHCP server is unavailable when
138.Nm
139is first invoked (generally during the initial system boot
140process).
141In that event, old leases from the
142.Pa dhclient.leases. Ns Ar IFNAME
143file which have not yet expired are tested, and if they are determined to
144be valid, they are used until either they expire or the DHCP server
145becomes available.
146.Pp
147A mobile host which may sometimes need to access a network on which no
148DHCP server exists may be preloaded with a lease for a fixed
149address on that network.
150When all attempts to contact a DHCP server have failed,
151.Nm
152will try to validate the static lease, and if it
153succeeds, it will use that lease until it is restarted.
154.Pp
155A mobile host may also travel to some networks on which DHCP is not
156available but BOOTP is.
157In that case, it may be advantageous to
158arrange with the network administrator for an entry on the BOOTP
159database, so that the host can boot quickly on that network rather
160than cycling through the list of old leases.
161.Sh NOTES
162You must have the Berkeley Packet Filter (BPF) configured in your kernel.
163The
164.Nm
165utility
166requires at least one
167.Pa /dev/bpf*
168device for each broadcast network interface that is attached to your system.
169See
170.Xr bpf 4
171for more information.
172.Sh FILES
173.Bl -tag -width ".Pa /var/db/dhclient.leases. Ns Ar IFNAME" -compact
174.It Pa /etc/dhclient.conf
175DHCP client configuration file
176.It Pa /var/db/dhclient.leases. Ns Ar IFNAME
177database of acquired leases
178.El
179.Sh SEE ALSO
180.Xr dhclient.conf 5 ,
181.Xr dhclient.leases 5 ,
182.Xr dhclient-script 8
183.Sh AUTHORS
184.An -nosplit
185The
186.Nm
187utility
188was written by
189.An Ted Lemon Aq Mt mellon@fugue.com
190and
191.An Elliot Poger Aq Mt elliot@poger.com .
192.Pp
193The current implementation was reworked by
194.An Henning Brauer Aq Mt henning@openbsd.org .
195.Sh BUGS
196The
197.Nm
198utility uses
199.Xr capsicum 4
200to sandbox the main process.
201If the requisite kernel support is not available, the main process will
202attempt to run in a
203.Xr chroot 2
204sandbox instead.
205This will fail if the process is jailed or the
206.Va kern.chroot_allow_open_directories
207sysctl is set to 0.
208