xref: /freebsd-src/sbin/dhclient/dhclient.8 (revision 84fce4b67adc1ed1882d9371eb5d92dbbc79766d)
147c08596SBrooks Davis.\" $OpenBSD: dhclient.8,v 1.3 2004/04/09 18:30:15 jmc Exp $
247c08596SBrooks Davis.\"
347c08596SBrooks Davis.\" Copyright (c) 1997 The Internet Software Consortium.
447c08596SBrooks Davis.\" All rights reserved.
547c08596SBrooks Davis.\"
647c08596SBrooks Davis.\" Redistribution and use in source and binary forms, with or without
747c08596SBrooks Davis.\" modification, are permitted provided that the following conditions
847c08596SBrooks Davis.\" are met:
947c08596SBrooks Davis.\"
1047c08596SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright
1147c08596SBrooks Davis.\"    notice, this list of conditions and the following disclaimer.
1247c08596SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright
1347c08596SBrooks Davis.\"    notice, this list of conditions and the following disclaimer in the
1447c08596SBrooks Davis.\"    documentation and/or other materials provided with the distribution.
1547c08596SBrooks Davis.\" 3. Neither the name of The Internet Software Consortium nor the names
1647c08596SBrooks Davis.\"    of its contributors may be used to endorse or promote products derived
1747c08596SBrooks Davis.\"    from this software without specific prior written permission.
1847c08596SBrooks Davis.\"
1947c08596SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
2047c08596SBrooks Davis.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
2147c08596SBrooks Davis.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
2247c08596SBrooks Davis.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2347c08596SBrooks Davis.\" DISCLAIMED.  IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
2447c08596SBrooks Davis.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2547c08596SBrooks Davis.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2647c08596SBrooks Davis.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
2747c08596SBrooks Davis.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2847c08596SBrooks Davis.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
2947c08596SBrooks Davis.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
3047c08596SBrooks Davis.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3147c08596SBrooks Davis.\" SUCH DAMAGE.
3247c08596SBrooks Davis.\"
3347c08596SBrooks Davis.\" This software has been written for the Internet Software Consortium
3447c08596SBrooks Davis.\" by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
3547c08596SBrooks Davis.\" Enterprises.  To learn more about the Internet Software Consortium,
3647c08596SBrooks Davis.\" see ``http://www.isc.org/isc''.  To learn more about Vixie
3747c08596SBrooks Davis.\" Enterprises, see ``http://www.vix.com''.
389a7feaa1SRuslan Ermilov.\"
39*84fce4b6SIsaac Cilia Attard.Dd August 1, 2024
4047c08596SBrooks Davis.Dt DHCLIENT 8
4147c08596SBrooks Davis.Os
4247c08596SBrooks Davis.Sh NAME
4347c08596SBrooks Davis.Nm dhclient
449a7feaa1SRuslan Ermilov.Nd "Dynamic Host Configuration Protocol (DHCP) client"
4547c08596SBrooks Davis.Sh SYNOPSIS
4647c08596SBrooks Davis.Nm
473dd3357aSBrian Somers.Op Fl bdqu
4847c08596SBrooks Davis.Op Fl c Ar file
4947c08596SBrooks Davis.Op Fl l Ar file
5023f39c90SDag-Erling Smørgrav.Op Fl p Ar file
5147c08596SBrooks Davis.Ar interface
5247c08596SBrooks Davis.Sh DESCRIPTION
5347c08596SBrooks DavisThe
5447c08596SBrooks Davis.Nm
5547c08596SBrooks Davisutility provides a means for configuring network interfaces using DHCP, BOOTP,
5647c08596SBrooks Davisor if these protocols fail, by statically assigning an address.
5747c08596SBrooks Davis.Pp
5847c08596SBrooks DavisThe name of the network interface that
5947c08596SBrooks Davis.Nm
6047c08596SBrooks Davisshould attempt to
6147c08596SBrooks Davisconfigure must be specified on the command line.
6247c08596SBrooks Davis.Pp
6347c08596SBrooks DavisThe options are as follows:
649a7feaa1SRuslan Ermilov.Bl -tag -width ".Fl c Ar file"
656214c002SMark Santcroos.It Fl b
666214c002SMark SantcroosForces
676214c002SMark Santcroos.Nm
686214c002SMark Santcroosto immediately move to the background.
6947c08596SBrooks Davis.It Fl c Ar file
7047c08596SBrooks DavisSpecify an alternate location,
7147c08596SBrooks Davis.Ar file ,
7247c08596SBrooks Davisfor the configuration file.
7347c08596SBrooks Davis.It Fl d
7447c08596SBrooks DavisForces
7547c08596SBrooks Davis.Nm
7647c08596SBrooks Davisto always run as a foreground process.
7747c08596SBrooks DavisBy default,
7847c08596SBrooks Davis.Nm
7947c08596SBrooks Davisruns in the foreground until it has configured the interface, and then
8047c08596SBrooks Daviswill revert to running in the background.
8147c08596SBrooks Davis.It Fl l Ar file
8247c08596SBrooks DavisSpecify an alternate location,
8347c08596SBrooks Davis.Ar file ,
8447c08596SBrooks Davisfor the leases file.
85*84fce4b6SIsaac Cilia Attard.It Fl n
86*84fce4b6SIsaac Cilia AttardMake
87*84fce4b6SIsaac Cilia Attard.Nm
88*84fce4b6SIsaac Cilia Attardnot wait for ARP resolution.
8923f39c90SDag-Erling Smørgrav.It Fl p Ar file
9023f39c90SDag-Erling SmørgravSpecify an alternate location for the PID file.
9123f39c90SDag-Erling SmørgravThe default is
92976e1003SMark Johnston.Pa /var/run/dhclient/dhclient. Ns Ar interface Ns Pa .pid .
9347c08596SBrooks Davis.It Fl q
9447c08596SBrooks DavisForces
9547c08596SBrooks Davis.Nm
9647c08596SBrooks Davisto be less verbose on startup.
9747c08596SBrooks Davis.It Fl u
9847c08596SBrooks DavisForces
9947c08596SBrooks Davis.Nm
10047c08596SBrooks Davisto reject leases with unknown options in them.
10147c08596SBrooks DavisThe default behaviour is to accept such lease offers.
10247c08596SBrooks Davis.El
10347c08596SBrooks Davis.Pp
10447c08596SBrooks DavisThe DHCP protocol allows a host to contact a central server which
10547c08596SBrooks Davismaintains a list of IP addresses which may be assigned on one or more
10647c08596SBrooks Davissubnets.
10747c08596SBrooks DavisA DHCP client may request an address from this pool, and
10847c08596SBrooks Davisthen use it on a temporary basis for communication on the network.
10947c08596SBrooks DavisThe DHCP protocol also provides a mechanism whereby a client can learn
11047c08596SBrooks Davisimportant details about the network to which it is attached, such as
11147c08596SBrooks Davisthe location of a default router, the location of a name server, and
11247c08596SBrooks Davisso on.
11347c08596SBrooks Davis.Pp
11447c08596SBrooks DavisOn startup,
11547c08596SBrooks Davis.Nm
11647c08596SBrooks Davisreads
11747c08596SBrooks Davis.Pa /etc/dhclient.conf
11847c08596SBrooks Davisfor configuration instructions.
11947c08596SBrooks DavisIt then gets a list of all the
12047c08596SBrooks Davisnetwork interfaces that are configured in the current system.
12147c08596SBrooks DavisIt then attempts to configure each interface with DHCP.
12247c08596SBrooks Davis.Pp
12347c08596SBrooks DavisIn order to keep track of leases across system reboots and server
12447c08596SBrooks Davisrestarts,
12547c08596SBrooks Davis.Nm
12647c08596SBrooks Daviskeeps a list of leases it has been assigned in the
1279a7feaa1SRuslan Ermilov.Pa /var/db/dhclient.leases. Ns Ar IFNAME
12847c08596SBrooks Davisfile.
1299a7feaa1SRuslan Ermilov.Ar IFNAME
13047c08596SBrooks Davisrepresents the network interface of the DHCP client
1319a7feaa1SRuslan Ermilov(e.g.,
1329a7feaa1SRuslan Ermilov.Li em0 ) ,
13347c08596SBrooks Davisone for each interface.
13447c08596SBrooks DavisOn startup, after reading the
13547c08596SBrooks Davis.Xr dhclient.conf 5
13647c08596SBrooks Davisfile,
13747c08596SBrooks Davis.Nm
13847c08596SBrooks Davisreads the leases file to refresh its memory about what leases it has been
13947c08596SBrooks Davisassigned.
14047c08596SBrooks Davis.Pp
14147c08596SBrooks DavisOld leases are kept around in case the DHCP server is unavailable when
14247c08596SBrooks Davis.Nm
14347c08596SBrooks Davisis first invoked (generally during the initial system boot
14447c08596SBrooks Davisprocess).
14547c08596SBrooks DavisIn that event, old leases from the
1469a7feaa1SRuslan Ermilov.Pa dhclient.leases. Ns Ar IFNAME
14747c08596SBrooks Davisfile which have not yet expired are tested, and if they are determined to
14847c08596SBrooks Davisbe valid, they are used until either they expire or the DHCP server
14947c08596SBrooks Davisbecomes available.
15047c08596SBrooks Davis.Pp
15147c08596SBrooks DavisA mobile host which may sometimes need to access a network on which no
15247c08596SBrooks DavisDHCP server exists may be preloaded with a lease for a fixed
15347c08596SBrooks Davisaddress on that network.
15447c08596SBrooks DavisWhen all attempts to contact a DHCP server have failed,
15547c08596SBrooks Davis.Nm
15647c08596SBrooks Daviswill try to validate the static lease, and if it
15747c08596SBrooks Davissucceeds, it will use that lease until it is restarted.
15847c08596SBrooks Davis.Pp
15947c08596SBrooks DavisA mobile host may also travel to some networks on which DHCP is not
16047c08596SBrooks Davisavailable but BOOTP is.
16147c08596SBrooks DavisIn that case, it may be advantageous to
16247c08596SBrooks Davisarrange with the network administrator for an entry on the BOOTP
16347c08596SBrooks Davisdatabase, so that the host can boot quickly on that network rather
16447c08596SBrooks Davisthan cycling through the list of old leases.
16547c08596SBrooks Davis.Sh NOTES
16647c08596SBrooks DavisYou must have the Berkeley Packet Filter (BPF) configured in your kernel.
1679a7feaa1SRuslan ErmilovThe
16847c08596SBrooks Davis.Nm
1699a7feaa1SRuslan Ermilovutility
17047c08596SBrooks Davisrequires at least one
17147c08596SBrooks Davis.Pa /dev/bpf*
1729a7feaa1SRuslan Ermilovdevice for each broadcast network interface that is attached to your system.
17347c08596SBrooks DavisSee
17447c08596SBrooks Davis.Xr bpf 4
17547c08596SBrooks Davisfor more information.
17647c08596SBrooks Davis.Sh FILES
1779a7feaa1SRuslan Ermilov.Bl -tag -width ".Pa /var/db/dhclient.leases. Ns Ar IFNAME" -compact
17847c08596SBrooks Davis.It Pa /etc/dhclient.conf
17947c08596SBrooks DavisDHCP client configuration file
1809a7feaa1SRuslan Ermilov.It Pa /var/db/dhclient.leases. Ns Ar IFNAME
18147c08596SBrooks Davisdatabase of acquired leases
18247c08596SBrooks Davis.El
18347c08596SBrooks Davis.Sh SEE ALSO
18447c08596SBrooks Davis.Xr dhclient.conf 5 ,
18547c08596SBrooks Davis.Xr dhclient.leases 5 ,
1866b7267a2SGabor Kovesdan.Xr dhclient-script 8
18747c08596SBrooks Davis.Sh AUTHORS
1889a7feaa1SRuslan Ermilov.An -nosplit
1899a7feaa1SRuslan ErmilovThe
19047c08596SBrooks Davis.Nm
1919a7feaa1SRuslan Ermilovutility
19247c08596SBrooks Daviswas written by
193bd0891ceSBaptiste Daroussin.An Ted Lemon Aq Mt mellon@fugue.com
19447c08596SBrooks Davisand
195bd0891ceSBaptiste Daroussin.An Elliot Poger Aq Mt elliot@poger.com .
19647c08596SBrooks Davis.Pp
19747c08596SBrooks DavisThe current implementation was reworked by
198bd0891ceSBaptiste Daroussin.An Henning Brauer Aq Mt henning@openbsd.org .
199976e1003SMark Johnston.Sh BUGS
200976e1003SMark JohnstonThe
201976e1003SMark Johnston.Nm
202976e1003SMark Johnstonutility uses
203976e1003SMark Johnston.Xr capsicum 4
204976e1003SMark Johnstonto sandbox the main process.
205976e1003SMark JohnstonIf the requisite kernel support is not available, the main process will
206976e1003SMark Johnstonattempt to run in a
207976e1003SMark Johnston.Xr chroot 2
208976e1003SMark Johnstonsandbox instead.
209976e1003SMark JohnstonThis will fail if the process is jailed or the
210976e1003SMark Johnston.Va kern.chroot_allow_open_directories
211976e1003SMark Johnstonsysctl is set to 0.
212