diff options
Diffstat (limited to 'usr.sbin/dhcp/dhclient')
-rw-r--r-- | usr.sbin/dhcp/dhclient/dhclient-script.8 | 330 | ||||
-rw-r--r-- | usr.sbin/dhcp/dhclient/dhclient.conf.5 | 803 |
2 files changed, 600 insertions, 533 deletions
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 . |