xref: /dflybsd-src/sbin/dhclient/dhclient.8 (revision d4155bf40214a508c4a41d2a26d0b12e900bd828)
16695d9cfSAntonio Huete Jimenez.\" $OpenBSD: src/sbin/dhclient/dhclient.8,v 1.8 2011/03/02 07:44:42 jmc Exp $
2846204b6SHasso Tepper.\"
3846204b6SHasso Tepper.\" Copyright (c) 1997 The Internet Software Consortium.
4846204b6SHasso Tepper.\" All rights reserved.
5846204b6SHasso Tepper.\"
6846204b6SHasso Tepper.\" Redistribution and use in source and binary forms, with or without
7846204b6SHasso Tepper.\" modification, are permitted provided that the following conditions
8846204b6SHasso Tepper.\" are met:
9846204b6SHasso Tepper.\"
10846204b6SHasso Tepper.\" 1. Redistributions of source code must retain the above copyright
11846204b6SHasso Tepper.\"    notice, this list of conditions and the following disclaimer.
12846204b6SHasso Tepper.\" 2. Redistributions in binary form must reproduce the above copyright
13846204b6SHasso Tepper.\"    notice, this list of conditions and the following disclaimer in the
14846204b6SHasso Tepper.\"    documentation and/or other materials provided with the distribution.
15846204b6SHasso Tepper.\" 3. Neither the name of The Internet Software Consortium nor the names
16846204b6SHasso Tepper.\"    of its contributors may be used to endorse or promote products derived
17846204b6SHasso Tepper.\"    from this software without specific prior written permission.
18846204b6SHasso Tepper.\"
19846204b6SHasso Tepper.\" THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND
20846204b6SHasso Tepper.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21846204b6SHasso Tepper.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22846204b6SHasso Tepper.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23846204b6SHasso Tepper.\" DISCLAIMED.  IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR
24846204b6SHasso Tepper.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25846204b6SHasso Tepper.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26846204b6SHasso Tepper.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
27846204b6SHasso Tepper.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28846204b6SHasso Tepper.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29846204b6SHasso Tepper.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
30846204b6SHasso Tepper.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31846204b6SHasso Tepper.\" SUCH DAMAGE.
32846204b6SHasso Tepper.\"
33846204b6SHasso Tepper.\" This software has been written for the Internet Software Consortium
34846204b6SHasso Tepper.\" by Ted Lemon <mellon@fugue.com> in cooperation with Vixie
35846204b6SHasso Tepper.\" Enterprises.  To learn more about the Internet Software Consortium,
36846204b6SHasso Tepper.\" see ``http://www.isc.org/isc''.  To learn more about Vixie
37846204b6SHasso Tepper.\" Enterprises, see ``http://www.vix.com''.
380f17c1abSFranco Fichtner.Dd July 23, 2013
39846204b6SHasso Tepper.Dt DHCLIENT 8
40846204b6SHasso Tepper.Os
41846204b6SHasso Tepper.Sh NAME
42846204b6SHasso Tepper.Nm dhclient
430f17c1abSFranco Fichtner.Nd Dynamic Host Configuration Protocol (DHCP) client
44846204b6SHasso Tepper.Sh SYNOPSIS
45846204b6SHasso Tepper.Nm
460f5f50b1SMatthew Dillon.Op Fl dquwx
47846204b6SHasso Tepper.Op Fl c Ar file
48846204b6SHasso Tepper.Op Fl l Ar file
49846204b6SHasso Tepper.Ar interface
50846204b6SHasso Tepper.Sh DESCRIPTION
510f17c1abSFranco FichtnerThe Dynamic Host Configuration Protocol (DHCP) allows hosts on a TCP/IP network
520f17c1abSFranco Fichtnerto configure one or more network interfaces based on information collected from
530f17c1abSFranco Fichtnera DHCP server.
540f17c1abSFranco FichtnerDHCP is often used, for example, by cable modem and DSL network
550f17c1abSFranco Fichtnerproviders to automate network configuration for their customers.
56846204b6SHasso Tepper.Pp
570f17c1abSFranco FichtnerInformation typically provided via DHCP includes
580f17c1abSFranco Fichtneraddress and subnet mask for the interface,
590f17c1abSFranco Fichtnerdefault route,
600f17c1abSFranco Fichtnerand domain name server.
610f17c1abSFranco Fichtner.Pp
620f17c1abSFranco FichtnerTo have
630f17c1abSFranco Fichtner.Dx
640f17c1abSFranco Fichtnerconfigure an interface using DHCP
650f17c1abSFranco Fichtner(or its predecessor, BOOTP)
660f17c1abSFranco Fichtnerthe
67846204b6SHasso Tepper.Nm
680f17c1abSFranco Fichtnerutility is used.
690f17c1abSFranco Fichtner.Nm
700f17c1abSFranco Fichtneris run on the command line with the name of the
710f17c1abSFranco Fichtner.Ar interface
720f17c1abSFranco Fichtnerto be configured.
739d4298daSMatthew DillonIf a
749d4298daSMatthew Dillon.Nm
759d4298daSMatthew Dillonis already running for the interface, the old process will be killed and
769d4298daSMatthew Dillonreplaced by the new invocation.
77846204b6SHasso Tepper.Pp
78846204b6SHasso TepperThe options are as follows:
79846204b6SHasso Tepper.Bl -tag -width "-p port"
80846204b6SHasso Tepper.It Fl c Ar file
810f17c1abSFranco FichtnerSpecify an alternate location to
820f17c1abSFranco Fichtner.Pa /etc/dhclient.conf
83846204b6SHasso Tepperfor the configuration file.
84846204b6SHasso Tepper.It Fl d
85846204b6SHasso TepperForces
86846204b6SHasso Tepper.Nm
87846204b6SHasso Tepperto always run as a foreground process.
88846204b6SHasso TepperBy default,
89846204b6SHasso Tepper.Nm
90846204b6SHasso Tepperruns in the foreground until it has configured the interface, and then
91846204b6SHasso Tepperwill revert to running in the background.
92846204b6SHasso Tepper.It Fl l Ar file
930f17c1abSFranco FichtnerSpecify an alternate location to
940f17c1abSFranco Fichtner.Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME
95846204b6SHasso Tepperfor the leases file.
96846204b6SHasso Tepper.It Fl q
97846204b6SHasso TepperForces
98846204b6SHasso Tepper.Nm
99846204b6SHasso Tepperto be less verbose on startup.
100846204b6SHasso Tepper.It Fl u
101846204b6SHasso TepperForces
102846204b6SHasso Tepper.Nm
103846204b6SHasso Tepperto reject leases with unknown options in them.
104846204b6SHasso TepperThe default behaviour is to accept such lease offers.
1050f5f50b1SMatthew Dillon.It Fl w
1060f5f50b1SMatthew Dillon.Nm
1070f5f50b1SMatthew Dillonstays around permanently and will attempt to reconnect even if
1080f5f50b1SMatthew Dillonthe interface does not exist, is down, or goes down.
1090f5f50b1SMatthew DillonThis is the default when interfaces are configured DHCP in
1100f5f50b1SMatthew Dillon.Pa /etc/dhclient.conf
1110f5f50b1SMatthew Dillon.It Fl x
1120f5f50b1SMatthew DillonKill any running
1130f5f50b1SMatthew Dillon.Nm
1140f5f50b1SMatthew Dillonon the specified interface.
115846204b6SHasso Tepper.El
116846204b6SHasso Tepper.Pp
117846204b6SHasso TepperThe DHCP protocol allows a host to contact a central server which
118846204b6SHasso Teppermaintains a list of IP addresses which may be assigned on one or more
119846204b6SHasso Teppersubnets.
120846204b6SHasso TepperA DHCP client may request an address from this pool, and
121846204b6SHasso Tepperthen use it on a temporary basis for communication on the network.
122846204b6SHasso TepperThe DHCP protocol also provides a mechanism whereby a client can learn
123846204b6SHasso Tepperimportant details about the network to which it is attached, such as
124846204b6SHasso Tepperthe location of a default router, the location of a name server, and
125846204b6SHasso Tepperso on.
126846204b6SHasso Tepper.Pp
127846204b6SHasso TepperOn startup,
128846204b6SHasso Tepper.Nm
129846204b6SHasso Tepperreads
130846204b6SHasso Tepper.Pa /etc/dhclient.conf
131846204b6SHasso Tepperfor configuration instructions.
1320f17c1abSFranco FichtnerIt then attempts to configure the network interface
1330f17c1abSFranco Fichtner.Ar interface
1340f17c1abSFranco Fichtnerwith DHCP.
135846204b6SHasso Tepper.Pp
136846204b6SHasso TepperIn order to keep track of leases across system reboots and server
137846204b6SHasso Tepperrestarts,
138846204b6SHasso Tepper.Nm
139846204b6SHasso Tepperkeeps a list of leases it has been assigned in the
1400f17c1abSFranco Fichtner.Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME
141846204b6SHasso Tepperfile.
1420f17c1abSFranco Fichtner.Ar IFNAME
143846204b6SHasso Tepperrepresents the network interface of the DHCP client
144846204b6SHasso Tepper.Pq e.g. em0 ,
145846204b6SHasso Tepperone for each interface.
146846204b6SHasso TepperOn startup, after reading the
147846204b6SHasso Tepper.Xr dhclient.conf 5
148846204b6SHasso Tepperfile,
149846204b6SHasso Tepper.Nm
150846204b6SHasso Tepperreads the leases file to refresh its memory about what leases it has been
151846204b6SHasso Tepperassigned.
152846204b6SHasso Tepper.Pp
153846204b6SHasso TepperOld leases are kept around in case the DHCP server is unavailable when
154846204b6SHasso Tepper.Nm
155846204b6SHasso Tepperis first invoked (generally during the initial system boot
156846204b6SHasso Tepperprocess).
157846204b6SHasso TepperIn that event, old leases from the
1580f17c1abSFranco Fichtner.Pa dhclient.leases. Ns Aq Ar IFNAME
159846204b6SHasso Tepperfile which have not yet expired are tested, and if they are determined to
160846204b6SHasso Tepperbe valid, they are used until either they expire or the DHCP server
161846204b6SHasso Tepperbecomes available.
162846204b6SHasso Tepper.Pp
163846204b6SHasso TepperA mobile host which may sometimes need to access a network on which no
164846204b6SHasso TepperDHCP server exists may be preloaded with a lease for a fixed
165846204b6SHasso Tepperaddress on that network.
166846204b6SHasso TepperWhen all attempts to contact a DHCP server have failed,
167846204b6SHasso Tepper.Nm
168846204b6SHasso Tepperwill try to validate the static lease, and if it
169846204b6SHasso Teppersucceeds, it will use that lease until it is restarted.
170846204b6SHasso Tepper.Pp
171846204b6SHasso TepperA mobile host may also travel to some networks on which DHCP is not
172846204b6SHasso Tepperavailable but BOOTP is.
173846204b6SHasso TepperIn that case, it may be advantageous to
174846204b6SHasso Tepperarrange with the network administrator for an entry on the BOOTP
175846204b6SHasso Tepperdatabase, so that the host can boot quickly on that network rather
176846204b6SHasso Tepperthan cycling through the list of old leases.
1776695d9cfSAntonio Huete Jimenez.Pp
178846204b6SHasso Tepper.Nm
179846204b6SHasso Tepperrequires at least one
180846204b6SHasso Tepper.Pa /dev/bpf*
1816695d9cfSAntonio Huete Jimenezfile for each broadcast network interface.
182846204b6SHasso TepperSee
183846204b6SHasso Tepper.Xr bpf 4
184846204b6SHasso Tepperfor more information.
185846204b6SHasso Tepper.Sh FILES
1860f17c1abSFranco Fichtner.Bl -tag -width "/var/db/dhclient.leases.<IFNAME>XXX" -compact
187846204b6SHasso Tepper.It Pa /etc/dhclient.conf
1889d4298daSMatthew DillonDHCP client configuration file.
1890f17c1abSFranco Fichtner.It Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME
1909d4298daSMatthew DillonDatabase of acquired leases.
1919d4298daSMatthew Dillon.It Pa /var/run/dhclient.<IFNAME>.pid
1929d4298daSMatthew DillonPidfile for running instance.
193*d4155bf4SSascha WildnerWhile active, the pidfile is
194*d4155bf4SSascha Wildner.Fn flock Ap d
195*d4155bf4SSascha Wildnerby
1969d4298daSMatthew Dillon.Nm
197*d4155bf4SSascha Wildnerwhich can be tested by a program using
198*d4155bf4SSascha Wildner.Fn flock
199*d4155bf4SSascha Wildneror by a script using the
2009d4298daSMatthew Dillon.Xr lockf 1
2019d4298daSMatthew Dillonutility, via a non-blocking lock attempt.
202846204b6SHasso Tepper.El
203846204b6SHasso Tepper.Sh SEE ALSO
204846204b6SHasso Tepper.Xr bpf 4 ,
205846204b6SHasso Tepper.Xr dhclient.conf 5 ,
206846204b6SHasso Tepper.Xr dhclient.leases 5 ,
207846204b6SHasso Tepper.Xr dhclient-script 8 ,
208846204b6SHasso Tepper.Xr dhcp 8 ,
209c8e8a2e5SSascha Wildner.Xr dhcpd 8 Pq Pa net/isc-dhcp42-server ,
210c8e8a2e5SSascha Wildner.Xr dhcrelay 8 Pq Pa net/isc-dhcp42-relay
2110f17c1abSFranco Fichtner.Sh STANDARDS
2120f17c1abSFranco Fichtner.Rs
2130f17c1abSFranco Fichtner.%A R. Droms
2140f17c1abSFranco Fichtner.%D October 1993
2150f17c1abSFranco Fichtner.%R RFC 1534
2160f17c1abSFranco Fichtner.%T Interoperation Between DHCP and BOOTP
2170f17c1abSFranco Fichtner.Re
2180f17c1abSFranco Fichtner.Pp
2190f17c1abSFranco Fichtner.Rs
2200f17c1abSFranco Fichtner.%A R. Droms
2210f17c1abSFranco Fichtner.%D March 1997
2220f17c1abSFranco Fichtner.%R RFC 2131
2230f17c1abSFranco Fichtner.%T Dynamic Host Configuration Protocol
2240f17c1abSFranco Fichtner.Re
2250f17c1abSFranco Fichtner.Pp
2260f17c1abSFranco Fichtner.Rs
2270f17c1abSFranco Fichtner.%A S. Alexander
2280f17c1abSFranco Fichtner.%A R. Droms
2290f17c1abSFranco Fichtner.%D March 1997
2300f17c1abSFranco Fichtner.%R RFC 2132
2310f17c1abSFranco Fichtner.%T DHCP Options and BOOTP Vendor Extensions
2320f17c1abSFranco Fichtner.Re
2330f17c1abSFranco Fichtner.Pp
2340f17c1abSFranco Fichtner.Rs
2350f17c1abSFranco Fichtner.%A T. Lemon
2360f17c1abSFranco Fichtner.%A S. Cheshire
2370f17c1abSFranco Fichtner.%D November 2002
2380f17c1abSFranco Fichtner.%R RFC 3396
2390f17c1abSFranco Fichtner.%T Encoding Long Options in the Dynamic Host Configuration Protocol (DHCPv4)
2400f17c1abSFranco Fichtner.Re
2410f17c1abSFranco Fichtner.Pp
2420f17c1abSFranco Fichtner.Rs
2430f17c1abSFranco Fichtner.%A T. Lemon
2440f17c1abSFranco Fichtner.%A S. Cheshire
2450f17c1abSFranco Fichtner.%A B. Volz
2460f17c1abSFranco Fichtner.%D December 2002
2470f17c1abSFranco Fichtner.%R RFC 3442
2480f17c1abSFranco Fichtner.%T The Classless Static Route Option for Dynamic Host Configuration Protocol (DHCP) version 4
2490f17c1abSFranco Fichtner.Re
2500f17c1abSFranco Fichtner.Sh HISTORY
2510f17c1abSFranco Fichtner.Nm
2520f17c1abSFranco Fichtnerwas imported into
2530f17c1abSFranco Fichtner.Dx 2.1 .
254846204b6SHasso Tepper.Sh AUTHORS
255846204b6SHasso Tepper.An -nosplit
256846204b6SHasso Tepper.Nm
257846204b6SHasso Tepperwas written by
2581cb631f7SFranco Fichtner.An Ted Lemon Aq Mt mellon@fugue.com
259846204b6SHasso Tepperand
2601cb631f7SFranco Fichtner.An Elliot Poger Aq Mt elliot@poger.com .
261846204b6SHasso Tepper.Pp
262846204b6SHasso TepperThe current implementation was reworked by
2630f17c1abSFranco Fichtner.An Henning Brauer Aq Mt henning@openbsd.org .
264