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