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