xref: /freebsd/sbin/dhclient/dhclient.8 (revision 87b759f0fa1f7554d50ce640c40138512bbded44)
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 1, 2024
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 n
86Make
87.Nm
88not wait for ARP resolution.
89.It Fl p Ar file
90Specify an alternate location for the PID file.
91The default is
92.Pa /var/run/dhclient/dhclient. Ns Ar interface Ns Pa .pid .
93.It Fl q
94Forces
95.Nm
96to be less verbose on startup.
97.It Fl u
98Forces
99.Nm
100to reject leases with unknown options in them.
101The default behaviour is to accept such lease offers.
102.El
103.Pp
104The DHCP protocol allows a host to contact a central server which
105maintains a list of IP addresses which may be assigned on one or more
106subnets.
107A DHCP client may request an address from this pool, and
108then use it on a temporary basis for communication on the network.
109The DHCP protocol also provides a mechanism whereby a client can learn
110important details about the network to which it is attached, such as
111the location of a default router, the location of a name server, and
112so on.
113.Pp
114On startup,
115.Nm
116reads
117.Pa /etc/dhclient.conf
118for configuration instructions.
119It then gets a list of all the
120network interfaces that are configured in the current system.
121It then attempts to configure each interface with DHCP.
122.Pp
123In order to keep track of leases across system reboots and server
124restarts,
125.Nm
126keeps a list of leases it has been assigned in the
127.Pa /var/db/dhclient.leases. Ns Ar IFNAME
128file.
129.Ar IFNAME
130represents the network interface of the DHCP client
131(e.g.,
132.Li em0 ) ,
133one for each interface.
134On startup, after reading the
135.Xr dhclient.conf 5
136file,
137.Nm
138reads the leases file to refresh its memory about what leases it has been
139assigned.
140.Pp
141Old leases are kept around in case the DHCP server is unavailable when
142.Nm
143is first invoked (generally during the initial system boot
144process).
145In that event, old leases from the
146.Pa dhclient.leases. Ns Ar IFNAME
147file which have not yet expired are tested, and if they are determined to
148be valid, they are used until either they expire or the DHCP server
149becomes available.
150.Pp
151A mobile host which may sometimes need to access a network on which no
152DHCP server exists may be preloaded with a lease for a fixed
153address on that network.
154When all attempts to contact a DHCP server have failed,
155.Nm
156will try to validate the static lease, and if it
157succeeds, it will use that lease until it is restarted.
158.Pp
159A mobile host may also travel to some networks on which DHCP is not
160available but BOOTP is.
161In that case, it may be advantageous to
162arrange with the network administrator for an entry on the BOOTP
163database, so that the host can boot quickly on that network rather
164than cycling through the list of old leases.
165.Sh NOTES
166You must have the Berkeley Packet Filter (BPF) configured in your kernel.
167The
168.Nm
169utility
170requires at least one
171.Pa /dev/bpf*
172device for each broadcast network interface that is attached to your system.
173See
174.Xr bpf 4
175for more information.
176.Sh FILES
177.Bl -tag -width ".Pa /var/db/dhclient.leases. Ns Ar IFNAME" -compact
178.It Pa /etc/dhclient.conf
179DHCP client configuration file
180.It Pa /var/db/dhclient.leases. Ns Ar IFNAME
181database of acquired leases
182.El
183.Sh SEE ALSO
184.Xr dhclient.conf 5 ,
185.Xr dhclient.leases 5 ,
186.Xr dhclient-script 8
187.Sh AUTHORS
188.An -nosplit
189The
190.Nm
191utility
192was written by
193.An Ted Lemon Aq Mt mellon@fugue.com
194and
195.An Elliot Poger Aq Mt elliot@poger.com .
196.Pp
197The current implementation was reworked by
198.An Henning Brauer Aq Mt henning@openbsd.org .
199.Sh BUGS
200The
201.Nm
202utility uses
203.Xr capsicum 4
204to sandbox the main process.
205If the requisite kernel support is not available, the main process will
206attempt to run in a
207.Xr chroot 2
208sandbox instead.
209This will fail if the process is jailed or the
210.Va kern.chroot_allow_open_directories
211sysctl is set to 0.
212