diff options
-rw-r--r-- | usr.sbin/dhcp/common/dhcp-options.5 | 1076 | ||||
-rw-r--r-- | usr.sbin/dhcp/dhclient/dhclient-script.8 | 330 | ||||
-rw-r--r-- | usr.sbin/dhcp/dhclient/dhclient.conf.5 | 803 | ||||
-rw-r--r-- | usr.sbin/dhcp/server/dhcpd.8 | 608 | ||||
-rw-r--r-- | usr.sbin/dhcp/server/dhcpd.conf.5 | 1384 | ||||
-rw-r--r-- | usr.sbin/dhcp/server/dhcpd.leases.5 | 272 |
6 files changed, 2360 insertions, 2113 deletions
diff --git a/usr.sbin/dhcp/common/dhcp-options.5 b/usr.sbin/dhcp/common/dhcp-options.5 index e2205b8b154..5f85d915a07 100644 --- a/usr.sbin/dhcp/common/dhcp-options.5 +++ b/usr.sbin/dhcp/common/dhcp-options.5 @@ -1,4 +1,4 @@ -.\" dhcp-options.5 +.\" $OpenBSD: dhcp-options.5,v 1.9 2003/06/25 09:27:57 jmc Exp $ .\" .\" Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium. .\" All rights reserved. @@ -35,656 +35,558 @@ .\" Enterprises. To learn more about the Internet Software Consortium, .\" see ``http://www.isc.org/isc''. To learn more about Vixie .\" Enterprises, see ``http://www.vix.com''. -.TH dhcp-options 5 -.SH NAME -dhcp-options - Dynamic Host Configuration Protocol options -.SH DESCRIPTION +.\" +.Dd January 1, 1995 +.Dt DHCP-OPTIONS 5 +.Os +.Sh NAME +.Nm dhcp-options +.Nd Dynamic Host Configuration Protocol options +.Sh DESCRIPTION The Dynamic Host Configuration protocol allows the client to receive -.B options +.Ic options from the DHCP server describing the network configuration and various -services that are available on the network. When configuring -.B dhcpd(8) +services that are available on the network. +When configuring +.Xr dhcpd 8 or -.B dhclient(8) , -options must often be declared. The syntax for declaring options, -and the names and formats of the options that can be declared, are -documented here. -.SH REFERENCE: OPTION STATEMENTS -.PP -DHCP \fIoption\fR statements always start with the \fIoption\fR -keyword, followed by an option name, followed by option data. The -option names and data formats are described below. It is not -necessary to exhaustively specify all DHCP options - only those -options which are needed by clients must be specified. -.PP +.Xr dhclient 8 , +options must often be declared. +The syntax for declaring options, and the names and formats of the options +that can be declared, are documented here. +.Sh REFERENCE: OPTION STATEMENTS +DHCP +.Ic option +statements always start with the +.Ic option +keyword, followed by an option name, followed by option data. +The option names and data formats are described below. +It is not necessary to exhaustively specify all DHCP options \- +only those options which are needed by clients must be specified. +.Pp Option data comes in a variety of formats, as defined below: -.PP +.Pp +The +.Ar ip-address +data type can be entered either as an explicit IP address +(e.g., 239.254.197.10) or as a domain name (e.g., haagen.isc.org). +A domain name must resolve to a single IP address. +.Pp The -.B ip-address -data type can be entered either as an explicit IP -address (e.g., 239.254.197.10) or as a domain name (e.g., -haagen.isc.org). When entering a domain name, be sure that that -domain name resolves to a single IP address. -.PP +.Ar int32 +data type specifies a signed 32-bit integer. The -.B int32 -data type specifies a signed 32-bit integer. The -.B uint32 -data type specifies an unsigned 32-bit integer. The -.B int16 +.Ar uint32 +data type specifies an unsigned 32-bit integer. +The +.Ar int16 and -.B uint16 -data types specify signed and unsigned 16-bit integers. The -.B int8 +.Ar uint16 +data types specify signed and unsigned 16-bit integers. +The +.Ar int8 and -.B uint8 +.Ar uint8 data types specify signed and unsigned 8-bit integers. Unsigned 8-bit integers are also sometimes referred to as octets. -.PP +.Pp The -.B string -data type specifies an NVT ASCII string, which must be -enclosed in double quotes - for example, to specify a domain-name -option, the syntax would be -.nf -.sp 1 - option domain-name "isc.org"; -.fi -.PP +.Ar string +data type specifies an +.Tn NVT +.Pq Network Virtual Terminal +.Tn ASCII +string, which must be enclosed in double quotes \- for example, +to specify a domain-name option, the syntax would be +.Pp +.Dl option domain-name \&"isc.org\&"; +.Pp The -.B flag -data type specifies a boolean value. Booleans can be either true or -false (or on or off, if that makes more sense to you). -.PP +.Ar flag +data type specifies a boolean value. +Booleans can be either true or false +(or on or off, if that makes more sense to you). +.Pp The -.B data-string -data type specifies either an NVT ASCII string -enclosed in double quotes, or a series of octets specified in -hexadecimal, separated by colons. For example: -.nf -.sp 1 - option dhcp-client-identifier "CLIENT-FOO"; +.Ar data-string +data type specifies either an +.Tn NVT ASCII +string enclosed in double quotes, or a series of octets specified in +hexadecimal, separated by colons. +For example: +.Pp +.Dl option dhcp-client-identifier \&"CLIENT-FOO\&"; or - option dhcp-client-identifier 43:4c:49:45:54:2d:46:4f:4f; -.fi -.PP +.Dl option dhcp-client-identifier 43:4c:49:45:54:2d:46:4f:4f; +.Pp The documentation for the various options mentioned below is taken -from the latest IETF draft document on DHCP options. Options which -are not listed by name may be defined by the name option-\fInnn\fR, -where \fInnn\fR is the decimal number of the option code. These -options may be followed either by a string, enclosed in quotes, or by +from the IETF draft document on DHCP options, RFC 2132. +Options which are not listed by name may be defined by the name +.Pf option\- Ns Ar nnn , +where +.Ar nnn +is the decimal number of the option code. +These options may be followed either by a string, enclosed in quotes, or by a series of octets, expressed as two-digit hexadecimal numbers separated -by colons. For example: -.PP -.nf - option option-133 "my-option-133-text"; - option option-129 1:54:c9:2b:47; -.fi -.PP -Because dhcpd does not know the format of these undefined option codes, +by colons. +For example: +.Pp +.Bd -literal -offset indent +option option-133 "my-option-133-text"; +option option-129 1:54:c9:2b:47; +.Ed +.Pp +Because +.Xr dhcpd 8 +does not know the format of these undefined option codes, no checking is done to ensure the correctness of the entered data. -.PP +.Pp The standard options are: -.PP -.B option subnet-mask \fIip-address\fR\fB;\fR -.RS 0.25i -.PP -The subnet mask option specifies the client's subnet mask as per RFC -950. If no subnet mask option is provided anywhere in scope, as a -last resort dhcpd will use the subnet mask from the subnet declaration -for the network on which an address is being assigned. However, -.I any +.Bl -tag -width Ds +.Ss RFC 1497 Vendor Extensions +.It Ic option subnet-mask Ar ip-address ; +The +.Ic subnet-mask +option specifies the client's subnet mask as per RFC 950. +If no subnet-mask option is provided anywhere in scope, as a last resort +.Xr dhcpd 8 +will use the subnet mask from the subnet declaration for the network on +which an address is being assigned. +However, +.Em any subnet-mask option declaration that is in scope for the address being -assigned will override the subnet mask specified in the subnet -declaration. -.RE -.PP -.B option time-offset \fIint32\fR\fB;\fR -.RS 0.25i -.PP -The time-offset option specifies the offset of the client's subnet in -seconds from Coordinated Universal Time (UTC). -.RE -.PP -.B option routers \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP -The routers option specifies a list of IP addresses for routers on the -client's subnet. Routers should be listed in order of preference. -.RE -.PP -.B option time-servers \fIip-address\fR [, \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP -The time-server option specifies a list of RFC 868 time servers -available to the client. Servers should be listed in order of -preference. -.RE -.PP -.B option \fBien116-name-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]; -.RS 0.25i -.PP -The ien116-name-servers option specifies a list of IEN 116 name servers -available to the client. Servers should be listed in order of -preference. -.RE -.PP -.B option \fBdomain-name-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP -The domain-name-servers option specifies a list of Domain Name System -(STD 13, RFC 1035) name servers available to the client. Servers -should be listed in order of preference. -.RE -.PP -.B option \fBlog-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP -The log-server option specifies a list of MIT-LCS UDP log servers -available to the client. Servers should be listed in order of -preference. -.RE -.PP -.B option \fBcookie-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP -The cookie server option specifies a list of RFC 865 cookie -servers available to the client. Servers should be listed in order -of preference. -.RE -.PP -.B option \fBlpr-servers\fR \fIip-address \fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP -The LPR server option specifies a list of RFC 1179 line printer -servers available to the client. Servers should be listed in order -of preference. -.RE -.PP -.B option \fBimpress-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP -The impress-server option specifies a list of Imagen Impress servers -available to the client. Servers should be listed in order of -preference. -.RE -.PP -.B option \fBresource-location-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP -This option specifies a list of RFC 887 Resource Location -servers available to the client. Servers should be listed in order -of preference. -.RE -.PP -.B option \fBhost-name\fR \fIstring\fR\fB;\fR -.RS 0.25i -.PP -This option specifies the name of the client. The name may or may -not be qualified with the local domain name (it is preferable to use -the domain-name option to specify the domain name). See RFC 1035 for -character set restrictions. -.RE -.PP -.B option \fBboot-size\fR \fIuint16\fR\fB;\fR -.RS 0.25i -.PP +assigned will override the subnet mask specified in the subnet declaration. +.It Ic option time-offset Ar int32 ; +The +.Ic time-offset +option specifies the offset of the client's subnet in seconds from +Coordinated Universal Time (UTC). +.It Xo +.Ic option routers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic routers +option specifies a list of IP addresses for routers on the client's subnet. +Routers should be listed in order of preference. +.It Xo +.Ic option time-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic time-server +option specifies a list of RFC 868 time servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option ien116-name-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic ien116-name-servers +option specifies a list of IEN 116 name servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option domain-name-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic domain-name-servers +option specifies a list of Domain Name System (STD 13, RFC 1035) name servers +available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option log-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic log-servers +option specifies a list of MIT-LCS UDP log servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option cookie-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic cookie-servers +option specifies a list of RFC 865 cookie servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option lpr-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic lpr-servers +option specifies a list of RFC 1179 line printer servers available to the +client. +Servers should be listed in order of preference. +.It Xo +.Ic option impress-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic impress-servers +option specifies a list of Imagen Impress servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option resource-location-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +This option specifies a list of RFC 887 Resource Location servers available +to the client. +Servers should be listed in order of preference. +.It Ic option host-name Ar string ; +This option specifies the name of the client. +The name may or may not be qualified with the local domain name +(it is preferable to use the +.Ic domain-name +option to specify the domain name). +See RFC 1035 for character set restrictions. +.It Ic option boot-size Ar uint16 ; This option specifies the length in 512-octet blocks of the default boot image for the client. -.RE -.PP -.B option \fBmerit-dump\fR \fIstring\fR\fB;\fR -.RS 0.25i -.PP -This option specifies the path-name of a file to which the client's -core image should be dumped in the event the client crashes. The -path is formatted as a character string consisting of characters from -the NVT ASCII character set. -.RE -.PP -.B option \fBdomain-name\fR \fIstring\fR\fB;\fR -.RS 0.25i -.PP -This option specifies the domain name that client should use when +.It Ic option merit-dump Ar string ; +This option specifies the pathname of a file to which the client's +core image should be dumped in the event the client crashes. +The path is formatted as a character string consisting of characters from +the +.Tn NVT ASCII +character set. +.It Ic option domain-name Ar string ; +This option specifies the domain name that the client should use when resolving hostnames via the Domain Name System. -.RE -.PP -.B option \fBswap-server\fR \fIip-address\fR\fB;\fR -.RS 0.25i -.PP +.It Ic option swap-server Ar ip-address ; This specifies the IP address of the client's swap server. -.RE -.PP -.B option \fBroot-path\fR \fIstring\fB;\fR\fR -.RS 0.25i -.PP -This option specifies the path-name that contains the client's root -disk. The path is formatted as a character string consisting of -characters from the NVT ASCII character set. -.RE -.PP -.B option \fBip-forwarding\fR \fIflag\fR\fB;\fR -.RS 0.25i -.PP -This option specifies whether the client should configure its IP -layer for packet forwarding. A value of 0 means disable IP -forwarding, and a value of 1 means enable IP forwarding. -.RE -.PP -.B option \fBnon-local-source-routing\fR \fIflag\fR\fB;\fR -.RS 0.25i -.PP +.It Ic option root-path Ar string ; +This option specifies the pathname that contains the client's root disk. +The path is formatted as a character string consisting of characters from +the +.Tn NVT ASCII +character set. +.El +.Ss IP Layer Parameters per Host +.Bl -tag -width Ds +.It Ic option ip-forwarding Ar flag ; +This option specifies whether the client should configure its IP layer +for packet forwarding. +A value of 0 means disable IP forwarding, and a value of 1 means enable +IP forwarding. +.It Ic option non-local-source-routing Ar flag ; This option specifies whether the client should configure its IP layer to allow forwarding of datagrams with non-local source routes -(see Section 3.3.5 of [4] for a discussion of this topic). A value -of 0 means disallow forwarding of such datagrams, and a value of 1 +(see Section 3.3.5 of [4] for a discussion of this topic). +A value of 0 means disallow forwarding of such datagrams, and a value of 1 means allow forwarding. -.RE -.PP -.B option \fBpolicy-filter\fR \fIip-address ip-address\fR [\fB,\fR \fIip-address ip-address\fR... -]\fB;\fR -.RS 0.25i -.PP +.It Xo +.Ic option policy-filter Ar ip-address ip-address +.Oo , Ar ip-address ip-address ... Oc ; +.Xc This option specifies policy filters for non-local source routing. The filters consist of a list of IP addresses and masks which specify destination/mask pairs with which to filter incoming source routes. -.PP -Any source routed datagram whose next-hop address does not match one +.Pp +Any source-routed datagram whose next-hop address does not match one of the filters should be discarded by the client. -.PP -See STD 3 (RFC1122) for further information. -.RE -.PP -.B option \fBmax-dgram-reassembly\fR \fIuint16\fR\fB;\fR -.RS 0.25i -.PP -This option specifies the maximum size datagram that the client -should be prepared to reassemble. The minimum legal value is -576. -.RE -.PP -.B option \fBdefault-ip-ttl\fR \fIuint8;\fR -.RS 0.25i -.PP +.Pp +See STD 3 (RFC 1122) for further information. +.It Ic option max-dgram-reassembly Ar uint16 ; +This option specifies the maximum size datagram that the client should be +prepared to reassemble. +The minimum legal value is 576. +.It Ic option default-ip-ttl Ar uint8 ; This option specifies the default time-to-live that the client should use on outgoing datagrams. -.RE -.PP -.B option \fBpath-mtu-aging-timeout\fR \fIuint32\fR\fB;\fR -.RS 0.25i -.PP +.It Ic option path-mtu-aging-timeout Ar uint32 ; This option specifies the timeout (in seconds) to use when aging Path MTU values discovered by the mechanism defined in RFC 1191. -.RE -.PP -.B option \fBpath-mtu-plateau-table\fR \fIuint16\fR [\fB,\fR \fIuint16\fR... -]\fB;\fR -.RS 0.25i -.PP +.It Xo +.Ic option path-mtu-plateau-table Ar uint16 +.Oo , Ar uint16 ... Oc ; +.Xc This option specifies a table of MTU sizes to use when performing -Path MTU Discovery as defined in RFC 1191. The table is formatted as -a list of 16-bit unsigned integers, ordered from smallest to largest. +Path MTU Discovery as defined in RFC 1191. +The table is formatted as a list of 16-bit unsigned integers, +ordered from smallest to largest. The minimum MTU value cannot be smaller than 68. -.RE -.PP -.B option \fBinterface-mtu\fR \fIuint16\fR\fB;\fR -.RS 0.25i -.PP -This option specifies the MTU to use on this interface. The minimum -legal value for the MTU is 68. -.RE -.PP -.B option \fBall-subnets-local\fR \fIflag\fR\fB;\fR -.RS 0.25i -.PP -This option specifies whether or not the client may assume that all -subnets of the IP network to which the client is connected use the -same MTU as the subnet of that network to which the client is -directly connected. A value of 1 indicates that all subnets share -the same MTU. A value of 0 means that the client should assume that -some subnets of the directly connected network may have smaller MTUs. -.RE -.PP -.B option \fBbroadcast-address\fR \fIip-address\fR\fB;\fR -.RS 0.25i -.PP -This option specifies the broadcast address in use on the client's -subnet. Legal values for broadcast addresses are specified in -section 3.2.1.3 of STD 3 (RFC1122). -.RE -.PP -.B option \fBperform-mask-discovery\fR \fIflag\fR\fB;\fR -.RS 0.25i -.PP -This option specifies whether or not the client should perform subnet -mask discovery using ICMP. A value of 0 indicates that the client -should not perform mask discovery. A value of 1 means that the -client should perform mask discovery. -.RE -.PP -.B option \fBmask-supplier\fR \fIflag\fR\fB;\fR -.RS 0.25i -.PP -This option specifies whether or not the client should respond to -subnet mask requests using ICMP. A value of 0 indicates that the -client should not respond. A value of 1 means that the client should -respond. -.RE -.PP -.B option \fBrouter-discovery\fR \fIflag\fR\fB;\fR -.RS 0.25i -.PP -This option specifies whether or not the client should solicit -routers using the Router Discovery mechanism defined in RFC 1256. -A value of 0 indicates that the client should not perform -router discovery. A value of 1 means that the client should perform -router discovery. -.RE -.PP -.B option \fBrouter-solicitation-address\fR \fIip-address\fR\fB;\fR -.RS 0.25i -.PP +.El +.Ss IP Layer Parameters per Interface +.Bl -tag -width Ds +.It Ic option interface-mtu Ar uint16 ; +This option specifies the MTU to use on this interface. +The minimum legal value for the MTU is 68. +.It Ic option all-subnets-local Ar flag ; +This option specifies whether or not the client may assume that all subnets +of the IP network to which the client is connected use the same MTU as the +subnet of that network to which the client is directly connected. +A value of 1 indicates that all subnets share the same MTU. +A value of 0 means that the client should assume that some subnets of the +directly connected network may have smaller MTUs. +.It Ic option broadcast-address Ar ip-address ; +This option specifies the broadcast address in use on the client's subnet. +Legal values for broadcast addresses are specified in section 3.2.1.3 of +STD 3 (RFC 1122). +.It Ic option perform-mask-discovery Ar flag ; +This option specifies whether or not the client should perform subnet mask +discovery using ICMP. +A value of 0 indicates that the client should not perform mask discovery. +A value of 1 means that the client should perform mask discovery. +.It Ic option mask-supplier Ar flag ; +This option specifies whether or not the client should respond to subnet mask +requests using ICMP. +A value of 0 indicates that the client should not respond. +A value of 1 means that the client should respond. +.It Ic option router-discovery Ar flag ; +This option specifies whether or not the client should solicit routers using +the Router Discovery mechanism defined in RFC 1256. +A value of 0 indicates that the client should not perform router discovery. +A value of 1 means that the client should perform router discovery. +.It Ic option router-solicitation-address Ar ip-address ; This option specifies the address to which the client should transmit router solicitation requests. -.RE -.PP -.B option \fBstatic-routes\fR \fIip-address ip-address\fR [\fB,\fR \fIip-address ip-address\fR... -]\fB;\fR -.RS 0.25i -.PP +.It Xo +.Ic option static-routes Ar ip-address ip-address +.Oo , Ar ip-address ip-address ... Oc ; +.Xc This option specifies a list of static routes that the client should -install in its routing cache. If multiple routes to the same -destination are specified, they are listed in descending order of -priority. -.PP -The routes consist of a list of IP address pairs. The first address -is the destination address, and the second address is the router for -the destination. -.PP -The default route (0.0.0.0) is an illegal destination for a static -route. To specify the default route, use the -.B routers +install in its routing cache. +If multiple routes to the same destination are specified, they are listed +in descending order of priority. +.Pp +The routes consist of a list of IP address pairs. +The first address is the destination address, +and the second address is the router for the destination. +.Pp +The default route (0.0.0.0) is an illegal destination for a static route. +To specify the default route, use the +.Ic routers option. -.RE -.PP -.B option \fBtrailer-encapsulation\fR \fIflag\fR\fB;\fR -.RS 0.25i -.PP +.El +.Ss Link Layer Parameters per Interface +.Bl -tag -width Ds +.It Ic option trailer-encapsulation Ar flag ; This option specifies whether or not the client should negotiate the -use of trailers (RFC 893 [14]) when using the ARP protocol. A value -of 0 indicates that the client should not attempt to use trailers. A -value of 1 means that the client should attempt to use trailers. -.RE -.PP -.B option \fBarp-cache-timeout\fR \fIuint32\fR\fB;\fR -.RS 0.25i -.PP +use of trailers (RFC 893 [14]) when using the ARP protocol. +A value of 0 indicates that the client should not attempt to use trailers. +A value of 1 means that the client should attempt to use trailers. +.It Ic option arp-cache-timeout Ar uint32 ; This option specifies the timeout in seconds for ARP cache entries. -.RE -.PP -.B option \fBieee802-3-encapsulation\fR \fIflag\fR\fB;\fR -.RS 0.25i -.PP +.It Ic option ieee802-3-encapsulation Ar flag ; This option specifies whether or not the client should use Ethernet Version 2 (RFC 894) or IEEE 802.3 (RFC 1042) encapsulation if the -interface is an Ethernet. A value of 0 indicates that the client -should use RFC 894 encapsulation. A value of 1 means that the client -should use RFC 1042 encapsulation. -.RE -.PP -.B option \fBdefault-tcp-ttl\fR \fIuint8\fR\fB;\fR -.RS 0.25i -.PP +interface is an Ethernet. +A value of 0 indicates that the client should use RFC 894 encapsulation. +A value of 1 means that the client should use RFC 1042 encapsulation. +.El +.Ss TCP Parameters +.Bl -tag -width Ds +.It Ic option default-tcp-ttl Ar uint8 ; This option specifies the default TTL that the client should use when -sending TCP segments. The minimum value is 1. -.RE -.PP -.B option \fBtcp-keepalive-interval\fR \fIuint32\fR\fB;\fR -.RS 0.25i -.PP +sending TCP segments. +The minimum value is 1. +.It Ic option tcp-keepalive-interval Ar uint32 ; This option specifies the interval (in seconds) that the client TCP should wait before sending a keepalive message on a TCP connection. -The time is specified as a 32-bit unsigned integer. A value of zero -indicates that the client should not generate keepalive messages on -connections unless specifically requested by an application. -.RE -.PP -.B option \fBtcp-keepalive-garbage\fR \fIflag\fR\fB;\fR -.RS 0.25i -.PP -This option specifies whether or not the client should send TCP -keepalive messages with an octet of garbage for compatibility with -older implementations. A value of 0 indicates that a garbage octet -should not be sent. A value of 1 indicates that a garbage octet -should be sent. -.RE -.PP -.B option \fBnis-domain\fR \fIstring\fR\fB;\fR -.RS 0.25i -.PP -This option specifies the name of the client's NIS (Sun Network -Information Services) domain. The domain is formatted as a character -string consisting of characters from the NVT ASCII character set. -.RE -.PP -.B option \fBnis-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP +The time is specified as a 32-bit unsigned integer. +A value of zero indicates that the client should not generate keepalive +messages on connections unless specifically requested by an application. +.It Ic option tcp-keepalive-garbage Ar flag ; +This option specifies whether or not the client should send TCP keepalive +messages with an octet of garbage for compatibility with older implementations. +A value of 0 indicates that a garbage octet should not be sent. +A value of 1 indicates that a garbage octet should be sent. +.El +.Ss Application and Service Parameters +.Bl -tag -width Ds +.It Ic option nis-domain Ar string ; +This option specifies the name of the client's NIS (Sun Network Information +Services) domain. +The domain is formatted as a character string consisting of characters +from the +.Tn NVT ASCII +character set. +.It Xo +.Ic option nis-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc This option specifies a list of IP addresses indicating NIS servers -available to the client. Servers should be listed in order of -preference. -.RE -.PP -.B option \fBntp-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP +available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option ntp-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc This option specifies a list of IP addresses indicating NTP (RFC 1035) -servers available to the client. Servers should be listed in order -of preference. -.RE -.PP -.B option \fBnetbios-name-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP -The NetBIOS name server (NBNS) option specifies a list of RFC -1001/1002 NBNS name servers listed in order of preference. NetBIOS -Name Service is currently more commonly referred to as WINS. WINS -servers can be specified using the netbios-name-servers option. -.RE -.PP -.B option \fBnetbios-dd-server\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP +servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option netbios-name-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The NetBIOS name server (NBNS) option specifies a list of RFC 1001/1002 +NBNS name servers listed in order of preference. +NetBIOS Name Service is currently more commonly referred to as WINS. +WINS servers can be specified using the +.Ic netbios-name-servers +option. +.It Xo +.Ic option netbios-dd-server Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc The NetBIOS datagram distribution server (NBDD) option specifies a list of RFC 1001/1002 NBDD servers listed in order of preference. -.RE -.PP -.B option \fBnetbios-node-type\fR \fIuint8\fR\fB;\fR -.RS 0.25i -.PP +.It Ic option netbios-node-type Ar uint8 ; The NetBIOS node type option allows NetBIOS over TCP/IP clients which -are configurable to be configured as described in RFC 1001/1002. The -value is specified as a single octet which identifies the client type. -.PP +are configurable to be configured as described in RFC 1001/1002. +The value is specified as a single octet which identifies the client type. +.Pp Possible node types are: -.PP -.TP 5 -.I 1 +.Pp +.Bl -tag -width Ds +.It 1 B-node: Broadcast - no WINS -.TP -.I 2 +.It 2 P-node: Peer - WINS only -.TP -.I 4 +.It 4 M-node: Mixed - broadcast, then WINS -.TP -.I 8 +.It 8 H-node: Hybrid - WINS, then broadcast -.RE -.PP -.B option -.B netbios-scope -.I string\fB;\fR -.RS 0.25i -.PP +.El +.It Ic option netbios-scope Ar string ; The NetBIOS scope option specifies the NetBIOS over TCP/IP scope -parameter for the client as specified in RFC 1001/1002. See RFC1001, -RFC1002, and RFC1035 for character-set restrictions. -.RE -.PP -.B option \fBfont-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP +parameter for the client as specified in RFC 1001/1002. +See RFC 1001, RFC 1002, and RFC 1035 for character-set restrictions. +.It Xo +.Ic option font-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc This option specifies a list of X Window System Font servers available -to the client. Servers should be listed in order of preference. -.RE -.PP -.B option \fBx-display-manager\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP +to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option x-display-manager Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc This option specifies a list of systems that are running the X Window -System Display Manager and are available to the client. Addresses -should be listed in order of preference. -.RE -.PP -.B option \fBdhcp-client-identifier\fR \fIdata-string\fR\fB;\fR -.RS 0.25i -.PP +System Display Manager and are available to the client. +Addresses should be listed in order of preference. +.It Ic option dhcp-client-identifier Ar data-string ; This option can be used to specify a DHCP client identifier in a -host declaration, so that dhcpd can find the host record by matching -against the client identifier. -.RE -.B option \fBnisplus-domain\fR \fIstring\fR\fB;\fR -.RS 0.25i -.PP -This option specifies the name of the client's NIS+ domain. The -domain is formatted as a character string consisting of characters -from the NVT ASCII character set. -.RE -.B option \fBnisplus-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR... -]\fB;\fR -.RS 0.25i -.PP +host declaration, so that +.Xr dhcpd 8 +can find the host record by matching against the client identifier. +.It Ic option nisplus-domain Ar string ; +This option specifies the name of the client's NIS+ domain. +The domain is formatted as a character string consisting of characters +from the +.Tn NVT ASCII +character set. +.It Xo +.Ic option nisplus-servers Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc This option specifies a list of IP addresses indicating NIS+ servers -available to the client. Servers should be listed in order of -preference. -.RE -.PP -.B option \fBtftp-server-name\fR \fIstring\fR\fB;\fR -.RS 0.25i -.PP +available to the client. +Servers should be listed in order of preference. +.It Ic option tftp-server-name Ar string ; This option is used to identify a TFTP server and, if supported by the -client, should have the same effect as the \fBserver-name\fR -declaration. BOOTP clients are unlikely to support this option. +client, should have the same effect as the +.Ic server-name +declaration. +BOOTP clients are unlikely to support this option. Some DHCP clients will support it, and others actually require it. -.RE -.PP -.B option \fBbootfile-name\fR \fIstring\fR\fB;\fR -.RS 0.25i -.PP -This option is used to identify a bootstrap file. If supported by the -client, it should have the same effect as the \fBfilename\fR -declaration. BOOTP clients are unlikely to support this option. Some -DHCP clients will support it, and others actually require it. -.RE -.PP -.B option \fBmobile-ip-home-agent\fR \fIip-address\fR [\fB,\fR -\fIip-address\fR... ]\fB;\fR -.RS 0.25i -.PP +.It Ic option bootfile-name Ar string ; +This option is used to identify a bootstrap file. +If supported by the client, it should have the same effect as the +.Ic filename +declaration. +BOOTP clients are unlikely to support this option. +Some DHCP clients will support it, and others actually require it. +.It Xo +.Ic option mobile-ip-home-agent Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc This option specifies a list of IP addresses indicating mobile IP -home agents available to the client. Agents should be listed in -order of preference, although normally there will be only one such -agent. -.RE -.PP -.B option \fBsmtp-server\fR \fIip-address\fR [\fB,\fR -\fIip-address\fR... ]\fB;\fR -.RS 0.25i -.PP -The SMTP server option specifies a list of SMTP servers available to -the client. Servers should be listed in order of preference. -.RE -.PP -.B option \fBpop-server\fR \fIip-address\fR [\fB,\fR -\fIip-address\fR... ]\fB;\fR -.RS 0.25i -.PP -The POP3 server option specifies a list of POP3 servers available -to the client. Servers should be listed in order of preference. -.RE -.PP -.B option \fBnntp-server\fR \fIip-address\fR [\fB,\fR -\fIip-address\fR... ]\fB;\fR -.RS 0.25i -.PP -The NNTP server option specifies a list of NNTP servers available -to the client. Servers should be listed in order of preference. -.RE -.PP -.B option \fBwww-server\fR \fIip-address\fR [\fB,\fR -\fIip-address\fR... ]\fB;\fR -.RS 0.25i -.PP -The WWW server option specifies a list of WWW servers available -to the client. Servers should be listed in order of preference. -.RE -.PP -.B option \fBfinger-server\fR \fIip-address\fR [\fB,\fR -\fIip-address\fR... ]\fB;\fR -.RS 0.25i -.PP -The Finger server option specifies a list of Finger servers available -to the client. Servers should be listed in order of preference. -.RE -.PP -.B option \fBirc-server\fR \fIip-address\fR [\fB,\fR -\fIip-address\fR... ]\fB;\fR -.RS 0.25i -.PP -The IRC server option specifies a list of IRC servers available -to the client. Servers should be listed in order of preference. -.RE -.PP -.B option \fBstreettalk-server\fR \fIip-address\fR [\fB,\fR -\fIip-address\fR... ]\fB;\fR -.RS 0.25i -.PP -The StreetTalk server option specifies a list of StreetTalk servers -available to the client. Servers should be listed in order of -preference. -.RE -.PP -.B option \fBstreetalk-directory-assistance-server\fR \fIip-address\fR [\fB,\fR -\fIip-address\fR... ]\fB;\fR -.RS 0.25i -.PP +home agents available to the client. +Agents should be listed in order of preference, although normally there +will be only one such agent. +.It Xo +.Ic option smtp-server Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic smtp-server +option specifies a list of SMTP servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option pop-server Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic pop-server +option specifies a list of POP3 servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option nntp-server Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic nntp-server +option specifies a list of NNTP servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option www-server Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic www-server +option specifies a list of WWW servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option finger-server Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic finger-server +option specifies a list of +.Xr finger 1 +servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option irc-server Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic irc-server +option specifies a list of IRC servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option streettalk-server Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc +The +.Ic streettalk-server +option specifies a list of StreetTalk servers available to the client. +Servers should be listed in order of preference. +.It Xo +.Ic option streettalk-directory-assistance-server Ar ip-address +.Oo , Ar ip-address ... Oc ; +.Xc The StreetTalk Directory Assistance (STDA) server option specifies a -list of STDA servers available to the client. Servers should be -listed in order of preference. -.RE -.SH SEE ALSO -dhcpd.conf(5), dhcpd.leases(5), dhclient.conf(5), dhcpd(8), -dhclient(8), RFC2132, RFC2131. -.SH AUTHOR -.B dhcpd(8) -was written by Ted Lemon <mellon@vix.com> -under a contract with Vixie Labs. Funding -for this project was provided by the Internet Software Corporation. +list of STDA servers available to the client. +Servers should be listed in order of preference. +.El +.Sh SEE ALSO +.Xr dhclient.conf 5 , +.Xr dhcpd.conf 5 , +.Xr dhcpd.leases 5 , +.Xr dhclient 8 , +.Xr dhcpd 8 +.Pp +RFC 2131, RFC 2132. +.Sh AUTHORS +.Xr dhcpd 8 +was written by +.An Ted Lemon Aq mellon@vix.com +under a contract with Vixie Labs. +Funding for this project was provided by the Internet Software Corporation. Information about the Internet Software Consortium can be found at -.B http://www.isc.org/isc. +.Pa http://www.isc.org/isc . diff --git a/usr.sbin/dhcp/dhclient/dhclient-script.8 b/usr.sbin/dhcp/dhclient/dhclient-script.8 index 653e973f1eb..a4e7675067a 100644 --- a/usr.sbin/dhcp/dhclient/dhclient-script.8 +++ b/usr.sbin/dhcp/dhclient/dhclient-script.8 @@ -1,4 +1,4 @@ -.\" dhclient-script.8 +.\" $OpenBSD: dhclient-script.8,v 1.9 2003/06/25 09:27:57 jmc Exp $ .\" .\" Copyright (c) 1997 The Internet Software Consortium. .\" All rights reserved. @@ -35,154 +35,216 @@ .\" Enterprises. To learn more about the Internet Software Consortium, .\" see ``http://www.isc.org/isc''. To learn more about Vixie .\" Enterprises, see ``http://www.vix.com''. -.TH dhclient-script 8 -.SH NAME -dhclient-script - DHCP client network configuration script -.SH DESCRIPTION +.\" +.Dd January 1, 1997 +.Dt DHCLIENT-SCRIPT 8 +.Os +.Sh NAME +.Nm dhclient-script +.Nd DHCP client network configuration script +.Sh DESCRIPTION The DHCP client network configuration script is invoked from time to -time by \fBdhclient(8)\fR. This script is used by the dhcp client to -set each interface's initial configuration prior to requesting an -address, to test the address once it has been offered, and to set the -interface's final configuration once a lease has been acquired. If no -lease is acquired, the script is used to test predefined leases, if +time by +.Xr dhclient 8 . +This script is used by the DHCP client to set each interface's initial +configuration prior to requesting an address, to test the address once it +has been offered, and to set the interface's final configuration once a +lease has been acquired. +If no lease is acquired, the script is used to test predefined leases, if any, and also called once if no valid lease can be identified. -.PP -No standard client script exists for some operating systems, even though -the actual client may work, so a pioneering user may well need to create -a new script or modify an existing one. In general, customizations specific -to a particular computer should be done in the -.B /etc/dhclient.conf +.Pp +.\" No standard client script exists for some operating systems, even though +.\" the actual client may work, so a pioneering user may well need to create +.\" a new script or modify an existing one. +In general, customizations specific to a particular computer should be done +in the +.Pa /etc/dhclient.conf file. -.SH OPERATION -When dhclient needs to invoke the client configuration script, it -writes a shell script into /tmp which defines a variety of variables. -In all cases, $reason is set to the name of the reason why the script -has been invoked. The following reasons are currently defined: +.Sh OPERATION +When +.Xr dhclient 8 +needs to invoke the client configuration script, it sets up a number of +environment variables and runs +.Nm dhclient-script . +In all cases, +.Va $reason +is set to the name of the reason why the script has been invoked. +The following reasons are currently defined: MEDIUM, PREINIT, ARPCHECK, ARPSEND, BOUND, RENEW, REBIND, REBOOT, EXPIRE, FAIL and TIMEOUT. -.PP -.SH MEDIUM -The DHCP client is requesting that an interface's media type -be set. The interface name is passed in $interface, and the media -type is passed in $medium. -.SH PREINIT +.Bl -tag -width "ARPCHECK" +.It MEDIUM +The DHCP client is requesting that an interface's media type be set. +The interface name is passed in +.Va $interface , +and the media type is passed in +.Va $medium . +.It PREINIT The DHCP client is requesting that an interface be configured as -required in order to send packets prior to receiving an actual -address. For clients which use the BSD socket library, this means -configuring the interface with an IP address of 0.0.0.0 and a -broadcast address of 255.255.255.255. For other clients, it may be -possible to simply configure the interface up without actually giving -it an IP address at all. The interface name is passed in $interface, -and the media type in $medium. -.PP -If an IP alias has been declared in dhclient.conf, its address will be -passed in $alias_ip_address, and that IP alias should be deleted from -the interface, along with any routes to it. -.SH ARPSEND +required in order to send packets prior to receiving an actual address. +.\" For clients which use the BSD socket library, +This means configuring the interface with an IP address of 0.0.0.0 +and a broadcast address of 255.255.255.255. +.\" For other clients, it may be possible to simply configure the interface up +.\" without actually giving it an IP address at all. +The interface name is passed in +.Va $interface , +and the media type in +.Va $medium . +.Pp +If an IP alias has been declared in +.Xr dhclient.conf 5 , +its address will be passed in +.Va $alias_ip_address , +and that IP alias should be deleted from the interface, +along with any routes to it. +.It ARPSEND The DHCP client is requesting that an address that has been offered to it be checked to see if somebody else is using it, by sending an ARP -request for that address. It's not clear how to implement this, so -no examples exist yet. The IP address to check is passed in -$new_ip_address, and the interface name is passed in $interface. -.SH ARPCHECK -The DHCP client wants to know if a response to the ARP request send -using ARPSEND has been received. If one has, the script should exit -with a nonzero status, indicating that the offered address has already -been requested and should be declined. $new_ip_address and -$interface are set as with ARPSEND. -.SH BOUND -The DHCP client has done an initial binding to a new address. The -new IP address is passed in $new_ip_address, and the interface name is -passed in $interface. The media type is passed in $medium. Any -options acquired from the server are passed using the option name -described in \fBdhcp-options\fR, except that dashes ('-') are replaced -by underscores ('_') in order to make valid shell variables, and the -variable names start with new_. So for example, the new subnet mask -would be passed in $new_subnet_mask. -.PP +request for that address. +It's not clear how to implement this, so no examples exist yet. +The IP address to check is passed in +.Va $new_ip_address , +and the interface name is passed in +.Va $interface . +.It ARPCHECK +The DHCP client wants to know if a response to the ARP request sent +using ARPSEND has been received. +If one has, the script should exit with a nonzero status, indicating that +the offered address has already been requested and should be declined. +.Va $new_ip_address +and +.Va $interface +are set as with ARPSEND. +.It BOUND +The DHCP client has done an initial binding to a new address. +The new IP address is passed in +.Va $new_ip_address , +and the interface name is passed in +.Va $interface . +The media type is passed in +.Va $medium . +Any options acquired from the server are passed using the option name +described in +.Xr dhcp-options 5 , +except that dashes +.Pq Sq - +are replaced by underscores +.Pq Sq _ +in order to make valid shell variables, and the variable names start with new_. +So for example, the new subnet mask would be passed in +.Va $new_subnet_mask . +.Pp When a binding has been completed, a lot of network parameters are -likely to need to be set up. A new /etc/resolv.conf needs to be -created, using the values of $new_domain_name and -$new_domain_name_servers (which may list more than one server, -separated by spaces). A default route should be set using -$new_routers, and static routes may need to be set up using -$new_static_routes. -.PP -If an IP alias has been declared, it must be set up here. The alias -IP address will be written as $alias_ip_address, and other DHCP -options that are set for the alias (e.g., subnet mask) will be passed -in variables named as described previously except starting with -$alias_ instead of $new_. Care should be taken that the alias IP -address not be used if it is identical to the bound IP address -($new_ip_address), since the other alias parameters may be incorrect -in this case. -.SH RENEW +likely to need to be set up. +A new +.Pa /etc/resolv.conf +needs to be created, using the values of +.Va $new_domain_name +and +.Va $new_domain_name_servers +(which may list more than one server, separated by spaces). +A default route should be set using +.Va $new_routers , +and static routes may need to be set up using +.Va $new_static_routes . +.Pp +If an IP alias has been declared, it must be set up here. +The alias IP address will be written as +.Va $alias_ip_address , +and other DHCP options that are set for the alias (e.g., subnet mask) +will be passed in variables named as described previously except starting with +$alias_ instead of $new_. +Care should be taken that the alias IP address not be used if it is identical +to the bound IP address +.Pq Va $new_ip_address , +since the other alias parameters may be incorrect in this case. +.It RENEW When a binding has been renewed, the script is called as in BOUND, except that in addition to all the variables starting with $new_, -there is another set of variables starting with $old_. Persistent -settings that may have changed need to be deleted - for example, if a -local route to the bound address is being configured, the old local -route should be deleted. If the default route has changed, the old default -route should be deleted. If the static routes have changed, the old -ones should be deleted. Otherwise, processing can be done as with -BOUND. -.SH REBIND -The DHCP client has rebound to a new DHCP server. This can be handled -as with RENEW, except that if the IP address has changed, the ARP -table should be cleared. -.SH REBOOT -The DHCP client has successfully reacquired its old address after a -reboot. This can be processed as with BOUND. -.SH EXPIRE +there is another set of variables starting with $old_. +Persistent settings that may have changed need to be deleted \- for example, +if a local route to the bound address is being configured, the old local +route should be deleted. +If the default route has changed, the old default route should be deleted. +If the static routes have changed, the old ones should be deleted. +Otherwise, processing can be done as with BOUND. +.It REBIND +The DHCP client has rebound to a new DHCP server. +This can be handled as with RENEW, except that if the IP address has changed, +the ARP table should be cleared. +.It REBOOT +The DHCP client has successfully reacquired its old address after a reboot. +This can be processed as with BOUND. +.It EXPIRE The DHCP client has failed to renew its lease or acquire a new one, -and the lease has expired. The IP address must be relinquished, and -all related parameters should be deleted, as in RENEW and REBIND. -.SH FAIL +and the lease has expired. +The IP address must be relinquished, and all related parameters should be +deleted, as in RENEW and REBIND. +.It FAIL The DHCP client has been unable to contact any DHCP servers, and any -leases that have been tested have not proved to be valid. The -parameters from the last lease tested should be deconfigured. This -can be handled in the same way as EXPIRE. -.SH TIMEOUT +leases that have been tested have not proved to be valid. +The parameters from the last lease tested should be deconfigured. +This can be handled in the same way as EXPIRE. +.It TIMEOUT The DHCP client has been unable to contact any DHCP servers. However, an old lease has been identified, and its parameters have -been passed in as with BOUND. The client configuration script should -test these parameters and, if it has reason to believe they are valid, -should exit with a value of zero. If not, it should exit with a -nonzero value. -.PP +been passed in as with BOUND. +The client configuration script should test these parameters and, +if it has reason to believe they are valid, should exit with a value of zero. +If not, it should exit with a nonzero value. +.El +.Pp The usual way to test a lease is to set up the network as with REBIND (since this may be called to test more than one lease) and then ping -the first router defined in $routers. If a response is received, the -lease must be valid for the network to which the interface is -currently connected. It would be more complete to try to ping all of -the routers listed in $new_routers, as well as those listed in -$new_static_routes, but current scripts do not do this. -.SH FILES -Each operating system should generally have its own script file, -although the script files for similar operating systems may be similar -or even identical. The script files included in the Internet -Software Consortium DHCP distribution appear in the distribution tree -under client/scripts, and bear the names of the operating systems on -which they are intended to work. -.SH BUGS +the first router defined in +.Va $routers . +If a response is received, the lease must be valid for the network to +which the interface is currently connected. +It would be more complete to try to ping all of the routers listed in +.Va $new_routers , +as well as those listed in +.Va $new_static_routes , +but current scripts do not do this. +.\" .Sh FILES +.\" Each operating system should generally have its own script file, +.\" although the script files for similar operating systems may be similar +.\" or even identical. +.\" The script files included in the Internet Software Consortium DHCP +.\" distribution appear in the distribution tree under client/scripts, +.\" and bear the names of the operating systems on which they are intended +.\" to work. +.Sh SEE ALSO +.Xr dhclient.conf 5 , +.Xr dhclient.leases 5 , +.Xr dhclient 8 , +.Xr dhcpd 8 , +.Xr dhcrelay 8 +.Sh AUTHORS +The original version of +.Nm +was written for the Internet Software Consortium by +.An Ted Lemon Aq mellon@fugue.com +in cooperation with Vixie Enterprises. +To learn more about the Internet Software Consortium, see +.Pa http://www.vix.com/isc . +To learn more about Vixie Enterprises, see +.Pa http://www.vix.com . +.Pp +The +.Ox +implementation of +.Nm +was written by +.An Kenneth R. Westerback Aq krw@openbsd.org . +.Sh BUGS If more than one interface is being used, there's no obvious way to -avoid clashes between server-supplied configuration parameters - for -example, the stock dhclient-script rewrites /etc/resolv.conf. If -more than one interface is being configured, /etc/resolv.conf will be -repeatedly initialized to the values provided by one server, and then -the other. Assuming the information provided by both servers is -valid, this shouldn't cause any real problems, but it could be -confusing. -.SH SEE ALSO -dhclient(8), dhcpd(8), dhcrelay(8), dhclient.conf(5) and -dhclient.leases(5). -.SH AUTHOR -.B dhclient-script(8) -has been written for the Internet Software Consortium -by Ted Lemon <mellon@fugue.com> in cooperation with Vixie -Enterprises. To learn more about the Internet Software Consortium, -see -.B http://www.vix.com/isc. -To learn more about Vixie -Enterprises, see -.B http://www.vix.com. +avoid clashes between server-supplied configuration parameters \- for +example, the stock dhclient-script rewrites +.Pa /etc/resolv.conf . +If more than one interface is being configured, +.Pa /etc/resolv.conf +will be repeatedly initialized to the values provided by one server, and then +the other. +Assuming the information provided by both servers is valid, this shouldn't +cause any real problems, but it could be confusing. diff --git a/usr.sbin/dhcp/dhclient/dhclient.conf.5 b/usr.sbin/dhcp/dhclient/dhclient.conf.5 index 61d8cad8768..dcba6c49e2c 100644 --- a/usr.sbin/dhcp/dhclient/dhclient.conf.5 +++ b/usr.sbin/dhcp/dhclient/dhclient.conf.5 @@ -1,4 +1,4 @@ -.\" dhclient.conf.5 +.\" $OpenBSD: dhclient.conf.5,v 1.13 2003/06/25 09:27:57 jmc Exp $ .\" .\" Copyright (c) 1997 The Internet Software Consortium. .\" All rights reserved. @@ -35,473 +35,468 @@ .\" Enterprises. To learn more about the Internet Software Consortium, .\" see ``http://www.isc.org/isc''. To learn more about Vixie .\" Enterprises, see ``http://www.vix.com''. -.TH dhclient.conf 5 -.SH NAME -dhclient.conf - DHCP client configuration file -.SH DESCRIPTION -The dhclient.conf file contains configuration information for -.IR dhclient, +.\" +.Dd January 1, 1997 +.Dt DHCLIENT.CONF 5 +.Os +.Sh NAME +.Nm dhclient.conf +.Nd DHCP client configuration file +.Sh DESCRIPTION +The +.Nm +file contains configuration information for +.Xr dhclient 8 , the Internet Software Consortium DHCP Client. -.PP -The dhclient.conf file is a free-form ASCII text file. It is parsed by -the recursive-descent parser built into dhclient. The file may contain -extra tabs and newlines for formatting purposes. Keywords in the file -are case-insensitive. Comments may be placed anywhere within the -file (except within quotes). Comments begin with the # character and -end at the end of the line. -.PP -The dhclient.conf file can be used to configure the behaviour of the -client in a wide variety of ways: protocol timing, information -requested from the server, information required of the server, -defaults to use if the server does not provide certain information, -values with which to override information provided by the server, or -values to prepend or append to information provided by the server. +.Pp +The +.Nm +file is a free-form ASCII text file. +It is parsed by the recursive-descent parser built into +.Xr dhclient 8 . +The file may contain extra tabs and newlines for formatting purposes. +Keywords in the file are case-insensitive. +Comments may be placed anywhere within the file (except within quotes). +Comments begin with the +.Sq # +character and end at the end of the line. +.Pp +The +.Nm +file can be used to configure the behaviour of the client in a wide variety +of ways: protocol timing, information requested from the server, information +required of the server, defaults to use if the server does not provide +certain information, values with which to override information provided by +the server, or values to prepend or append to information provided by the +server. The configuration file can also be preinitialized with addresses to use on networks that don't have DHCP servers. -.SH PROTOCOL TIMING +.Sh PROTOCOL TIMING The timing behaviour of the client need not be configured by the user. If no timing configuration is provided by the user, a fairly -reasonable timing behaviour will be used by default - one which +reasonable timing behaviour will be used by default \- one which results in fairly timely updates without placing an inordinate load on the server. -.PP +.Pp The following statements can be used to adjust the timing behaviour of the DHCP client if required, however: -.PP -.I The -.B timeout -.I statement -.PP - \fBtimeout \fItime\fR\fB;\fR -.PP +.Pp +.Bl -tag -width Ds +.It Ic timeout Ar time ; The -.I timeout +.Ic timeout statement determines the amount of time that must pass between the time that the client begins to try to determine its address and the -time that it decides that it's not going to be able to contact a -server. By default, this timeout is sixty seconds. After the -timeout has passed, if there are any static leases defined in the +time that it decides that it's not going to be able to contact a server. +By default, this timeout is sixty seconds. +After the timeout has passed, if there are any static leases defined in the configuration file, or any leases remaining in the lease database that have not yet expired, the client will loop through these leases attempting to validate them, and if it finds one that appears to be -valid, it will use that lease's address. If there are no valid -static leases or unexpired leases in the lease database, the client -will restart the protocol after the defined retry interval. -.PP -.I The -.B retry -.I statement -.PP - \fBretry \fItime\fR\fB;\fR -.PP +valid, it will use that lease's address. +If there are no valid static leases or unexpired leases in the lease database, +the client will restart the protocol after the defined retry interval. +.It Ic retry Ar time ; The -.I retry +.Ic retry statement determines the time that must pass after the client has determined that there is no DHCP server present before it tries again -to contact a DHCP server. By default, this is five minutes. -.PP -.I The -.B select-timeout -.I statement -.PP - \fBselect-timeout \fItime\fR\fB;\fR -.PP +to contact a DHCP server. +By default, this is five minutes. +.It Ic select-timeout Ar time ; It is possible (some might say desirable) for there to be more than -one DHCP server serving any given network. In this case, it is -possible that a client may be sent more than one offer in response to -its initial lease discovery message. It may be that one of these -offers is preferable to the other (e.g., one offer may have the -address the client previously used, and the other may not). -.PP +one DHCP server serving any given network. +In this case, it is possible that a client may be sent more than one offer +in response to its initial lease discovery message. +It may be that one of these offers is preferable to the other +(e.g., one offer may have the address the client previously used, +and the other may not). +.Pp The -.I select-timeout +.Ic select-timeout is the time after the client sends its first lease discovery request at which it stops waiting for offers from servers, assuming that it -has received at least one such offer. If no offers have been -received by the time the -.I select-timeout +has received at least one such offer. +If no offers have been received by the time the +.Ic select-timeout has expired, the client will accept the first offer that arrives. -.PP -By default, the select-timeout is zero seconds - that is, the client -will take the first offer it sees. -.PP -.I The -.B reboot -.I statement -.PP - \fBreboot \fItime\fR\fB;\fR -.PP +.Pp +By default, the +.Ic select-timeout +is zero seconds \- that is, the client will take the first offer it sees. +.It Ic reboot Ar time ; When the client is restarted, it first tries to reacquire the last -address it had. This is called the INIT-REBOOT state. If it is -still attached to the same network it was attached to when it last -ran, this is the quickest way to get started. The -.I reboot +address it had. +This is called the INIT-REBOOT state. +If it is still attached to the same network it was attached to when it last +ran, this is the quickest way to get started. +The +.Ic reboot statement sets the time that must elapse after the client first tries to reacquire its old address before it gives up and tries to discover -a new address. By default, the reboot timeout is ten seconds. -.PP -.I The -.B backoff-cutoff -.I statement -.PP - \fBbackoff-cutoff \fItime\fR\fB;\fR -.PP +a new address. +By default, the reboot timeout is ten seconds. +.It Ic backoff-cutoff Ar time ; The client uses an exponential backoff algorithm with some randomness, so that if many clients try to configure themselves at the same time, -they will not make their requests in lockstep. The -.I backoff-cutoff +they will not make their requests in lockstep. +The +.Ic backoff-cutoff statement determines the maximum amount of time that the client is -allowed to back off. It defaults to two minutes. -.PP -.I The -.B initial-interval -.I statement -.PP - \fBinitial-interval \fItime\fR\fB;\fR -.PP +allowed to back off. +It defaults to two minutes. +.It Ic initial-interval Ar time ; The -.I initial-interval +.Ic initial-interval statement sets the amount of time between the first attempt to reach a -server and the second attempt to reach a server. Each time a message -is sent, the interval between messages is incremented by twice the -current interval multiplied by a random number between zero and one. +server and the second attempt to reach a server. +Each time a message is sent, the interval between messages is incremented by +twice the current interval multiplied by a random number between zero and one. If it is greater than the backoff-cutoff amount, it is set to that -amount. It defaults to ten seconds. -.SH LEASE REQUIREMENTS AND REQUESTS +amount. +It defaults to ten seconds. +.El +.Sh LEASE REQUIREMENTS AND REQUESTS The DHCP protocol allows the client to request that the server send it specific information, and not send it other information that it is not -prepared to accept. The protocol also allows the client to reject -offers from servers if they don't contain information the client -needs, or if the information provided is not satisfactory. -.PP +prepared to accept. +The protocol also allows the client to reject offers from servers if they +don't contain information the client needs, or if the information provided +is not satisfactory. +.Pp There is a variety of data contained in offers that DHCP servers send -to DHCP clients. The data that can be specifically requested is what -are called \fIDHCP Options\fR. DHCP Options are defined in - \fBdhcp-options(5)\fR. -.PP -.I The -.B request -.I statement -.PP - \fBrequest [ \fIoption\fR ] [\fB,\fI ... \fIoption\fR ]\fB;\fR -.PP -The request statement causes the client to request that any server -responding to the client send the client its values for the specified -options. Only the option names should be specified in the request -statement - not option parameters. -.PP -.I The -.B require -.I statement -.PP - \fBrequire [ \fIoption\fR ] [\fB,\fI ... \fIoption ]\fB;\fR -.PP -The require statement lists options that must be sent in order for an -offer to be accepted. Offers that do not contain all the listed -options will be ignored. -.PP -.I The -.B send -.I statement -.PP - \fBsend { [ \fIoption declaration\fR ] -[\fB,\fI ... \fIoption declaration\fR ]\fB}\fR -.PP -The send statement causes the client to send the specified options to -the server with the specified values. These are full option -declarations as described in \fBdhcp-options(5)\fR. Options that are -always sent in the DHCP protocol should not be specified here, except -that the client can specify a \fBrequested-lease-time\fR option other -than the default requested lease time, which is two hours. The other -obvious use for this statement is to send information to the server +to DHCP clients. +The data that can be specifically requested is what are called +.Em DHCP Options . +DHCP Options are defined in +.Xr dhcp-options 5 . +.Pp +.Bl -tag -width Ds +.It Xo +.Ic request Op Ar option +.Oo , Ar ... option Oc ; +.Xc +The +.Ic request +statement causes the client to request that any server responding to the +client send the client its values for the specified options. +Only the option names should be specified in the request statement \- not +option parameters. +.It Xo +.Ic require Op Ar option +.Oo , Ar ... option Oc ; +.Xc +The +.Ic require +statement lists options that must be sent in order for an offer to be accepted. +Offers that do not contain all the listed options will be ignored. +.It Xo +.Ic send No { Op Ar option declaration +.Oo , Ar ... option declaration Oc } +.Xc +The +.Ic send +statement causes the client to send the specified options to the server with +the specified values. +These are full option declarations as described in +.Xr dhcp-options 5 . +Options that are always sent in the DHCP protocol should not be specified +here, except that the client can specify a +.Ar requested-lease-time +option other than the default requested lease time, which is two hours. +The other obvious use for this statement is to send information to the server that will allow it to differentiate between this client and other clients or kinds of clients. -.SH OPTION MODIFIERS +.El +.Sh OPTION MODIFIERS In some cases, a client may receive option data from the server which is not really appropriate for that client, or may not receive -information that it needs, and for which a useful default value -exists. It may also receive information which is useful, but which -needs to be supplemented with local information. To handle these -needs, several option modifiers are available. -.PP -.I The -.B default -.I statement -.PP - \fBdefault { [ \fIoption declaration\fR ] -[\fB,\fI ... \fIoption declaration\fR ]\fB}\fR -.PP +information that it needs, and for which a useful default value exists. +It may also receive information which is useful, but which needs to be +supplemented with local information. +To handle these needs, several option modifiers are available. +.Pp +.Bl -tag -width Ds +.It Xo +.Ic default No { Op Ar option declaration +.Oo , Ar ... option declaration Oc } +.Xc If for some set of options the client should use the value supplied by the server, but needs to use some default value if no value was supplied by the server, these values can be defined in the -.B default +.Ic default statement. -.PP -.I The -.B supersede -.I statement -.PP - \fBsupersede { [ \fIoption declaration\fR ] -[\fB,\fI ... \fIoption declaration\fR ]\fB}\fR -.PP +.It Xo +.Ic supersede No { Op Ar option declaration +.Oo , Ar ... option declaration Oc } +.Xc If for some set of options the client should always use its own value -rather than any value supplied by the server, these values can be -defined in the -.B supersede +rather than any value supplied by the server, these values can be defined +in the +.Ic supersede statement. -.PP -.I The -.B prepend -.I statement -.PP - \fBprepend { [ \fIoption declaration\fR ] -[\fB,\fI ... \fIoption declaration\fR ]\fB}\fR -.PP -If for some set of options the client should use a value you -supply, and then use the values supplied by -the server, if any, these values can be defined in the -.B prepend -statement. The -.B prepend -statement can only be used for options which -allow more than one value to be given. This restriction is not -enforced - if violated, the results are unpredictable. -.PP -.I The -.B append -.I statement -.PP - \fBappend { [ \fIoption declaration\fR ] -[\fB,\fI ... \fIoption declaration\fR ]\fB}\fR -.PP +.It Xo +.Ic prepend No { Op Ar option declaration +.Oo , Ar ... option declaration Oc } +.Xc +If for some set of options the client should use a value you supply, +and then use the values supplied by the server, if any, +these values can be defined in the +.Ic prepend +statement. +The +.Ic prepend +statement can only be used for options which allow more than one value to +be given. +This restriction is not enforced \- if violated, the results are unpredictable. +.It Xo +.Ic append No { Op Ar option declaration +.Oo , Ar ... option declaration Oc } +.Xc If for some set of options the client should first use the values supplied by the server, if any, and then use values you supply, these values can be defined in the -.B append -statement. The -.B append -statement can only be used for options which -allow more than one value to be given. This restriction is not -enforced - if you ignore it, the behaviour will be unpredictable. -.SH LEASE DECLARATIONS -.PP -.I The -.B lease -.I declaration -.PP - \fBlease {\fR \fIlease-declaration\fR [ ... \fIlease-declaration ] \fB}\fR -.PP -The DHCP client may decide after some period of time (see \fBPROTOCOL -TIMING\fR) that it is not going to succeed in contacting a -server. At that time, it consults its own database of old leases and -tests each one that has not yet timed out by pinging the listed router -for that lease to see if that lease could work. It is possible to -define one or more \fIfixed\fR leases in the client configuration file -for networks where there is no DHCP or BOOTP service, so that the -client can still automatically configure its address. This is done -with the -.B lease +.Ic append statement. -.PP -NOTE: the lease statement is also used in the dhclient.leases file in -order to record leases that have been received from DHCP servers. +The +.Ic append +statement can only be used for options which allow more than one value to +be given. +This restriction is not enforced \- if you ignore it, +the behaviour will be unpredictable. +.El +.Sh LEASE DECLARATIONS +.Pp +The lease declaration: +.Pp +.Xo +.Ic \ \& lease No { Ar lease-declaration +.Oo Ar ... lease-declaration Oc } +.Xc +.Pp +The DHCP client may decide after some period of time (see +.Sx PROTOCOL TIMING ) +that it is not going to succeed in contacting a server. +At that time, it consults its own database of old leases and tests each one +that has not yet timed out by pinging the listed router for that lease to +see if that lease could work. +It is possible to define one or more +.Em fixed +leases in the client configuration file for networks where there is no DHCP +or BOOTP service, so that the client can still automatically configure its +address. +This is done with the +.Ic lease +statement. +.Pp +NOTE: the lease statement is also used in the +.Pa dhclient.leases +file in order to record leases that have been received from DHCP servers. Some of the syntax for leases as described below is only needed in the -dhclient.leases file. Such syntax is documented here for -completeness. -.PP +.Pa dhclient.leases +file. +Such syntax is documented here for completeness. +.Pp A lease statement consists of the lease keyword, followed by a left curly brace, followed by one or more lease declaration statements, -followed by a right curly brace. The following lease declarations -are possible: -.PP - \fBbootp;\fR -.PP +followed by a right curly brace. +The following lease declarations are possible: +.Pp +.Bl -tag -width Ds +.It Ic bootp ; The -.B bootp +.Ic bootp statement is used to indicate that the lease was acquired using the -BOOTP protocol rather than the DHCP protocol. It is never necessary -to specify this in the client configuration file. The client uses -this syntax in its lease database file. -.PP - \fBinterface\fR \fB"\fR\fIstring\fR\fB";\fR -.PP +BOOTP protocol rather than the DHCP protocol. +It is never necessary to specify this in the client configuration file. +The client uses this syntax in its lease database file. +.It Ic interface Ar \&"string\&" ; The -.B interface -lease statement is used to indicate the interface on which the lease -is valid. If set, this lease will only be tried on a particular -interface. When the client receives a lease from a server, it always -records the interface number on which it received that lease. -If predefined leases are specified in the dhclient.conf file, the -interface should also be specified, although this is not required. -.PP - \fBfixed-address\fR \fIip-address\fR\fB;\fR -.PP +.Ic interface +lease statement is used to indicate the interface on which the lease is valid. +If set, this lease will only be tried on a particular interface. +When the client receives a lease from a server, it always records the +interface number on which it received that lease. +If predefined leases are specified in the +.Nm +file, the interface should also be specified, although this is not required. +.It Ic fixed-address Ar ip-address ; The -.B fixed-address -statement is used to set the IP address of a particular lease. This -is required for all lease statements. The IP address must be -specified as a dotted quad (e.g., 12.34.56.78). -.PP - \fBfilename "\fR\fIstring\fR\fB";\fR -.PP +.Ic fixed-address +statement is used to set the IP address of a particular lease. +This is required for all lease statements. +The IP address must be specified as a dotted quad (e.g., 12.34.56.78). +.It Ic filename Ar \&"string\&" ; The -.B filename -statement specifies the name of the boot filename to use. This is -not used by the standard client configuration script, but is included -for completeness. -.PP - \fBserver-name "\fR\fIstring\fR\fB";\fR -.PP +.Ic filename +statement specifies the name of the boot filename to use. +This is not used by the standard client configuration script, but is +included for completeness. +.It Ic server-name Ar \&"string\&" ; The -.B server-name -statement specifies the name of the boot server name to use. This is -also not used by the standard client configuration script. -.PP - \fBoption\fR \fIoption-declaration\fR\fB;\fR -.PP +.Ic server-name +statement specifies the name of the boot server name to use. +This is also not used by the standard client configuration script. +.It Ic option Ar option-declaration ; The -.B option -statement is used to specify the value of an option supplied by the -server, or, in the case of predefined leases declared in -dhclient.conf, the value that the user wishes the client configuration -script to use if the predefined lease is used. -.PP - \fBscript "\fIscript-name\fB";\fR -.PP +.Ic option +statement is used to specify the value of an option supplied by the server, +or, in the case of predefined leases declared in +.Nm dhclient.conf , +the value that the user wishes the client configuration script to use if the +predefined lease is used. +.It Ic script Ar \&"script-name\&" ; The -.B script -statement is used to specify the pathname of the dhcp client -configuration script. This script is used by the dhcp client to set -each interface's initial configuration prior to requesting an address, -to test the address once it has been offered, and to set the -interface's final configuration once a lease has been acquired. If -no lease is acquired, the script is used to test predefined leases, if -any, and also called once if no valid lease can be identified. For -more information, see -.B dhclient-lease(8). -.PP - \fBmedium "\fImedia setup\fB";\fR -.PP +.Ic script +statement is used to specify the pathname of the DHCP client configuration +script. +This script is used by the DHCP client to set each interface's initial +configuration prior to requesting an address, to test the address once it +has been offered, and to set the interface's final configuration once a +lease has been acquired. +If no lease is acquired, the script is used to test predefined leases, if +any, and also called once if no valid lease can be identified. +For more information, see +.Xr dhclient.leases 5 . +.It Ic medium Ar \&"media setup\&" ; The -.B medium +.Ic medium statement can be used on systems where network interfaces cannot -automatically determine the type of network to which they are -connected. The media setup string is a system-dependent parameter -which is passed to the dhcp client configuration script when -initializing the interface. On Unix and Unix-like systems, the -argument is passed on the ifconfig command line when configuring the -interface. -.PP -The dhcp client automatically declares this parameter if it used a +automatically determine the type of network to which they are connected. +The media setup string is a system-dependent parameter which is passed +to the DHCP client configuration script when initializing the interface. +On +.Ux +and UNIX-like systems, the argument is passed on the ifconfig command line +when configuring the interface. +.Pp +The DHCP client automatically declares this parameter if it used a media type (see the -.B media +.Ic media statement) when configuring the interface in order to obtain a lease. This statement should be used in predefined leases only if the network interface requires media type configuration. -.PP - \fBrenew\fR \fIdate\fB;\fR -.PP - \fBrebind\fR \fIdate\fB;\fR -.PP - \fBexpire\fR \fIdate\fB;\fR -.PP -The \fBrenew\fR statement defines the time at which the dhcp client -should begin trying to contact its server to renew a lease that it is -using. The \fBrebind\fR statement defines the time at which the dhcp -client should begin to try to contact \fIany\fR dhcp server in order -to renew its lease. The \fBexpire\fR statement defines the time at -which the dhcp client must stop using a lease if it has not been able -to contact a server in order to renew it. -.PP +.It Ic renew Ar date ; +.It Ic rebind Ar date ; +.It Ic expire Ar date ; +The +.Ic renew +statement defines the time at which the DHCP client should begin trying to +contact its server to renew a lease that it is using. +The +.Ic rebind +statement defines the time at which the DHCP client should begin to try to +contact +.Em any +DHCP server in order to renew its lease. +The +.Ic expire +statement defines the time at which the DHCP client must stop using a lease +if it has not been able to contact a server in order to renew it. +.El +.Pp These declarations are automatically set in leases acquired by the -DHCP client, but must also be configured in predefined leases - a +DHCP client, but must also be configured in predefined leases \- a predefined lease whose expiry time has passed will not be used by the DHCP client. -.PP +.Pp Dates are specified as follows: -.PP - \fI<weekday> <year>\fB/\fI<month>\fB/\fI<day> -<hour>\fB:\fI<minute>\fB:\fI<second>\fR -.PP +.Pp +.Ar \ \&<weekday> +.Sm off +.Ar <year> No / Ar <month> No / Ar <day> +.Ar <hour> : <minute> : <second> +.Sm on +.Pp The weekday is present to make it easy for a human to tell when a -lease expires - it's specified as a number from zero to six, with zero -being Sunday. When declaring a predefined lease, it can always be -specified as zero. The year is specified with the century, so it -should generally be four digits except for really long leases. The -month is specified as a number starting with 1 for January. The day -of the month is likewise specified starting with 1. The hour is a -number between 0 and 23, the minute a number between 0 and 69, and the -second also a number between 0 and 69. -.SH ALIAS DECLARATIONS - \fBalias { \fI declarations ... \fB}\fR -.PP +lease expires \- it's specified as a number from zero to six, with zero +being Sunday. +When declaring a predefined lease, it can always be specified as zero. +The year is specified with the century, so it should generally be four +digits except for really long leases. +The month is specified as a number starting with 1 for January. +The day of the month is likewise specified starting with 1. +The hour is a number between 0 and 23, +the minute a number between 0 and 69, +and the second also a number between 0 and 69. +.Sh ALIAS DECLARATIONS +.Pp +.Ic alias No { Ar declarations ... No } +.Pp Some DHCP clients running TCP/IP roaming protocols may require that in addition to the lease they may acquire via DHCP, their interface also be configured with a predefined IP alias so that they can have a -permanent IP address even while roaming. The Internet Software -Consortium DHCP client doesn't support roaming with fixed addresses -directly, but in order to facilitate such experimentation, the dhcp -client can be set up to configure an IP alias using the -.B alias +permanent IP address even while roaming. +The Internet Software Consortium DHCP client doesn't support roaming with +fixed addresses directly, but in order to facilitate such experimentation, +the DHCP client can be set up to configure an IP alias using the +.Ic alias declaration. -.PP -The alias declaration resembles a lease declaration, except that -options other than the subnet-mask option are ignored by the standard -client configuration script, and expiry times are ignored. A typical -alias declaration includes an interface declaration, a fixed-address -declaration for the IP alias address, and a subnet-mask option -declaration. A medium statement should never be included in an alias -declaration. -.SH OTHER DECLARATIONS - \fBreject \fIip-address\fB;\fR -.PP -The reject statement causes the DHCP client to reject offers from -servers who use the specified address as a server identifier. This -can be used to avoid being configured by rogue or misconfigured dhcp -servers, although it should be a last resort - better to track down +.Pp +The +.Ic alias +declaration resembles a lease declaration, except that options other than +the subnet-mask option are ignored by the standard client configuration +script, and expiry times are ignored. +A typical alias declaration includes an interface declaration, a fixed-address +declaration for the IP alias address, and a subnet-mask option declaration. +A medium statement should never be included in an alias declaration. +.Sh OTHER DECLARATIONS +.Pp +.Bl -tag -width Ds +.It Ic reject Ar ip-address ; +The +.Ic reject +statement causes the DHCP client to reject offers from servers who use +the specified address as a server identifier. +This can be used to avoid being configured by rogue or misconfigured DHCP +servers, although it should be a last resort \- better to track down the bad DHCP server and fix it. -.PP - \fBinterface "\fIname\fB" { \fIdeclarations ... \fB } -.PP +.It Xo +.Ic interface Ar \&"name\&" No { Ar declarations +.Ar ... No } +.Xc A client with more than one network interface may require different -behaviour depending on which interface is being configured. All -timing parameters and declarations other than lease and alias +behaviour depending on which interface is being configured. +All timing parameters and declarations other than lease and alias declarations can be enclosed in an interface declaration, and those parameters will then be used only for the interface that matches the -specified name. Interfaces for which there is no interface -declaration will use the parameters declared outside of any interface -declaration, or the default settings. -.PP - \fBmedia "\fImedia setup\fB"\fI [ \fB, "\fImedia setup\fB", \fI... ]\fB;\fR -.PP +specified name. +Interfaces for which there is no interface declaration will use the +parameters declared outside of any interface declaration, +or the default settings. +.It Xo +.Ic media Ar \&"media setup\&" +.Oo , Ar \&"media setup\&" , ... Oc ; +.Xc The -.B media +.Ic media statement defines one or more media configuration parameters which may -be tried while attempting to acquire an IP address. The dhcp client -will cycle through each media setup string on the list, configuring -the interface using that setup and attempting to boot, and then trying -the next one. This can be used for network interfaces which aren't -capable of sensing the media type unaided - whichever media type -succeeds in getting a request to the server and hearing the reply is -probably right (no guarantees). -.PP +be tried while attempting to acquire an IP address. +The DHCP client will cycle through each media setup string on the list, +configuring the interface using that setup and attempting to boot, +and then trying the next one. +This can be used for network interfaces which aren't capable of sensing +the media type unaided \- whichever media type succeeds in getting a request +to the server and hearing the reply is probably right (no guarantees). +.Pp The media setup is only used for the initial phase of address -acquisition (the DHCPDISCOVER and DHCPOFFER packets). Once an -address has been acquired, the dhcp client will record it in its lease -database and will record the media type used to acquire the address. -Whenever the client tries to renew the lease, it will use that same -media type. The lease must expire before the client will go back to -cycling through media types. -.SH SAMPLE -The following configuration file is used on a laptop running NetBSD -1.3. The laptop has an IP alias of 192.5.5.213, and has one -interface, ep0 (a 3Com 3C589C). Booting intervals have been -shortened somewhat from the default, because the client is known to -spend most of its time on networks with little DHCP activity. The -laptop does roam to multiple networks. - -.nf - +acquisition (the DHCPDISCOVER and DHCPOFFER packets). +Once an address has been acquired, the DHCP client will record it in its +lease database and will record the media type used to acquire the address. +Whenever the client tries to renew the lease, it will use that same media type. +The lease must expire before the client will go back to cycling through media +types. +.El +.Sh EXAMPLES +The following configuration file is used on a laptop +which has an IP alias of 192.5.5.213, and has one interface, +ep0 (a 3Com 3C589C). +Booting intervals have been shortened somewhat from the default, because +the client is known to spend most of its time on networks with little DHCP +activity. +The laptop does roam to multiple networks. +.Bd -literal -offset indent timeout 60; retry 60; reboot 10; @@ -527,17 +522,27 @@ alias { fixed-address 192.5.5.213; option subnet-mask 255.255.255.255; } -.fi -This is a very complicated dhclient.conf file - in general, yours -should be much simpler. In many cases, it's sufficient to just -create an empty dhclient.conf file - the defaults are usually fine. -.SH SEE ALSO -dhcp-options(5), dhclient.leases(5), dhcpd(8), dhcpd.conf(5), RFC2132, -RFC2131. -.SH AUTHOR -.B dhclient(8) -was written by Ted Lemon <mellon@vix.com> -under a contract with Vixie Labs. Funding -for this project was provided by the Internet Software Corporation. +.Ed +.Pp +This is a very complicated +.Nm +file \- in general, yours should be much simpler. +In many cases, it's sufficient to just create an empty +.Nm +file \- the defaults are usually fine. +.Sh SEE ALSO +.Xr dhclient.leases 5 , +.Xr dhcp-options 5 , +.Xr dhcpd.conf 5 , +.Xr dhclient 8 , +.Xr dhcpd 8 +.Pp +RFC 2132, RFC 2131. +.Sh AUTHORS +.Xr dhclient 8 +was written by +.An Ted Lemon Aq mellon@vix.com +under a contract with Vixie Labs. +Funding for this project was provided by the Internet Software Corporation. Information about the Internet Software Consortium can be found at -.B http://www.isc.org/isc. +.Pa http://www.isc.org/isc . diff --git a/usr.sbin/dhcp/server/dhcpd.8 b/usr.sbin/dhcp/server/dhcpd.8 index a85cf780199..46c0fbb9d1e 100644 --- a/usr.sbin/dhcp/server/dhcpd.8 +++ b/usr.sbin/dhcp/server/dhcpd.8 @@ -1,4 +1,4 @@ -.\" dhcpd.8 +.\" $OpenBSD: dhcpd.8,v 1.16 2003/06/25 09:27:57 jmc Exp $ .\" .\" Copyright (c) 1995, 1996 The Internet Software Consortium. .\" All rights reserved. @@ -35,308 +35,370 @@ .\" Enterprises. To learn more about the Internet Software Consortium, .\" see ``http://www.isc.org/''. To learn more about Vixie .\" Enterprises, see ``http://www.vix.com''. -.TH dhcpd 8 -.SH NAME -dhcpd - Dynamic Host Configuration Protocol Server -.SH SYNOPSIS -.B dhcpd -[ -.B -p -.I port -] -[ -.B -f -] -[ -.B -d -] -[ -.B -q -] -[ -.B -cf -.I config-file -] -[ -.B -lf -.I lease-file -] -[ -.I if0 -[ -.I ...ifN -] -] -.SH DESCRIPTION -The Internet Software Consortium DHCP Server, dhcpd, implements the -Dynamic Host Configuration Protocol (DHCP) and the Internet Bootstrap -Protocol (BOOTP). DHCP allows hosts on a TCP/IP network to request -and be assigned IP addresses, and also to discover information about -the network to which they are attached. BOOTP provides similar -functionality, with certain restrictions. -.SH OPERATION -.PP +.\" +.Dd January 1, 1995 +.Dt DHCPD 8 +.Os +.Sh NAME +.Nm dhcpd +.Nd Dynamic Host Configuration Protocol Server +.Sh SYNOPSIS +.Nm dhcpd +.Op Fl p Ar port +.Op Fl f +.Op Fl d +.Op Fl q +.Op Fl cf Ar config-file +.Op Fl lf Ar lease-file +.Bk -words +.Op Ar if0 Op Ar ... ifN +.Ek +.Sh DESCRIPTION +The Internet Software Consortium DHCP Server, +.Nm dhcpd , +implements the Dynamic Host Configuration Protocol (DHCP) and the +Internet Bootstrap Protocol (BOOTP). +DHCP allows hosts on a TCP/IP network to request and be assigned IP addresses, +and also to discover information about the network to which they are attached. +BOOTP provides similar functionality, with certain restrictions. +.Sh OPERATION The DHCP protocol allows a host which is unknown to the network administrator to be automatically assigned a new IP address out of a -pool of IP addresses for its network. In order for this to work, the -network administrator allocates address pools in each subnet and -enters them into the dhcpd.conf(5) file. -.PP -On startup, dhcpd reads the -.IR dhcpd.conf -file and stores a list of available addresses on each subnet in -memory. When a client requests an address using the DHCP protocol, -dhcpd allocates an address for it. Each client is assigned a lease, -which expires after an amount of time chosen by the administrator (by -default, one day). Before leases expire, the clients to which leases -are assigned are expected to renew them in order to continue to use -the addresses. Once a lease has expired, the client to which that -lease was assigned is no longer permitted to use the leased IP -address. -.PP -In order to keep track of leases across system reboots and server -restarts, dhcpd keeps a list of leases it has assigned in the -dhcpd.leases(5) file. Before dhcpd grants a lease to a host, it -records the lease in this file and makes sure that the contents of the -file are flushed to disk. This ensures that even in the event of a -system crash, dhcpd will not forget about a lease that it has -assigned. On startup, after reading the dhcpd.conf file, dhcpd -reads the dhcpd.leases file to refresh its memory about what leases -have been assigned. -.PP -New leases are appended to the end of the dhcpd.leases -file. In order to prevent the file from becoming arbitrarily large, -from time to time dhcpd creates a new dhcpd.leases file from its -in-core lease database. Once this file has been written to disk, the -old file is renamed -.IR dhcpd.leases~ , -and the new file is renamed dhcpd.leases. If the system crashes in -the middle of this process, whichever dhcpd.leases file remains will -contain all the lease information, so there is no need for a special -crash recovery process. -.PP -BOOTP support is also provided by this server. Unlike DHCP, the BOOTP -protocol does not provide a protocol for recovering -dynamically-assigned addresses once they are no longer needed. It is -still possible to dynamically assign addresses to BOOTP clients, but -some administrative process for reclaiming addresses is required. By -default, leases are granted to BOOTP clients in perpetuity, although +pool of IP addresses for its network. +In order for this to work, the network administrator allocates address pools +in each subnet and enters them into the +.Xr dhcpd.conf 5 +file. +.Pp +On startup, +.Nm +reads the +.Pa dhcpd.conf +file and stores a list of available addresses on each subnet in memory. +When a client requests an address using the DHCP protocol, +.Nm +allocates an address for it. +Each client is assigned a lease, which expires after an amount of time +chosen by the administrator (by default, one day). +Before leases expire, the clients to which leases are assigned are expected +to renew them in order to continue to use the addresses. +Once a lease has expired, the client to which that lease was assigned is no +longer permitted to use the leased IP address. +.Pp +In order to keep track of leases across system reboots and server restarts, +.Nm +keeps a list of leases it has assigned in the +.Xr dhcpd.leases 5 +file. +Before +.Nm +grants a lease to a host, it records the lease in this file and makes sure +that the contents of the file are flushed to disk. +This ensures that even in the event of a system crash, +.Nm +will not forget about a lease that it has assigned. +On startup, after reading the +.Pa dhcpd.conf +file, +.Nm +reads the +.Pa dhcpd.leases +file to refresh its memory about what leases have been assigned. +.Pp +New leases are appended to the end of the +.Pa dhcpd.leases +file. +In order to prevent the file from becoming arbitrarily large, +from time to time +.Nm +creates a new +.Pa dhcpd.leases +file from its in-core lease database. +Once this file has been written to disk, the old file is renamed +.Pa dhcpd.leases~ , +and the new file is renamed +.Pa dhcpd.leases . +If the system crashes in the middle of this process, whichever +.Pa dhcpd.leases +file remains will contain all the lease information, so there is no need for +a special crash recovery process. +.Pp +BOOTP support is also provided by this server. +Unlike DHCP, the BOOTP protocol does not provide a protocol for recovering +dynamically-assigned addresses once they are no longer needed. +It is still possible to dynamically assign addresses to BOOTP clients, but +some administrative process for reclaiming addresses is required. +By default, leases are granted to BOOTP clients in perpetuity, although the network administrator may set an earlier cutoff date or a shorter lease length for BOOTP leases if that makes sense. -.PP -BOOTP clients may also be served in the old standard way, which is to -simply provide a declaration in the dhcpd.conf file for each -BOOTP client, permanently assigning an address to each client. -.PP -Whenever changes are made to the dhcpd.conf file, dhcpd must be -restarted. To restart dhcpd, send a SIGTERM (signal 15) to the -process ID contained in -.IR /var/run/dhcpd.pid , -and then re-invoke dhcpd. Because the DHCP server database is not as -lightweight as a BOOTP database, dhcpd does not automatically restart -itself when it sees a change to the dhcpd.conf file. -.PP -Note: We get a lot of complaints about this. We realize that it would -be nice if one could send a SIGHUP to the server and have it reload -the database. This is not technically impossible, but it would -require a great deal of work, our resources are extremely limited, and -they can be better spent elsewhere. So please don't complain about -this on the mailing list unless you're prepared to fund a project to -implement this feature, or prepared to do it yourself. -.PP -DHCP traffic always bypasses IPsec, otherwise there could be situations -when a server has an IPsec SA for the client, and sends replies over that, -which a potentially newly booted client cannot grasp. -.SH COMMAND LINE -.PP -The names of the network interfaces on which dhcpd should listen for -broadcasts may be specified on the command line. This should be done -on systems where dhcpd is unable to identify non-broadcast interfaces, -but should not be required on other systems. If no interface names -are specified on the command line dhcpd will identify all network -interfaces which are up, eliminating non-broadcast interfaces if -possible, and listen for DHCP broadcasts on each interface. -.PP -If dhcpd should listen on a port other than the standard (port 67), -the -.B -p -flag may used. It should be followed by the udp port number on which -dhcpd should listen. This is mostly useful for debugging purposes. +.Pp +BOOTP clients may also be served in the old standard way, which is +simply to provide a declaration in the +.Pa dhcpd.conf +file for each BOOTP client, permanently assigning an address to each client. +.Pp +Whenever changes are made to the +.Pa dhcpd.conf +file, +.Nm +must be restarted. +To restart +.Nm dhcpd , +send a SIGTERM (signal 15) to the process ID contained in +.Pa /var/run/dhcpd.pid , +and then re-invoke +.Nm dhcpd . +Because the DHCP server database is not as lightweight as a BOOTP database, +.Nm +does not automatically restart itself when it sees a change to the +.Pa dhcpd.conf +file. +.Pp +DHCP traffic always bypasses IPsec. +Otherwise there could be situations when a server has an IPsec SA for the +client and sends replies over that, +which a newly booted client would not be able to grasp. +.Sh COMMAND LINE +The names of the network interfaces on which +.Nm +should listen for broadcasts may be specified on the command line. +This should be done on systems where +.Nm +is unable to identify non-broadcast interfaces, +but should not be required on other systems. +If no interface names are specified on the command line, +.Nm +will identify all network interfaces which are up, eliminating non-broadcast +interfaces if possible, and listen for DHCP broadcasts on each interface. +.Pp +If +.Nm +should listen on a port other than the standard (port 67), the +.Fl p +flag may used. +It should be followed by the UDP port number on which +.Nm +should listen. +This is mostly useful for debugging purposes. If the -.B -p +.Fl p flag is specified, the server will transmit responses to clients at a -port number that is one greater than the one specified - i.e., if you +port number that is one greater than the one specified \- i.e., if you specify -.B -p +.Fl p 67, then the server will listen on port 67 and transmit to port 68. Datagrams that must go through relay agents are sent to the port number specified with the -.B -p -flag - if you wish to use alternate port numbers, you must configure +.Fl p +flag. +If you wish to use alternate port numbers, you must configure any relay agents you are using to use the same alternate port numbers. -.PP -To run dhcpd as a foreground process, rather than allowing it to run -as a daemon in the background, the -.B -f -flag should be specified. This is useful when running dhcpd under a -debugger, or when running it out of inittab on System V systems. -.PP -To have dhcpd log to the standard error descriptor, specify the -.B -d -flag. This can be useful for debugging, and also at sites where a -complete log of all dhcp activity must be kept but syslogd is not -reliable or otherwise cannot be used. Normally, dhcpd will log all -output using the syslog(3) function with the log facility set to -LOG_DAEMON. -.PP -Dhcpd can be made to use an alternate configuration file with the -.B -cf +.Pp +To run +.Nm +as a foreground process, rather than allowing it to run as a daemon in the +background, the +.Fl f +flag should be specified. +This is useful when running +.Nm +under a debugger, or when running it out of inittab on System V systems. +.Pp +To have +.Nm +log to +.Ar stderr , +the +.Fl d +flag should be specified. +This can be useful for debugging, and also at sites where a complete log of +all dhcp activity must be kept, but +.Xr syslogd 8 +is not reliable or otherwise cannot be used. +Normally, +.Nm +will log all output using the +.Xr syslog 3 +function with the log facility set to LOG_DAEMON. +.Pp +.Nm +can be made to use an alternate configuration file with the +.Fl cf flag, or an alternate lease file with the -.B -lf -flag. Because of the importance of using the same lease database at -all times when running dhcpd in production, these options should be -used \fBonly\fR for testing lease files or database files in a -non-production environment. -.PP -When starting dhcpd up from a system startup script (e.g., /etc/rc), -it may not be desirable to print out the entire copyright message on -startup. To avoid printing this message, the -.B -q -flag may be specified. -.SH CONFIGURATION -The syntax of the dhcpd.conf(5) file is discussed separately. This -section should be used as an overview of the configuration process, -and the dhcpd.conf(5) documentation should be consulted for detailed -reference information. -.PP -.SH Subnets -dhcpd needs to know the subnet numbers and netmasks of all subnets for -which it will be providing service. In addition, in order to -dynamically allocate addresses, it must be assigned one or more ranges -of addresses on each subnet which it can in turn assign to client -hosts as they boot. Thus, a very simple configuration providing DHCP -support might look like this: -.nf -.sp 1 - subnet 239.252.197.0 netmask 255.255.255.0 { - range 239.252.197.10 239.252.197.250; - } -.fi -.PP +.Fl lf +flag. +Because of the importance of using the same lease database at all times when +running +.Nm +in production, these options should be used +.Em only +for testing lease files or database files in a non-production environment. +.Pp +To avoid printing out the entire copyright message on start-up, the +.Fl q +flag should be specified. +.Sh CONFIGURATION +The syntax of the +.Xr dhcpd.conf 5 +file is discussed separately. +This section should be used as an overview of the configuration process, +and the +.Xr dhcpd.conf 5 +documentation should be consulted for detailed reference information. +.Bl -tag -width 3n +.It Subnets +.Nm +needs to know the subnet numbers and netmasks of all subnets for +which it will be providing service. +In addition, in order to dynamically allocate addresses, it must be assigned +one or more ranges of addresses on each subnet which it can in turn assign +to client hosts as they boot. +Thus, a very simple configuration providing DHCP support might look like this: +.Pp +.Bd -literal -offset indent +subnet 239.252.197.0 netmask 255.255.255.0 { + range 239.252.197.10 239.252.197.250; +} +.Ed +.Pp Multiple address ranges may be specified like this: -.nf -.sp 1 - subnet 239.252.197.0 netmask 255.255.255.0 { - range 239.252.197.10 239.252.197.107; - range 239.252.197.113 239.252.197.250; - } -.fi -.PP +.Pp +.Bd -literal -offset indent +subnet 239.252.197.0 netmask 255.255.255.0 { + range 239.252.197.10 239.252.197.107; + range 239.252.197.113 239.252.197.250; +} +.Ed +.Pp If a subnet will only be provided with BOOTP service and no dynamic address assignment, the range clause can be left out entirely, but the subnet statement must appear. -.PP -.SH Lease Lengths -DHCP leases can be assigned almost any length from zero seconds to -infinity. What lease length makes sense for any given subnet, or for -any given installation, will vary depending on the kinds of hosts -being served. -.PP +.It Lease Lengths +DHCP leases can be assigned almost any length from zero seconds to infinity. +What lease length makes sense for any given subnet, or for any given +installation, will vary depending on the kinds of hosts being served. +.Pp For example, in an office environment where systems are added from time to time and removed from time to time, but move relatively -infrequently, it might make sense to allow lease times of a month of -more. In a final test environment on a manufacturing floor, it may -make more sense to assign a maximum lease length of 30 minutes - -enough time to go through a simple test procedure on a network -appliance before packaging it up for delivery. -.PP +infrequently, it might make sense to allow lease times of a month of more. +In a final test environment on a manufacturing floor, it may make more sense +to assign a maximum lease length of 30 minutes \- enough time to go through a +simple test procedure on a network appliance before packaging it up for +delivery. +.Pp It is possible to specify two lease lengths: the default length that will be assigned if a client doesn't ask for any particular lease -length, and a maximum lease length. These are specified as clauses -to the subnet command: -.nf -.sp 1 - subnet 239.252.197.0 netmask 255.255.255.0 { - range 239.252.197.10 239.252.197.107; - default-lease-time 600; - max-lease-time 7200; - } -.fi -.PP +length, and a maximum lease length. +These are specified as clauses to the subnet command: +.Pp +.Bd -literal -offset indent +subnet 239.252.197.0 netmask 255.255.255.0 { + range 239.252.197.10 239.252.197.107; + default-lease-time 600; + max-lease-time 7200; +} +.Ed +.Pp This particular subnet declaration specifies a default lease time of 600 seconds (ten minutes), and a maximum lease time of 7200 seconds -(two hours). Other common values would be 86400 (one day), 604800 -(one week) and 2592000 (30 days). -.PP -Each subnet need not have the same lease\(emin the case of an office +(two hours). +Other common values would be 86400 (one day), 604800 (one week) +and 2592000 (30 days). +.Pp +Each subnet need not have the same lease \- in the case of an office environment and a manufacturing environment served by the same DHCP server, it might make sense to have widely disparate values for default and maximum lease times on each subnet. -.SH BOOTP Support -Each BOOTP client must be explicitly declared in the dhcpd.conf -file. A very basic client declaration will specify the client -network interface's hardware address and the IP address to assign to -that client. If the client needs to be able to load a boot file from -the server, that file's name must be specified. A simple bootp -client declaration might look like this: -.nf -.sp 1 - host haagen { - hardware ethernet 08:00:2b:4c:59:23; - fixed-address 239.252.197.9; - filename "/tftpboot/haagen.boot"; - } -.fi -.SH Options +.It BOOTP Support +Each BOOTP client must be explicitly declared in the +.Xr dhcpd.conf 5 +file. +A very basic client declaration will specify the client network interface's +hardware address and the IP address to assign to that client. +If the client needs to be able to load a boot file from the server, +that file's name must be specified. +A simple BOOTP client declaration might look like this: +.Pp +.Bd -literal -offset indent +host haagen { + hardware ethernet 08:00:2b:4c:59:23; + fixed-address 239.252.197.9; + filename "/tftpboot/haagen.boot"; +} +.Ed +.It Options DHCP (and also BOOTP with Vendor Extensions) provides a mechanism whereby the server can provide the client with information about how to configure its network interface (e.g., subnet mask), and also how the client can access various network services (e.g., DNS, IP routers, and so on). -.PP +.Pp These options can be specified on a per-subnet basis, and, for BOOTP -clients, also on a per-client basis. In the event that a BOOTP -client declaration specifies options that are also specified in its -subnet declaration, the options specified in the client declaration -take precedence. An reasonably complete DHCP configuration might -look something like this: -.nf -.sp 1 - subnet 239.252.197.0 netmask 255.255.255.0 { - range 239.252.197.10 239.252.197.250; - default-lease-time 600 max-lease-time 7200; - option subnet-mask 255.255.255.0; - option broadcast-address 239.252.197.255; - option routers 239.252.197.1; - option domain-name-servers 239.252.197.2, 239.252.197.3; - option domain-name "isc.org"; - } -.fi -.PP -A bootp host on that subnet that needs to be in a different domain and +clients, also on a per-client basis. +In the event that a BOOTP client declaration specifies options that are +also specified in its subnet declaration, the options specified in the +client declaration take precedence. +A reasonably complete DHCP configuration might look something like this: +.Pp +.Bd -literal -offset indent +subnet 239.252.197.0 netmask 255.255.255.0 { + range 239.252.197.10 239.252.197.250; + default-lease-time 600 max-lease-time 7200; + option subnet-mask 255.255.255.0; + option broadcast-address 239.252.197.255; + option routers 239.252.197.1; + option domain-name-servers 239.252.197.2, 239.252.197.3; + option domain-name "isc.org"; +} +.Ed +.Pp +A BOOTP host on that subnet that needs to be in a different domain and use a different name server might be declared as follows: -.nf -.sp 1 - host haagen { - hardware ethernet 08:00:2b:4c:59:23; - fixed-address 239.252.197.9; - filename "/tftpboot/haagen.boot"; - option domain-name-servers 192.5.5.1; - option domain-name "vix.com"; - } -.fi -.PP -A more complete description of the dhcpd.conf file syntax is provided -in dhcpd.conf(5). -.SH FILES -.B /etc/dhcpd.conf, /var/db/dhcpd.leases, /var/run/dhcpd.pid, -.B /var/db/dhcpd.leases~. -.SH SEE ALSO -dhcpd.conf(5), dhcpd.leases(5), dhclient(8), dhcp(8), dhcrelay(8) -.SH AUTHOR -.B dhcpd(8) -was written by Ted Lemon <mellon@vix.com> -under a contract with Vixie Labs. Funding -for this project was provided by the Internet Software Corporation. +.Pp +.Bd -literal -offset indent +host haagen { + hardware ethernet 08:00:2b:4c:59:23; + fixed-address 239.252.197.9; + filename "/tftpboot/haagen.boot"; + option domain-name-servers 192.5.5.1; + option domain-name "vix.com"; +} +.Ed +.El +.Pp +A more complete description of the +.Pa dhcpd.conf +file syntax is provided in +.Xr dhcpd.conf 5 . +.Sh FILES +.Bl -tag -width "/var/db/dhcpd.leases~ " -compact +.It /etc/dhcpd.conf +DHCPD configuration file. +.It /var/db/dhcpd.leases +Current DHCPD lease file. +.It /var/db/dhcpd.leases~ +Backup DHCPD lease file. +.It /var/run/dhcpd.pid +DHCPD PID. +.El +.Sh SEE ALSO +.Xr dhcpd.conf 5 , +.Xr dhcpd.leases 5 , +.Xr dhclient 8 , +.Xr dhcp 8 , +.Xr dhcrelay 8 +.Sh AUTHORS +.Nm +was written by +.An Ted Lemon Aq mellon@vix.com +under a contract with Vixie Labs. +Funding for this project was provided by the Internet Software Corporation. Information about the Internet Software Consortium can be found at -.B http://www.isc.org/. +.Pa http://www.isc.org/ . +.Sh BUGS +We realize that it would be nice if one could send a SIGHUP to the server +and have it reload the database. +This is not technically impossible, but it would require a great deal of work, +our resources are extremely limited, and they can be better spent elsewhere. +So please don't complain about this on the mailing list unless you're prepared +to fund a project to implement this feature, or prepared to do it yourself. diff --git a/usr.sbin/dhcp/server/dhcpd.conf.5 b/usr.sbin/dhcp/server/dhcpd.conf.5 index 78063db1728..3f2e86e6bcb 100644 --- a/usr.sbin/dhcp/server/dhcpd.conf.5 +++ b/usr.sbin/dhcp/server/dhcpd.conf.5 @@ -1,4 +1,4 @@ -.\" dhcpd.conf.5 +.\" $OpenBSD: dhcpd.conf.5,v 1.10 2003/06/25 09:27:57 jmc Exp $ .\" .\" Copyright (c) 1995, 1996, 1997, 1998, 1998, 1999 .\" The Internet Software Consortium. All rights reserved. @@ -35,221 +35,273 @@ .\" Enterprises. To learn more about the Internet Software Consortium, .\" see ``http://www.isc.org/isc''. To learn more about Vixie .\" Enterprises, see ``http://www.vix.com''. -.TH dhcpd.conf 5 -.SH NAME -dhcpd.conf - dhcpd configuration file -.SH DESCRIPTION -The dhcpd.conf file contains configuration information for -.IR dhcpd, +.\" +.Dd January 1, 1995 +.Dt DHCPD.CONF 5 +.Os +.Sh NAME +.Nm dhcpd.conf +.Nd dhcpd configuration file +.Sh DESCRIPTION +The +.Nm +file contains configuration information for +.Xr dhcpd 8 , the Internet Software Consortium DHCP Server. -.PP -The dhcpd.conf file is a free-form ASCII text file. It is parsed by -the recursive-descent parser built into dhcpd. The file may contain -extra tabs and newlines for formatting purposes. Keywords in the file -are case-insensitive. Comments may be placed anywhere within the -file (except within quotes). Comments begin with the # character and -end at the end of the line. -.PP -The file essentially consists of a list of statements. Statements -fall into two broad categories - parameters and declarations. -.PP -Parameter statements either say how to do something (e.g., how long a -lease to offer), whether to do something (e.g., should dhcpd provide -addresses to unknown clients), or what parameters to provide to the +.Pp +The +.Nm +file is a free-form ASCII text file. +It is parsed by the recursive-descent parser built into +.Xr dhcpd 8 . +The file may contain extra tabs and newlines for formatting purposes. +Keywords in the file are case-insensitive. +Comments may be placed anywhere within the file (except within quotes). +Comments begin with the +.Sq # +character and end at the end of the line. +.Pp +The file essentially consists of a list of statements. +Statements fall into two broad categories \- parameters and declarations. +.Pp +Parameter statements say how to do something (e.g., how long a +lease to offer), whether to do something (e.g., should +.Xr dhcpd 8 +provide addresses to unknown clients), or what parameters to provide to the client (e.g., use gateway 220.177.244.7). -.PP +.Pp Declarations are used to describe the topology of the network, to describe clients on the network, to provide addresses that can be assigned to clients, or to apply a group of parameters to a -group of declarations. In any group of parameters and declarations, -all parameters must be specified before any declarations which depend -on those parameters may be specified. -.PP +group of declarations. +In any group of parameters and declarations, all parameters must be specified +before any declarations which depend on those parameters may be specified. +.Pp Declarations about network topology include the - \fIshared-network\fR and the \fIsubnet\fR -declarations. If clients on a subnet are to be assigned addresses -dynamically, a \fIrange\fR declaration must appear within the -\fIsubnet\fR declaration. For clients with statically assigned -addresses, or for installations where only known clients will be -served, each such client must have a \fIhost\fR declaration. If -parameters are to be applied to a group of declarations which are not -related strictly on a per-subnet basis, the \fIgroup\fR declaration -can be used. -.PP +.Ic shared-network +and the +.Ic subnet +declarations. +If clients on a subnet are to be assigned addresses dynamically, a +.Ic range +declaration must appear within the +.Ic subnet +declaration. +For clients with statically assigned addresses, or for installations where +only known clients will be served, each such client must have a +.Ic host +declaration. +If parameters are to be applied to a group of declarations which are not +related strictly on a per-subnet basis, the +.Ic group +declaration can be used. +.Pp For every subnet which will be served, and for every subnet -to which the dhcp server is connected, there must be one \fIsubnet\fR -declaration, which tells dhcpd how to recognize that an address is on -that subnet. A \fIsubnet\fR declaration is required for each subnet -even if no addresses will be dynamically allocated on that subnet. -.PP +to which the dhcp server is connected, there must be one +.Ic subnet +declaration, which tells +.Xr dhcpd 8 +how to recognize that an address is on that subnet. +A +.Ic subnet +declaration is required for each subnet even if no addresses will be +dynamically allocated on that subnet. +.Pp Some installations have physical networks on which more than one IP -subnet operates. For example, if there is a site-wide requirement -that 8-bit subnet masks be used, but a department with a single -physical ethernet network expands to the point where it has more than -254 nodes, it may be necessary to run two 8-bit subnets on the same -ethernet until such time as a new physical network can be added. In -this case, the \fIsubnet\fR declarations for these two networks may be -enclosed in a \fIshared-network\fR declaration. -.PP +subnet operates. +For example, if there is a site-wide requirement that 8-bit subnet masks +be used, but a department with a single physical ethernet network expands +to the point where it has more than 254 nodes, it may be necessary to run +two 8-bit subnets on the same ethernet until such time as a new physical +network can be added. +In this case, the +.Ic subnet +declarations for these two networks may be enclosed in a +.Ic shared-network +declaration. +.Pp Some sites may have departments which have clients on more than one subnet, but it may be desirable to offer those clients a uniform set of parameters which are different than what would be offered to -clients from other departments on the same subnet. For clients which -will be declared explicitly with \fIhost\fR declarations, these -declarations can be enclosed in a \fIgroup\fR declaration along with -the parameters which are common to that department. For clients -whose addresses will be dynamically assigned, there is currently no +clients from other departments on the same subnet. +For clients which will be declared explicitly with +.Ic host +declarations, these declarations can be enclosed in a +.Ic group +declaration along with the parameters which are common to that department. +For clients whose addresses will be dynamically assigned, there is currently no way to group parameter assignments other than by network topology. -.PP +.Pp When a client is to be booted, its boot parameters are determined by -first consulting that client's \fIhost\fR declaration (if any), then -consulting the \fIgroup\fR declaration (if any) which enclosed that -\fIhost\fR declaration, then consulting the \fIsubnet\fR declaration -for the subnet on which the client is booting, then consulting the -\fIshared-network\fR declaration (if any) containing that subnet, and -finally consulting the top-level parameters which may be specified -outside of any declaration. -.PP -When dhcpd tries to find a \fIhost\fR declaration for a client, it -first looks for a \fIhost\fR declaration which has a -\fIfixed-address\fR parameter which matches the subnet or shared -network on which the client is booting. If it doesn't find any such -entry, it then tries to find an entry which has no \fIfixed-address\fR -parameter. If no such entry is found, then dhcpd acts as if there is -no entry in the dhcpd.conf file for that client, even if there is an -entry for that client on a different subnet or shared network. -.SH EXAMPLES -.PP -A typical dhcpd.conf file will look something like this: -.nf - -.I global parameters... +first consulting that client's +.Ic host +declaration (if any), then consulting the +.Ic group +declaration (if any) which enclosed that +.Ic host +declaration, then consulting the +.Ic subnet +declaration for the subnet on which the client is booting, then consulting the +.Ic shared-network +declaration (if any) containing that subnet, and finally consulting the +top-level parameters which may be specified outside of any declaration. +.Pp +When +.Xr dhcpd 8 +tries to find a +.Ic host +declaration for a client, it first looks for a +.Ic host +declaration which has a +.Ar fixed-address +parameter which matches the subnet or shared network on which the client +is booting. +If it doesn't find any such entry, it then tries to find an entry which has no +.Ar fixed-address +parameter. +If no such entry is found, then +.Xr dhcpd 8 +acts as if there is no entry in the +.Nm +file for that client, even if there is an entry for that client on a +different subnet or shared network. +.Sh EXAMPLES +A typical +.Nm +file will look something like this: +.Pp +Example 1 +.Bd -unfilled -offset indent +.Ar global parameters... shared-network ISC-BIGGIE { - \fIshared-network-specific parameters...\fR +.Ar \ \&\ \&shared-network-specific parameters... subnet 204.254.239.0 netmask 255.255.255.224 { - \fIsubnet-specific parameters...\fR +.Ar \ \&\ \&\ \&\ \&subnet-specific parameters... range 204.254.239.10 204.254.239.30; } subnet 204.254.239.32 netmask 255.255.255.224 { - \fIsubnet-specific parameters...\fR +.Ar \ \&\ \&\ \&\ \&subnet-specific parameters... range 204.254.239.42 204.254.239.62; } } subnet 204.254.239.64 netmask 255.255.255.224 { - \fIsubnet-specific parameters...\fR +.Ar \ \&\ \&subnet-specific parameters... range 204.254.239.74 204.254.239.94; } group { - \fIgroup-specific parameters...\fR +.Ar \ \&\ \&group-specific parameters... host zappo.test.isc.org { - \fIhost-specific parameters...\fR +.Ar \ \&\ \&\ \&\ \&host-specific parameters... } host beppo.test.isc.org { - \fIhost-specific parameters...\fR +.Ar \ \&\ \&\ \&\ \&host-specific parameters... } host harpo.test.isc.org { - \fIhost-specific parameters...\fR +.Ar \ \&\ \&\ \&\ \&host-specific parameters... } } - -.ce 1 -Figure 1 - -.fi -.PP +.Ed +.Pp Notice that at the beginning of the file, there's a place -for global parameters. These might be things like the organization's -domain name, the addresses of the name servers (if they are common to -the entire organization), and so on. So, for example: -.nf - - option domain-name "isc.org"; - option domain-name-servers ns1.isc.org, ns2.isc.org; - -.ce 1 -Figure 2 -.fi -.PP -As you can see in Figure 2, it's legal to specify host addresses in -parameters as domain names rather than as numeric IP addresses. If a -given hostname resolves to more than one IP address (for example, if +for global parameters. +These might be things like the organization's domain name, +the addresses of the name servers +(if they are common to the entire organization), and so on. +So, for example: +.Pp +Example 2 +.Bd -literal -offset indent +option domain-name \&"isc.org\&"; +option domain-name-servers ns1.isc.org, ns2.isc.org; +.Ed +.Pp +As you can see in Example 2, it's legal to specify host addresses in +parameters as domain names rather than as numeric IP addresses. +If a given hostname resolves to more than one IP address (for example, if that host has two ethernet interfaces), both addresses are supplied to the client. -.PP -In Figure 1, you can see that both the shared-network statement and -the subnet statements can have parameters. Let us say that the -shared network \fIISC-BIGGIE\fR supports an entire department - -perhaps the accounting department. If accounting has its own domain, -then a shared-network-specific parameter might be: -.nf - - option domain-name "accounting.isc.org"; -.fi -.PP +.Pp +In Example 1, you can see that both the shared-network statement and +the subnet statements can have parameters. +Let us say that the shared network ISC-BIGGIE supports an entire department \- +perhaps the accounting department. +If accounting has its own domain, then a shared-network-specific parameter +might be: +.Pp +.Dl option domain-name \&"accounting.isc.org\&"; +.Pp All subnet declarations appearing in the shared-network declaration -would then have the domain-name option set to "accounting.isc.org" -instead of just "isc.org". -.PP +would then have the domain-name option set to +.Dq accounting.isc.org +instead of just +.Dq isc.org . +.Pp The most obvious reason for having subnet-specific parameters as -shown in Figure 1 is that each subnet, of necessity, has its own -router. So for the first subnet, for example, there should be -something like: -.nf - - option routers 204.254.239.1; -.fi -.PP -Note that the address here is specified numerically. This is not -required - if you have a different domain name for each interface on -your router, it's perfectly legitimate to use the domain name for that -interface instead of the numeric address. However, in many cases -there may be only one domain name for all of a router's IP addresses, and -it would not be appropriate to use that name here. -.PP -In Figure 1 there is also a \fIgroup\fR statement, which provides -common parameters for a set of three hosts - zappo, beppo and harpo. +shown in Example 1 is that each subnet, of necessity, has its own router. +So for the first subnet, for example, there should be something like: +.Pp +.Dl option routers 204.254.239.1; +.Pp +Note that the address here is specified numerically. +This is not required \- if you have a different domain name for each +interface on your router, it's perfectly legitimate to use the domain name +for that interface instead of the numeric address. +However, in many cases there may be only one domain name for all of a router's +IP addresses, and it would not be appropriate to use that name here. +.Pp +In Example 1 there is also a +.Ic group +statement, which provides common parameters for a set of three hosts \- zappo, +beppo and harpo. As you can see, these hosts are all in the test.isc.org domain, so it might make sense for a group-specific parameter to override the domain name supplied to these hosts: -.nf - - option domain-name "test.isc.org"; -.fi -.PP +.Pp +.Dl option domain-name \&"test.isc.org\&"; +.Pp Also, given the domain they're in, these are probably test machines. If we wanted to test the DHCP leasing mechanism, we might set the lease timeout somewhat shorter than the default: - -.nf - max-lease-time 120; - default-lease-time 120; -.fi -.PP +.Pp +.Bd -literal -offset indent +max-lease-time 120; +default-lease-time 120; +.Ed +.Pp You may have noticed that while some parameters start with the -\fIoption\fR keyword, some do not. Parameters starting with the -\fIoption\fR keyword correspond to actual DHCP options, while -parameters that do not start with the option keyword either control -the behaviour of the DHCP server (e.g., how long a lease dhcpd will -give out), or specify client parameters that are not optional in the +.Ic option +keyword, some do not. +Parameters starting with the +.Ic option +keyword correspond to actual DHCP options, while parameters that do not start +with the option keyword either control the behaviour of the DHCP server +(e.g., how long a lease +.Xr dhcpd 8 +will give out), or specify client parameters that are not optional in the DHCP protocol (for example, server-name and filename). -.PP -In Figure 1, each host had \fIhost-specific parameters\fR. These -could include such things as the \fIhostname\fR option, the name of a -file to upload (the \fIfilename\fR parameter) and the address of the -server from which to upload the file (the \fInext-server\fR -parameter). In general, any parameter can appear anywhere that -parameters are allowed, and will be applied according to the scope in -which the parameter appears. -.PP -Imagine that you have a site with a lot of NCD X-Terminals. These -terminals come in a variety of models, and you want to specify the -boot files for each model. One way to do this would be to have host -declarations for each server and group them by model: -.nf - +.Pp +In Example 1, each host had +.Ar host-specific parameters . +These could include such things as the +.Ic hostname +option, the name of a file to upload (the +.Ar filename +parameter) and the address of the server from which to upload the file (the +.Ar next-server +parameter). +In general, any parameter can appear anywhere that parameters are allowed, +and will be applied according to the scope in which the parameter appears. +.Pp +Imagine that you have a site with a lot of NCD X-Terminals. +These terminals come in a variety of models, and you want to specify the +boot files for each model. +One way to do this would be to have host declarations for each server +and group them by model: +.Pp +.Bd -literal -offset indent group { filename "Xncd19r"; next-server ncd-booter; @@ -271,510 +323,626 @@ group { filename "XncdHMX"; next-server ncd-booter; - host ncd1 { hardware ethernet 0:c0:c3:11:90:23; } - host ncd4 { hardware ethernet 0:c0:c3:91:a7:8; } - host ncd8 { hardware ethernet 0:c0:c3:cc:a:8f; } + host ncd5 { hardware ethernet 0:c0:c3:11:90:23; } + host ncd6 { hardware ethernet 0:c0:c3:91:a7:8; } + host ncd7 { hardware ethernet 0:c0:c3:cc:a:8f; } +} +.Ed +.Sh REFERENCE: DECLARATIONS +The +.Ic shared-network +statement +.Pp +.Bd -unfilled -offset indent +.Ic shared-network Ar name No { +.Pf \ \&\ \& Op Ar parameters +.Pf \ \&\ \& Op Ar declarations } -.fi -.SH REFERENCE: DECLARATIONS -.PP -.B The -.I shared-network -.B statement -.PP -.nf - \fBshared-network\fR \fIname\fR \fB{\fR - [ \fIparameters\fR ] - [ \fIdeclarations\fR ] - \fB}\fR -.fi -.PP -The \fIshared-network\fR statement is used to inform the DHCP server -that some IP subnets actually share the same physical network. Any -subnets in a shared network should be declared within a -\fIshared-network\fR statement. Parameters specified in the -\fIshared-network\fR statement will be used when booting clients on -those subnets unless parameters provided at the subnet or host level -override them. If any subnet in a shared network has addresses -available for dynamic allocation, those addresses are collected into a -common pool for that shared network and assigned to clients as needed. +.Ed +.Pp +The +.Ic shared-network +statement is used to inform the DHCP server that some IP subnets actually +share the same physical network. +Any subnets in a shared network should be declared within a +.Ic shared-network +statement. +Parameters specified in the +.Ic shared-network +statement will be used when booting clients on those subnets unless +parameters provided at the subnet or host level override them. +If any subnet in a shared network has addresses available for dynamic +allocation, those addresses are collected into a common pool for that +shared network and assigned to clients as needed. There is no way to distinguish on which subnet of a shared network a client should boot. -.PP -.I Name -should be the name of the shared network. This name is used when -printing debugging messages, so it should be descriptive for the -shared network. The name may have the syntax of a valid domain name +.Pp +.Ar name +should be the name of the shared network. +This name is used when printing debugging messages, so it should be +descriptive for the shared network. +The name may have the syntax of a valid domain name (although it will never be used as such), or it may be any arbitrary name, enclosed in quotes. -.PP -.B The -.I subnet -.B statement -.PP -.nf - \fBsubnet\fR \fIsubnet-number\fR \fBnetmask\fR \fInetmask\fR \fB{\fR - [ \fIparameters\fR ] - [ \fIdeclarations\fR ] - \fB}\fR -.fi -.PP -The \fIsubnet\fR statement is used to provide dhcpd with enough -information to tell whether or not an IP address is on that subnet. +.Pp +The +.Ic subnet +statement +.Pp +.Bd -unfilled -offset indent +.Ic subnet Ar subnet-number Ic netmask Ar netmask No { +.Pf \ \&\ \& Op Ar parameters +.Pf \ \&\ \& Op Ar declarations +} +.Ed +.Pp +The +.Ic subnet +statement is used to provide +.Xr dhcpd 8 +with enough information to tell whether or not an IP address is on that subnet. It may also be used to provide subnet-specific parameters and to specify what addresses may be dynamically allocated to clients booting -on that subnet. Such addresses are specified using the \fIrange\fR +on that subnet. +Such addresses are specified using the +.Ic range declaration. -.PP +.Pp The -.I subnet-number +.Ar subnet-number should be an IP address or domain name which resolves to the subnet -number of the subnet being described. The -.I netmask +number of the subnet being described. +The +.Ar netmask should be an IP address or domain name which resolves to the subnet mask -of the subnet being described. The subnet number, together with the -netmask, are sufficient to determine whether any given IP address is -on the specified subnet. -.PP +of the subnet being described. +The subnet number, together with the netmask, are sufficient to determine +whether any given IP address is on the specified subnet. +.Pp Although a netmask must be given with every subnet declaration, it is recommended that if there is any variance in subnet masks at a site, a subnet-mask option statement be used in each subnet declaration to set the desired subnet mask, since any subnet-mask option statement will override the subnet mask declared in the subnet statement. -.PP -.B The -.I range -.B statement -.PP -.nf - \fBrange\fR [ \fBdynamic-bootp\fR ] \fIlow-address\fR [ \fIhigh-address\fR]\fB;\fR -.fi -.PP +.Pp +The +.Ic range +statement +.Pp +.Xo +.Ic range Op Ic dynamic-bootp +.Ar low-address Oo Ar high-address Oc ; +.Xc +.Pp For any subnet on which addresses will be assigned dynamically, there -must be at least one \fIrange\fR statement. The range statement -gives the lowest and highest IP addresses in a range. All IP -addresses in the range should be in the subnet in which the -\fIrange\fR statement is declared. The \fIdynamic-bootp\fR flag may -be specified if addresses in the specified range may be dynamically -assigned to BOOTP clients as well as DHCP clients. When specifying a -single address, \fIhigh-address\fR can be omitted. -.PP -.B The -.I host -.B statement -.PP -.nf - \fBhost\fR \fIhostname\fR { - [ \fIparameters\fR ] - [ \fIdeclarations\fR ] - \fB}\fR -.fi -.PP +must be at least one +.Ic range +statement. +The range statement gives the lowest and highest IP addresses in a range. +All IP addresses in the range should be in the subnet in which the +.Ic range +statement is declared. +The +.Ic dynamic-bootp +flag may be specified if addresses in the specified range may be dynamically +assigned to BOOTP clients as well as DHCP clients. +When specifying a single address, +.Ar high-address +can be omitted. +.Pp +The +.Ic host +statement +.Pp +.Bd -unfilled -offset indent +.Ic host Ar hostname No { +.Pf \ \&\ \& Op Ar parameters +.Pf \ \&\ \& Op Ar declarations +} +.Ed +.Pp There must be at least one -.B host -statement for every BOOTP client that is to be served. -.B host +.Ic host +statement for every BOOTP client that is to be served. +.Ic host statements may also be specified for DHCP clients, although this is not required unless booting is only enabled for known hosts. -.PP +.Pp If it is desirable to be able to boot a DHCP or BOOTP client on more than one subnet with fixed addresses, more than one address may be specified in the -.I fixed-address +.Ar fixed-address parameter, or more than one -.B host +.Ic host statement may be specified. -.PP +.Pp If client-specific boot parameters must change based on the network -to which the client is attached, then multiple -.B host -statements should -be used. -.PP +to which the client is attached, then multiple +.Ic host +statements should be used. +.Pp If a client is to be booted using a fixed address if it's possible, but should be allocated a dynamic address otherwise, then a -.B host +.Ic host statement must be specified without a -.B fixed-address +.Ar fixed-address clause. -.I hostname -should be a name identifying the host. If a \fIhostname\fR option is -not specified for the host, \fIhostname\fR is used. -.PP -\fIHost\fR declarations are matched to actual DHCP or BOOTP clients -by matching the \fRdhcp-client-identifier\fR option specified in the -\fIhost\fR declaration to the one supplied by the client, or, if the -\fIhost\fR declaration or the client does not provide a -\fRdhcp-client-identifier\fR option, by matching the \fIhardware\fR -parameter in the \fIhost\fR declaration to the network hardware -address supplied by the client. BOOTP clients do not normally -provide a \fIdhcp-client-identifier\fR, so the hardware address must -be used for all clients that may boot using the BOOTP protocol. -.PP -.B The -.I group -.B statement -.PP -.nf - \fBgroup\fR { - [ \fIparameters\fR ] - [ \fIdeclarations\fR ] - \fB}\fR -.fi -.PP -The group statement is used simply to apply one or more parameters to -a group of declarations. It can be used to group hosts, shared -networks, subnets, or even other groups. -.SH REFERENCE: ALLOW and DENY -.PP -The -.I allow +.Ar hostname +should be a name identifying the host. +If a +.Ar hostname +option is not specified for the host, +.Ar hostname +is used. +.Pp +.Ic host +declarations are matched to actual DHCP or BOOTP clients by matching the +.Ic dhcp-client-identifier +option specified in the +.Ic host +declaration to the one supplied by the client, or, if the +.Ic host +declaration or the client does not provide a +.Ic dhcp-client-identifier +option, by matching the +.Ar hardware +parameter in the +.Ic host +declaration to the network hardware address supplied by the client. +BOOTP clients do not normally provide a +.Ar dhcp-client-identifier , +so the hardware address must be used for all clients that may boot using +the BOOTP protocol. +.Pp +The +.Ic group +statement +.Pp +.Bd -unfilled -offset indent +.Ic group No { +.Pf \ \&\ \& Op Ar parameters +.Pf \ \&\ \& Op Ar declarations +} +.Ed +.Pp +The +.Ic group +statement is used simply to apply one or more parameters to a group of +declarations. +It can be used to group hosts, shared networks, subnets, or even other groups. +.Sh REFERENCE: ALLOW and DENY +The +.Ic allow and -.I deny -statements can be used to control the behaviour of dhcpd to various -sorts of requests. -.PP -.PP -.B The -.I unknown-clients -.B keyword -.PP - \fBallow unknown-clients;\fR - \fBdeny unknown-clients;\fR -.PP -The \fBunknown-clients\fR flag is used to tell dhcpd whether -or not to dynamically assign addresses to unknown clients. Dynamic -address assignment to unknown clients is \fBallow\fRed by default. -.PP -.B The -.I bootp -.B keyword -.PP - \fBallow bootp;\fR - \fBdeny bootp;\fR -.PP -The \fBbootp\fR flag is used to tell dhcpd whether -or not to respond to bootp queries. Bootp queries are \fBallow\fRed -by default. -.PP -.B The -.I booting -.B keyword -.PP - \fBallow booting;\fR - \fBdeny booting;\fR -.PP -The \fBbooting\fR flag is used to tell dhcpd whether or not to respond -to queries from a particular client. This keyword only has meaning -when it appears in a host declaration. By default, booting is -\fBallow\fRed, but if it is disabled for a particular client, then -that client will not be able to get an address from the DHCP server. -.SH REFERENCE: PARAMETERS -.PP -.B The -.I default-lease-time -.B statement -.PP - \fBdefault-lease-time\fR \fItime\fR\fB;\fR -.PP -.I Time +.Ic deny +statements can be used to control the behaviour of +.Xr dhcpd 8 +to various sorts of requests. +.Pp +The +.Ar unknown-clients +keyword +.Pp +.Bd -literal -offset indent +allow unknown-clients; +deny unknown-clients; +.Ed +.Pp +The +.Ar unknown-clients +flag is used to tell +.Xr dhcpd 8 +whether or not to dynamically assign addresses to unknown clients. +Dynamic address assignment to unknown clients is allowed by default. +.Pp +The +.Ar bootp +keyword +.Pp +.Bd -literal -offset indent +allow bootp; +deny bootp; +.Ed +.Pp +The +.Ar bootp +flag is used to tell +.Xr dhcpd 8 +whether or not to respond to bootp queries. +Bootp queries are allowed by default. +.Pp +The +.Ar booting +keyword +.Pp +.Bd -literal -offset indent +allow booting; +deny booting; +.Ed +.Pp +The +.Ar booting +flag is used to tell +.Xr dhcpd 8 +whether or not to respond to queries from a particular client. +This keyword only has meaning when it appears in a host declaration. +By default, booting is allowed, but if it is disabled for a particular client, +then that client will not be able to get an address from the DHCP server. +.Sh REFERENCE: PARAMETERS +The +.Ic default-lease-time +statement +.Pp +.D1 Ic default-lease-time Ar time ; +.Pp +.Ar time should be the length in seconds that will be assigned to a lease if -the client requesting the lease does not ask for a specific expiration -time. -.PP -.B The -.I max-lease-time -.B statement -.PP - \fBmax-lease-time\fR \fItime\fR\fB;\fR -.PP -.I Time +the client requesting the lease does not ask for a specific expiration time. +.Pp +The +.Ic max-lease-time +statement +.Pp +.D1 Ic max-lease-time Ar time ; +.Pp +.Ar time should be the maximum length in seconds that will be assigned to a -lease if the client requesting the lease asks for a specific -expiration time. -.PP -.B The -.I hardware -.B statement -.PP - \fBhardware\fR \fIhardware-type\fR \fIhardware-address\fR\fB;\fR -.PP +lease if the client requesting the lease asks for a specific expiration time. +.Pp +The +.Ic hardware +statement +.Pp +.D1 Ic hardware Ar hardware-type hardware-address ; +.Pp In order for a BOOTP client to be recognized, its network hardware -address must be declared using a \fIhardware\fR clause in the -.I host +address must be declared using a +.Ic hardware +clause in the +.Ic host statement. -.I hardware-type -must be the name of a physical hardware interface type. Currently, -only the -.B ethernet +.Ar hardware-type +must be the name of a physical hardware interface type. +Currently, only the +.Ar ethernet and -.B token-ring -types are recognized, although support for a -.B fddi +.Ar token-ring +types are recognized, although support for an +.Ar fddi hardware type (and others) would also be desirable. The -.I hardware-address +.Ar hardware-address should be a set of hexadecimal octets (numbers from 0 through ff) -separated by colons. The \fIhardware\fR statement may also be used -for DHCP clients. -.PP -.B The -.I filename -.B statement -.PP - \fBfilename\fR \fB"\fR\fIfilename\fR\fB";\fR -.PP -The \fIfilename\fR statement can be used to specify the name of the -initial boot file which is to be loaded by a client. The -.I filename +separated by colons. +The +.Ic hardware +statement may also be used for DHCP clients. +.Pp +The +.Ic filename +statement +.Pp +.D1 Ic filename Ar \&"filename\&" ; +.Pp +The +.Ic filename +statement can be used to specify the name of the initial boot file which +is to be loaded by a client. +The +.Ar filename should be a filename recognizable to whatever file transfer protocol the client can be expected to use to load the file. -.PP -.B The -.I server-name -.B statement -.PP - \fBserver-name\fR \fB"\fR\fIname\fR\fB";\fR -.PP -The \fIserver-name\fR statement can be used to inform the client of -the name of the server from which it is booting. \fIName\fR should -be the name that will be provided to the client. -.PP -.B The -.I next-server -.B statement -.PP - \fBnext-server\fR \fIserver-name\fR\fB;\fR -.PP -The \fInext-server\fR statement is used to specify the host address of +.Pp +The +.Ic server-name +statement +.Pp +.D1 Ic server-name Ar \&"name\&" ; +.Pp +The +.Ic server-name +statement can be used to inform the client of the name of the server +from which it is booting. +.Ar name +should be the name that will be provided to the client. +.Pp +The +.Ic next-server +statement +.Pp +.D1 Ic next-server Ar server-name ; +.Pp +The +.Ic next-server +statement is used to specify the host address of the server from which the initial boot file (specified in the -\fIfilename\fR statement) is to be loaded. \fIServer-name\fR should -be a numeric IP address or a domain name. If no \fInext-server\fR -parameter applies to a given client, the DHCP server's IP address is -used. -.PP -.B The -.I fixed-address -.B statement -.PP - \fBfixed-address\fR \fIaddress\fR [\fB,\fR \fIaddress\fR ... ]\fB;\fR -.PP -The \fIfixed-address\fR statement is used to assign one or more fixed -IP addresses to a client. It should only appear in a \fIhost\fR -declaration. If more than one address is supplied, then when the -client boots, it will be assigned the address which corresponds to the -network on which it is booting. If none of the addresses in the -\fIfixed-address\fR statement are on the network on which the client -is booting, that client will not match the \fIhost\fR declaration -containing that \fIfixed-address\fR statement. Each \fIaddress\fR +.Ic filename +statement) is to be loaded. +.Ar server-name +should be a numeric IP address or a domain name. +If no +.Ic next-server +parameter applies to a given client, the DHCP server's IP address is used. +.Pp +The +.Ic fixed-address +statement +.Pp +.Xo +.Ic \ \&fixed-address Ar address +.Op , Ar address ... ; +.Xc +.Pp +The +.Ic fixed-address +statement is used to assign one or more fixed IP addresses to a client. +It should only appear in a +.Ic host +declaration. +If more than one address is supplied, then when the client boots, it will be +assigned the address which corresponds to the network on which it is booting. +If none of the addresses in the +.Ic fixed-address +statement are on the network on which the client is booting, that client will +not match the +.Ic host +declaration containing that +.Ic fixed-address +statement. +Each +.Ar address should be either an IP address or a domain name which resolves to one or more IP addresses. -.PP -.B The -.I dynamic-bootp-lease-cutoff -.B statement -.PP - \fBdynamic-bootp-lease-cutoff\fR \fIdate\fR\fB;\fR -.PP -The \fIdynamic-bootp-lease-cutoff\fR statement sets the ending time -for all leases assigned dynamically to BOOTP clients. Because BOOTP -clients do not have any way of renewing leases, and don't know that -their leases could expire, by default dhcpd assignes infinite leases -to all BOOTP clients. However, it may make sense in some situations -to set a cutoff date for all BOOTP leases - for example, the end of a -school term, or the time at night when a facility is closed and all +.Pp +The +.Ic dynamic-bootp-lease-cutoff +statement +.Pp +.D1 Ic dynamic-bootp-lease-cutoff Ar date ; +.Pp +The +.Ic dynamic-bootp-lease-cutoff +statement sets the ending time for all leases assigned dynamically to +BOOTP clients. +Because BOOTP clients do not have any way of renewing leases, +and don't know that their leases could expire, by default +.Xr dhcpd 8 +assigns infinite leases to all BOOTP clients. +However, it may make sense in some situations to set a cutoff date for all +BOOTP leases \- for example, the end of a school term, +or the time at night when a facility is closed and all machines are required to be powered off. -.PP -.I Date -should be the date on which all assigned BOOTP leases will end. The -date is specified in the form: -.PP -.ce 1 -W YYYY/MM/DD HH:MM:SS -.PP -W is the day of the week expressed as a number -from zero (Sunday) to six (Saturday). YYYY is the year, including the -century. MM is the month expressed as a number from 1 to 12. DD is -the day of the month, counting from 1. HH is the hour, from zero to -23. MM is the minute and SS is the second. The time is always in -Universal Coordinated Time (UTC), not local time. -.PP -.B The -.I dynamic-bootp-lease-length -.B statement -.PP - \fBdynamic-bootp-lease-length\fR \fIlength\fR\fB;\fR -.PP -The \fIdynamic-bootp-lease-length\fR statement is used to set the -length of leases dynamically assigned to BOOTP clients. At some -sites, it may be possible to assume that a lease is no longer in +.Pp +.Ar date +should be the date on which all assigned BOOTP leases will end. +The date is specified in the form: +.Pp +.Dl W YYYY/MM/DD HH:MM:SS +.Pp +W is the day of the week expressed as a number from zero (Sunday) +to six (Saturday). +YYYY is the year, including the century. +MM is the month expressed as a number from 1 to 12. +DD is the day of the month, counting from 1. +HH is the hour, from zero to 23. +MM is the minute and SS is the second. +The time is always in Coordinated Universal Time (UTC), not local time. +.Pp +The +.Ic dynamic-bootp-lease-length +statement +.Pp +.D1 Ic dynamic-bootp-lease-length Ar length ; +.Pp +The +.Ic dynamic-bootp-lease-length +statement is used to set the length of leases dynamically assigned to +BOOTP clients. +At some sites, it may be possible to assume that a lease is no longer in use if its holder has not used BOOTP or DHCP to get its address within -a certain time period. The period is specified in \fIlength\fR as a -number of seconds. If a client reboots using BOOTP during the -timeout period, the lease duration is reset to \fIlength\fR, so a -BOOTP client that boots frequently enough will never lose its lease. -Needless to say, this parameter should be adjusted with extreme -caution. -.PP -.B The -.I get-lease-hostnames -.B statement -.PP - \fBget-lease-hostnames\fR \fIflag\fR\fB;\fR -.PP -The \fIget-lease-hostnames\fR statement is used to tell dhcpd whether -or not to look up the domain name corresponding to the IP address of +a certain time period. +The period is specified in +.Ar length +as a number of seconds. +If a client reboots using BOOTP during the timeout period, the lease +duration is reset to +.Ar length , +so a BOOTP client that boots frequently enough will never lose its lease. +Needless to say, this parameter should be adjusted with extreme caution. +.Pp +The +.Ic get-lease-hostnames +statement +.Pp +.D1 Ic get-lease-hostnames Ar flag ; +.Pp +The +.Ic get-lease-hostnames +statement is used to tell +.Xr dhcpd 8 +whether or not to look up the domain name corresponding to the IP address of each address in the lease pool and use that address for the DHCP -\fIhostname\fR option. If \fIflag\fR is true, then this lookup is -done for all addresses in the current scope. By default, or if -\fIflag\fR is false, no lookups are done. -.PP -.B The -.I use-host-decl-names -.B statement -.PP - \fBuse-host-decl-names\fR \fIflag\fR\fB;\fR -.PP -If the \fIuse-host-decl-names\fR parameter is true in a given scope, -then for every host declaration within that scope, the name provided -for the host declaration will be supplied to the client as its -hostname. So, for example, -.PP -.nf - group { - use-host-decl-names on; - - host joe { - hardware ethernet 08:00:2b:4c:29:32; - fixed-address joe.fugue.com; - } - } +.Ic hostname +option. +If +.Ar flag +is true, then this lookup is done for all addresses in the current scope. +By default, or if +.Ar flag +is false, no lookups are done. +.Pp +The +.Ic use-host-decl-names +statement +.Pp +.D1 Ic use-host-decl-names Ar flag ; +.Pp +If the +.Ic use-host-decl-names +parameter is true in a given scope, then for every host declaration within +that scope, the name provided for the host declaration will be supplied to +the client as its hostname. +So, for example, +.Pp +.Bd -literal -offset indent +group { + use-host-decl-names on; + host joe { + hardware ethernet 08:00:2b:4c:29:32; + fixed-address joe.fugue.com; + } +} +.Ed +.Pp is equivalent to - - host joe { - hardware ethernet 08:00:2b:4c:29:32; - fixed-address joe.fugue.com; - option host-name "joe"; - } -.fi -.PP -An \fIoption host-name\fR statement within a host declaration will -override the use of the name in the host declaration. -.PP -.B The -.I authoritative -.B statement -.PP - \fBauthoritative;\fR -.PP - \fBnot authoritative;\fR -.PP +.Pp +.Bd -literal -offset indent + host joe { +hardware ethernet 08:00:2b:4c:29:32; +fixed-address joe.fugue.com; + option host-name "joe"; + } +.Ed +.Pp +An +.Ic option host-name +statement within a host declaration will override the use of the name +in the host declaration. +.Pp +The +.Ic authoritative +statement +.Pp +.D1 Ic authoritative ; +.Pp +.D1 Ic not authoritative ; +.Pp The DHCP server will normally assume that the configuration information about a given network segment is known to be correct and -is authoritative. So if a client requests an IP address on a given -network segment that the server knows is not valid for that segment, -the server will respond with a DHCPNAK message, causing the client to -forget its IP address and try to get a new one. -.PP +is authoritative. +So if a client requests an IP address on a given network segment that the +server knows is not valid for that segment, the server will respond with a +DHCPNAK message, causing the client to forget its IP address and try to get +a new one. +.Pp If a DHCP server is being configured by somebody who is not the network administrator and who therefore does not wish to assert this -level of authority, then the statement "not authoritative" should be -written in the appropriate scope in the configuration file. -.PP -Usually, writing \fBnot authoritative;\fR at the top level of the file -should be sufficient. However, if a DHCP server is to be set up so -that it is aware of some networks for which it is authoritative and -some networks for which it is not, it may be more appropriate to -declare authority on a per-network-segment basis. -.PP +level of authority, then the statement +.Dq not authoritative +should be written in the appropriate scope in the configuration file. +.Pp +Usually, writing +.Em not authoritative; +at the top level of the file should be sufficient. +However, if a DHCP server is to be set up so that it is aware of some +networks for which it is authoritative and some networks for which it is not, +it may be more appropriate to declare authority on a per-network-segment basis. +.Pp Note that the most specific scope for which the concept of authority -makes any sense is the physical network segment - either a +makes any sense is the physical network segment \- either a shared-network statement or a subnet statement that is not contained -within a shared-network statement. It is not meaningful to specify -that the server is authoritative for some subnets within a shared -network, but not authoritative for others, nor is it meaningful to -specify that the server is authoritative for some host declarations -and not others. -.PP -.B The -.I use-lease-addr-for-default-route -.B statement -.PP - \fBuse-lease-addr-for-default-route\fR \fIflag\fR\fB;\fR -.PP -If the \fIuse-lease-addr-for-default-route\fR parameter is true in a -given scope, then instead of sending the value specified in the -routers option (or sending no value at all), the IP address of the -lease being assigned is sent to the client. This supposedly causes -Win95 machines to ARP for all IP addresses, which can be helpful if -your router is configured for proxy ARP. -.PP -If use-lease-addr-for-default-route is enabled and an option routers -statement are both in scope, the routers option will be preferred. +within a shared-network statement. +It is not meaningful to specify that the server is authoritative for some +subnets within a shared network, but not authoritative for others, +nor is it meaningful to specify that the server is authoritative for some +host declarations and not others. +.Pp +The +.Ic use-lease-addr-for-default-route +statement +.Pp +.D1 Ic use-lease-addr-for-default-route Ar flag ; +.Pp +If the +.Ic use-lease-addr-for-default-route +parameter is true in a given scope, then instead of sending the value +specified in the routers option (or sending no value at all), +the IP address of the lease being assigned is sent to the client. +This supposedly causes Win95 machines to ARP for all IP addresses, +which can be helpful if your router is configured for proxy ARP. +.Pp +If +.Ic use-lease-addr-for-default-route +is enabled and an option routers statement are both in scope, +the routers option will be preferred. The rationale for this is that in situations where you want to use this feature, you probably want it enabled for a whole bunch of -Windows 95 machines, and you want to override it for a few other -machines. Unfortunately, if the opposite happens to be true for your +Windows 95 machines, and you want to override it for a few other machines. +Unfortunately, if the opposite happens to be true for your site, you are probably better off not trying to use this flag. -.PP -.B The -.I always-reply-rfc1048 -.B statement -.PP - \fBalways-reply-rfc1048\fR \fIflag\fR\fB;\fR -.PP -Some BOOTP clients expect RFC1048-style responses, but do not follow -RFC1048 when sending their requests. You can tell that a client is -having this problem if it is not getting the options you have -configured for it and if you see in the server log the message -"(non-rfc1048)" printed with each BOOTREQUEST that is logged. -.PP -If you want to send rfc1048 options to such a client, you can set the -.B always-reply-rfc1048 +.Pp +The +.Ic always-reply-rfc1048 +statement +.Pp +.D1 Ic always-reply-rfc1048 Ar flag ; +.Pp +Some BOOTP clients expect RFC 1048-style responses, but do not follow +RFC 1048 when sending their requests. +You can tell that a client is having this problem if it is not getting +the options you have configured for it and if you see in the server log +the message +.Dq (non-rfc1048) +printed with each BOOTREQUEST that is logged. +.Pp +If you want to send RFC 1048 options to such a client, you can set the +.Ic always-reply-rfc1048 option in that client's host declaration, and the DHCP server will -respond with an RFC-1048-style vendor options field. This flag can -be set in any scope, and will affect all clients covered by that -scope. -.PP -.B The -.I server-identifier -.B statement -.PP - \fBserver-identifier \fIhostname\fR\fB;\fR -.PP -The server-identifier statement can be used to define the value that -is sent in the DHCP Server Identifier option for a given scope. The -value specified \fBmust\fR be an IP address for the DHCP server, and -must be reachable by all clients served by a particular scope. -.PP -The use of the server-identifier statement is not recommended - the only +respond with an RFC 1048-style vendor options field. +This flag can be set in any scope, and will affect all clients covered +by that scope. +.Pp +The +.Ic server-identifier +statement +.Pp +.D1 Ic server-identifier Ar hostname ; +.Pp +The +.Ic server-identifier +statement can be used to define the value that is sent in the +DHCP Server Identifier option for a given scope. +The value specified +.Em must +be an IP address for the DHCP server, and must be reachable by all +clients served by a particular scope. +.Pp +The use of the server-identifier statement is not recommended \- the only reason to use it is to force a value other than the default value to be -sent on occasions where the default value would be incorrect. The default -value is the first IP address associated with the physical network interface -on which the request arrived. -.PP +sent on occasions where the default value would be incorrect. +The default value is the first IP address associated with the physical +network interface on which the request arrived. +.Pp The usual case where the -\fIserver-identifier\fR statement needs to be sent is when a physical -interface has more than one IP address, and the one being sent by default -isn't appropriate for some or all clients served by that interface. +.Ic server-identifier +statement needs to be sent is when a physical interface has more than one +IP address, and the one being sent by default isn't appropriate for some +or all clients served by that interface. Another common case is when an alias is defined for the purpose of having a consistent IP address for the DHCP server, and it is desired that the clients use this IP address when contacting the server. -.PP -Supplying a value for the dhcp-server-identifier option is equivalent -to using the server-identifier statement. -.SH REFERENCE: OPTION STATEMENTS -.PP +.Pp +Supplying a value for the +.Ic dhcp-server-identifier +option is equivalent to using the +.Ic server-identifier +statement. +.Sh REFERENCE: OPTION STATEMENTS DHCP option statements are documented in the -.B dhcp-options(5) +.Xr dhcp-options 5 manual page. -.SH SEE ALSO -dhcpd.conf(5), dhcpd.leases(5), RFC2132, RFC2131. -.SH AUTHOR -.B dhcpd(8) -was written by Ted Lemon <mellon@vix.com> -under a contract with Vixie Labs. Funding -for this project was provided by the Internet Software Corporation. +.Sh SEE ALSO +.Xr dhcp-options 5 , +.Xr dhcpd.leases 5 , +.Xr dhcpd 8 +.Pp +RFC 2132, RFC 2131. +.Sh AUTHORS +.Xr dhcpd 8 +was written by +.An Ted Lemon Aq mellon@vix.com +under a contract with Vixie Labs. +Funding for this project was provided by the Internet Software Corporation. Information about the Internet Software Consortium can be found at -.B http://www.isc.org/isc. +.Pa http://www.isc.org/isc . diff --git a/usr.sbin/dhcp/server/dhcpd.leases.5 b/usr.sbin/dhcp/server/dhcpd.leases.5 index d01e7b17835..935a69dd200 100644 --- a/usr.sbin/dhcp/server/dhcpd.leases.5 +++ b/usr.sbin/dhcp/server/dhcpd.leases.5 @@ -1,4 +1,4 @@ -.\" dhcpd.leases.5 +.\" $OpenBSD: dhcpd.leases.5,v 1.7 2003/06/25 09:27:57 jmc Exp $ .\" .\" Copyright (c) 1997, 1998 The Internet Software Consortium. .\" All rights reserved. @@ -35,140 +35,188 @@ .\" Enterprises. To learn more about the Internet Software Consortium, .\" see ``http://www.isc.org/isc''. To learn more about Vixie .\" Enterprises, see ``http://www.vix.com''. -.TH dhcpd.leases 5 -.SH NAME -dhcpd.leases - DHCP client lease database -.SH DESCRIPTION +.\" +.Dd January 1, 1997 +.Dt DHCPD.LEASES 5 +.Os +.Sh NAME +.Nm dhcpd.leases +.Nd DHCP client lease database +.Sh DESCRIPTION The Internet Software Consortium DHCP Server keeps a persistent -database of leases that it has assigned. This database is a free-form -ASCII file containing a series of lease declarations. Every time a -lease is acquired, renewed or released, its new value is recorded at -the end of the lease file. So if more than one declaration appears -for a given lease, the last one in the file is the current one. -.PP -When dhcpd is first installed, there is no lease database. However, -dhcpd requires that a lease database be present before it will start. +database of leases that it has assigned. +This database is a free-form ASCII file containing a series of +lease declarations. +Every time a lease is acquired, renewed or released, its new value is +recorded at the end of the lease file. +So if more than one declaration appears for a given lease, +the last one in the file is the current one. +.Pp +When +.Xr dhcpd 8 +is first installed, there is no lease database. +However, dhcpd requires that a lease database be present before it will start. To make the initial lease database, just create an empty file called -/var/db/dhcpd.leases. -.PP +.Pa /var/db/dhcpd.leases . +.Pp In order to prevent the lease database from growing without bound, the -file is rewritten from time to time. First, a temporary lease -database is created and all known leases are dumped to it. Then, the -old lease database is renamed /var/db/dhcpd.leases~. Finally, the -newly written lease database is moved into place. -.PP +file is rewritten from time to time. +First, a temporary lease database is created and all known leases are +dumped to it. +Then, the old lease database is renamed +.Pa /var/db/dhcpd.leases~ . +Finally, the newly written lease database is moved into place. +.Pp There is a window of vulnerability where if the dhcpd process is killed or the system crashes after the old lease database has been renamed but before the new one has been moved into place, there will -be no /var/db/dhcpd.leases. In this case, dhcpd will refuse to start, -and will require manual intervention. \fBDO NOT\fR simply create a -new lease file when this happens - if you do, you will lose all your -old bindings, and chaos will ensue. Instead, rename -/var/db/dhcpd.leases~ to /var/db/dhcpd.leases, restoring the old, valid -lease file, and then start dhcpd. This guarantees that a valid lease -file will be restored. -.SH FORMAT +be no +.Pa /var/db/dhcpd.leases . +In this case, dhcpd will refuse to start, +and will require manual intervention. +.Em DO NOT +simply create a new lease file when this happens \- if you do, +you will lose all your old bindings, and chaos will ensue. +Instead, rename +.Pa /var/db/dhcpd.leases~ +to +.Pa /var/db/dhcpd.leases , +restoring the old, valid lease file, and then start dhcpd. +This guarantees that a valid lease file will be restored. +.Sh FORMAT Lease descriptions are stored in a format that is parsed by the same recursive descent parser used to read the -.B dhcpd.conf(5) +.Xr dhcpd.conf 5 and -.B dhclient.conf(5) -files. Currently, the only declaration that is -used in the dhcpd.leases file is the -.B lease +.Xr dhclient.conf 5 +files. +Currently, the only declaration that is used in the +.Nm +file is the +.Ic lease declaration. -.PP - \fBlease \fIip-address\fB { \fIstatements...\fB } -.PP +.Pp +.Xo +.Ic \ \&lease Ar ip-address No { Ar statements... No } +.Xc +.Pp Each lease declaration includes the single IP address that has been -leased to the client. The statements within the braces define the -duration of the lease and to whom it is assigned. -.PP +leased to the client. +The statements within the braces define the duration of the lease +and to whom it is assigned. +.Pp The start and end time of a lease are recorded using the ``starts'' and ``ends'' statements: -.PP - \fB starts \fIdate\fB;\fR - \fB ends \fIdate\fB;\fR -.PP +.Pp +.D1 Ic starts Ar date ; +.D1 Ic ends Ar date ; +.Pp Dates are specified as follows: -.PP - \fIweekday year\fB/\fImonth\fB/\fIday -hour\fB:\fIminute\fB:\fIsecond\fR -.PP +.Pp +.Sm off +.Xo +.Ar \ \&weekday\ \&year No / Ar month +.Pf / Ar day\ \& hour No : +.Ar minute No : Ar second +.Xc +.Sm on +.Pp The weekday is present to make it easy for a human to tell when a -lease expires - it's specified as a number from zero to six, with zero -being Sunday. The day of week is ignored on input. The year is -specified with the century, so it should generally be four digits -except for really long leases. The month is specified as a number -starting with 1 for January. The day of the month is likewise -specified starting with 1. The hour is a number between 0 and 23, the -minute a number between 0 and 59, and the second also a number between -0 and 59. -.PP -Lease times are specified in Greenwich Mean Time (GMT), not in the -local time zone. Since Greenwich is actually on Daylight Savings -Time part of the year, there is probably nowhere in the world where -the times recorded on a lease are always the same as wall clock times. -On a unix machine, one can often figure out the current time in GMT by -typing \fBdate -u\fR. -.PP +lease expires \- it's specified as a number from zero to six, with zero +being Sunday. +The day of week is ignored on input. +The year is specified with the century, so it should generally be four digits +except for really long leases. +The month is specified as a number starting with 1 for January. +The day of the month is likewise specified starting with 1. +The hour is a number from 0 to 23, the minute a number from 0 to 59, +and the second also a number from 0 to 59. +.Pp +Lease times are specified in Coordinated Universal Time (UTC), not in the +local time zone. +.Qq Li date -u +will show the current time in UTC. +.Pp The MAC address of the network interface that was used to acquire the -lease is recorded with the \fBhardware\fR statement: -.PP - \fBhardware \fIhardware-type mac-address\fB;\fR -.PP +lease is recorded with the +.Ic hardware +statement: +.Pp +.D1 Ic hardware Ar hardware-type mac-address ; +.Pp The MAC address is specified as a series of hexadecimal octets, separated by colons. -.PP -If the client used a client identifier to acquire its address, the -client identifier is recorded using the \fBuid\fR statement: -.PP - \fBuid \fIclient-identifier\fB;\fR -.PP +.Pp +If the client uses a client identifier to acquire its address, the +client identifier is recorded using the +.Ic uid +statement: +.Pp +.D1 Ic uid Ar client-identifier ; +.Pp The client identifier is recorded as a series of hexadecimal octets, regardless of whether the client specifies an ASCII string or uses the newer hardware type/MAC address format. -.PP -If the client sends a hostname using the \fIClient Hostname\fR option, -as specified in some versions of the DHCP-DNS Interaction draft, that -hostname is recorded using the \fBclient-hostname\fR statement. -.PP - \fBclient-hostname "\fIhostname\fB";\fR -.PP -If the client sends its hostname using the \fIHostname\fR option, as -Windows 95 does, it is recorded using the \fBhostname\fR statement. -.PP - \fBhostname "\fIhostname\fB";\fR -.PP +.Pp +If the client sends a hostname using the +.Ic Client Hostname +option, as specified in some versions of the DHCP-DNS Interaction draft, that +hostname is recorded using the +.Ic client-hostname +statement. +.Pp +.D1 Ic client-hostname Ar \&"hostname\&" ; +.Pp +If the client sends its hostname using the +.Ic Hostname +option, as Windows 95 does, it is recorded using the +.Ic hostname +statement. +.Pp +.D1 Ic hostname Ar \&"hostname\&" ; +.Pp The DHCP server may determine that a lease has been misused in some way, either because a client that has been assigned a lease NAKs it, or because the server's own attempt to see if an address is in use prior to reusing it reveals that the address is in fact already in -use. In that case, the \fBabandoned\fR statement will be used to -indicate that the lease should not be reassigned. -.PP - \fBabandoned;\fR -.PP -Abandoned leases are reclaimed automatically. When a client asks for -a new address, and the server finds that there are no new addresses, -it checks to see if there are any abandoned leases, and allocates the -least recently abandoned lease. The standard mechanisms for checking -for lease address conflicts are still followed, so if the abandoned -lease's IP address is still in use, it will be reabandoned. -.PP -If a client \fBrequests\fR an abandoned address, the server assumes -that the reason the address was abandoned was that the lease file was -corrupted, and that the client is the machine that responded when the -lease was probed, causing it to be abandoned. In that case, the -address is immediately assigned to the client. -.SH FILES -.B /var/db/dhcpd.leases -.SH SEE ALSO -dhcpd(8), dhcp-options(5), dhcpd.conf(5), RFC2132, RFC2131. -.SH AUTHOR -.B dhcpd(8) -was written by Ted Lemon <mellon@vix.com> -under a contract with Vixie Labs. Funding -for this project was provided by the Internet Software Corporation. +use. +In that case, the +.Ic abandoned +statement will be used to indicate that the lease should not be reassigned. +.Pp +.D1 Ic abandoned ; +.Pp +Abandoned leases are reclaimed automatically. +When a client asks for a new address, and the server finds that there +are no new addresses, it checks to see if there are any abandoned leases, +and allocates the least recently abandoned lease. +The standard mechanisms for checking for lease address conflicts are still +followed, so if the abandoned lease's IP address is still in use, +it will be reabandoned. +.Pp +If a client +.Em requests +an abandoned address, the server assumes that the reason the address was +abandoned was that the lease file was corrupted, and that the client is +the machine that responded when the lease was probed, +causing it to be abandoned. +In that case, the address is immediately assigned to the client. +.Sh FILES +.Bl -tag -width Ds -compact +.It /var/db/dhcpd.leases +.It /var/db/dhcpd.leases~ +.El +.Sh SEE ALSO +.Xr dhcp-options 5 , +.Xr dhcpd.conf 5 , +.Xr dhcpd 8 +.Pp +RFC 2132, RFC 2131. +.Sh AUTHORS +.Xr dhcpd 8 +was written by +.An Ted Lemon Aq mellon@vix.com +under a contract with Vixie Labs. +Funding for this project was provided by the Internet Software Corporation. Information about the Internet Software Consortium can be found at -.B http://www.isc.org/isc. +.Pa http://www.isc.org/isc . |