1.\" $OpenBSD: src/sbin/dhclient/dhclient.8,v 1.8 2011/03/02 07:44:42 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.Dd July 23, 2013 39.Dt DHCLIENT 8 40.Os 41.Sh NAME 42.Nm dhclient 43.Nd Dynamic Host Configuration Protocol (DHCP) client 44.Sh SYNOPSIS 45.Nm 46.Op Fl dqu 47.Op Fl c Ar file 48.Op Fl l Ar file 49.Ar interface 50.Sh DESCRIPTION 51The Dynamic Host Configuration Protocol (DHCP) allows hosts on a TCP/IP network 52to configure one or more network interfaces based on information collected from 53a DHCP server. 54DHCP is often used, for example, by cable modem and DSL network 55providers to automate network configuration for their customers. 56.Pp 57Information typically provided via DHCP includes 58address and subnet mask for the interface, 59default route, 60and domain name server. 61.Pp 62To have 63.Dx 64configure an interface using DHCP 65(or its predecessor, BOOTP) 66the 67.Nm 68utility is used. 69.Nm 70is run on the command line with the name of the 71.Ar interface 72to be configured. 73.Pp 74The options are as follows: 75.Bl -tag -width "-p port" 76.It Fl c Ar file 77Specify an alternate location to 78.Pa /etc/dhclient.conf 79for the configuration file. 80.It Fl d 81Forces 82.Nm 83to always run as a foreground process. 84By default, 85.Nm 86runs in the foreground until it has configured the interface, and then 87will revert to running in the background. 88.It Fl l Ar file 89Specify an alternate location to 90.Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME 91for the leases file. 92.It Fl q 93Forces 94.Nm 95to be less verbose on startup. 96.It Fl u 97Forces 98.Nm 99to reject leases with unknown options in them. 100The default behaviour is to accept such lease offers. 101.El 102.Pp 103The DHCP protocol allows a host to contact a central server which 104maintains a list of IP addresses which may be assigned on one or more 105subnets. 106A DHCP client may request an address from this pool, and 107then use it on a temporary basis for communication on the network. 108The DHCP protocol also provides a mechanism whereby a client can learn 109important details about the network to which it is attached, such as 110the location of a default router, the location of a name server, and 111so on. 112.Pp 113On startup, 114.Nm 115reads 116.Pa /etc/dhclient.conf 117for configuration instructions. 118It then attempts to configure the network interface 119.Ar interface 120with DHCP. 121.Pp 122In order to keep track of leases across system reboots and server 123restarts, 124.Nm 125keeps a list of leases it has been assigned in the 126.Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME 127file. 128.Ar IFNAME 129represents the network interface of the DHCP client 130.Pq e.g. em0 , 131one for each interface. 132On startup, after reading the 133.Xr dhclient.conf 5 134file, 135.Nm 136reads the leases file to refresh its memory about what leases it has been 137assigned. 138.Pp 139Old leases are kept around in case the DHCP server is unavailable when 140.Nm 141is first invoked (generally during the initial system boot 142process). 143In that event, old leases from the 144.Pa dhclient.leases. Ns Aq Ar IFNAME 145file which have not yet expired are tested, and if they are determined to 146be valid, they are used until either they expire or the DHCP server 147becomes available. 148.Pp 149A mobile host which may sometimes need to access a network on which no 150DHCP server exists may be preloaded with a lease for a fixed 151address on that network. 152When all attempts to contact a DHCP server have failed, 153.Nm 154will try to validate the static lease, and if it 155succeeds, it will use that lease until it is restarted. 156.Pp 157A mobile host may also travel to some networks on which DHCP is not 158available but BOOTP is. 159In that case, it may be advantageous to 160arrange with the network administrator for an entry on the BOOTP 161database, so that the host can boot quickly on that network rather 162than cycling through the list of old leases. 163.Pp 164.Nm 165requires at least one 166.Pa /dev/bpf* 167file for each broadcast network interface. 168See 169.Xr bpf 4 170for more information. 171.Sh FILES 172.Bl -tag -width "/var/db/dhclient.leases.<IFNAME>XXX" -compact 173.It Pa /etc/dhclient.conf 174DHCP client configuration file 175.It Pa /var/db/dhclient.leases. Ns Aq Ar IFNAME 176database of acquired leases 177.El 178.Sh SEE ALSO 179.Xr bpf 4 , 180.Xr dhclient.conf 5 , 181.Xr dhclient.leases 5 , 182.Xr dhclient-script 8 , 183.Xr dhcp 8 , 184.Xr dhcpd 8 Pq Pa net/isc-dhcp42-server , 185.Xr dhcrelay 8 Pq Pa net/isc-dhcp42-relay 186.Sh STANDARDS 187.Rs 188.%A R. Droms 189.%D October 1993 190.%R RFC 1534 191.%T Interoperation Between DHCP and BOOTP 192.Re 193.Pp 194.Rs 195.%A R. Droms 196.%D March 1997 197.%R RFC 2131 198.%T Dynamic Host Configuration Protocol 199.Re 200.Pp 201.Rs 202.%A S. Alexander 203.%A R. Droms 204.%D March 1997 205.%R RFC 2132 206.%T DHCP Options and BOOTP Vendor Extensions 207.Re 208.Pp 209.Rs 210.%A T. Lemon 211.%A S. Cheshire 212.%D November 2002 213.%R RFC 3396 214.%T Encoding Long Options in the Dynamic Host Configuration Protocol (DHCPv4) 215.Re 216.Pp 217.Rs 218.%A T. Lemon 219.%A S. Cheshire 220.%A B. Volz 221.%D December 2002 222.%R RFC 3442 223.%T The Classless Static Route Option for Dynamic Host Configuration Protocol (DHCP) version 4 224.Re 225.Sh HISTORY 226.Nm 227was imported into 228.Dx 2.1 . 229.Sh AUTHORS 230.An -nosplit 231.Nm 232was written by 233.An Ted Lemon Aq Mt mellon@fugue.com 234and 235.An Elliot Poger Aq Mt elliot@poger.com . 236.Pp 237The current implementation was reworked by 238.An Henning Brauer Aq Mt henning@openbsd.org . 239