dhclient.conf分析

来源:互联网 发布:军工软件 行业分析 编辑:程序博客网 时间:2024/05/17 01:11
NAME
     dhclient.conf - DHCP client configuration file




DESCRIPTION
     The dhclient.conf file contains configuration information for
     dhclient(8), the Internet Software Consortium DHCP Client.




     The dhclient.conf file is a free-form ASCII text file.  It is parsed by
     the recursive-descent parser built into 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 `#' character and
     end at the end of the line.




     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.  The configuration file can
     also be preinitialized with addresses to use on networks that do not have
     DHCP servers.




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 results in fairly
     timely updates without placing an inordinate load on the server.




     The following statements can be used to adjust the timing behaviour of
     the DHCP client if required, however:




     timeout time;
             The 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 is 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.
超时语句确定的时间必须在客户端开始,尝试确定其地址,否则超时后就不能链接服务器。默认情况下,这个超时时间为六十秒。超时过后,如果有尚未到期的配置文件中定义任何静态租约,或留在租赁数据库中的任何租约,客户端会遍历这些租赁试图验证他们,如果找到一个似乎是有效的,它将使用租赁的地址。如果在租期数据库中没有有效的静态或租约未到期租约,客户端将重新定义重试间隔后的协议。




     retry time;
             The 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.


重试语句确定客户端再次试图联系DHCP服务器之前必须经过的时间。默认情况下,这是五分钟。
     select-timeout 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).




             The 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 select-timeout
             has expired, the client will accept the first offer that arrives.




             By default, the select-timeout is zero seconds - that is, the
             client will take the first offer it sees.
这是可能的(有些人可能会说希望)多个DHCP服务器服务于任何给定的网络。在这种情况下,可能的是,客户机收到多个回复响应初始租赁发现消息。这可能是因为这些回复中的一个是优选的其他(例如,一个回复可具有以前使用的客户端的地址,而另一个可能不是) 。




选择超时是客户端发送它的第一个租约发现请求时到假设它已收到至少一个这样的回复之后,它停止等待来自服务器的回复之间的时间。如果在选择超时已到期的时间内没有收到回复,客户端将接受第一个收到的回复。




默认情况下,选择超时为0秒 - 也就是说,客户端将采取它认为第一次回复。


     reboot 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 reboot
             statement sets the time that must elapse after the client firsttatries to reacquire its old address before it gives up and tries
             to discover a new address.  By default, the reboot timeout is ten
             seconds.
当客户端重启后,首先尝试重新获取它重启之前的地址。这就是所谓的INIT- REBOOT状态。如果客户端仍连接在它最后一次运行的同一个网络上,这是开始的最快方法。重启语句设置的时间就是,客户端首先尝试重新获得它的旧地址必须经历的时间,超时后客户端将试图发现一个新的地址。默认情况下,重新启动超时是十秒钟。


     backoff-cutoff 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 backoff-cutoff statement determines the maximum amount of
             time that the client is allowed to back off.  It defaults to two
             minutes.
客户端使用一个拥有一些随机性的指数退避算法,因此,如果许多客户端尝试在同一时间来配置他们自己,他们不会让自己同时请求服务器。退避截止语句确定了客户端允许后退的最长时间。它默认为两分钟。


     initial-interval time;
             The 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.  If it is
             greater than the backoff-cutoff amount, it is set to that amount.
             It defaults to ten seconds.
初始间隔语句是设置第一次尝试与第二次尝试到达服务器的之间的一段时间。每个发送的消息的时间,消息之间的时间间隔由当前间隔乘以0和1之间的随机数的两倍加一。如果它比退避截止量大时,它将被设置。它默认为十秒钟。


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 do not contain information the client needs, or if
     the information provided is not satisfactory.




     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 DHCP Options.  DHCP Options are defined in dhcp-options(5).




     request [option] [, ... option];
             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.




     require [option] [, ... option];
             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.




     send { [option declaration] [, ... option declaration] }
             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 dhcp-options(5).  Options
             that are always sent in the DHCP protocol should not be specified
             here, except that the client can specify a dhcp-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.




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.




     default { [option declaration] [, ... option declaration] }
             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 default statement.




     supersede { [option declaration] [, ... option declaration] }
             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 supersede statement.
如果由于某些选项,客户端应该总是使用本地配置的一个或多个值,而不是任何由服务器提供的,这些值可以在优先于语句来定义。


     prepend { [option declaration] [, ... option declaration] }
             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 prepend statement.  The
             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.
如果因为某些设置选项的客户端应该使用您提供的值,然后使用由服务器提供的,如果有的话,这些值可以在前置语句中定义的值。该前置语句只能用于允许给予一个以上的值的选择。此限制并不强制执行 - 如果你忽视它,其行为将不可预知。


     append { [option declaration] [, ... option declaration] }
             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 append statement.  The 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.




LEASE DECLARATIONS
     The lease declaration:




           lease { lease-declaration [... lease-declaration] }




     The DHCP client may decide after some period of time (see 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 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 lease statement.




     NOTE: the lease statement is also used in the 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.




     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:




     bootp;  The 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.




     interface "string";
             The 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.




     fixed-address ip-address;
             The 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).
固定地址语句用来设置特定租约的IP地址。这是必需的所有租赁的语句。 IP地址必须被指定为一个点分四组(例如, 12.34.56.78 ) 。


     filename "string";
             The 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.
文件名语句指定引导文件名使用的名称。但为了保持完整性,这是不使用的标准的客户端配置脚本。


     server-name "string";
             The server-name statement specifies the name of the boot server
             name to use.  This is also not used by the standard client
             configuration script.
服务器名语句指定要使用的引导服务器名称的名称。这也是不使用标准的客户端配置脚本。


     option option-declaration;
             The 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.
选项​​语句用于指定由服务器,或者,在dhclient.conf声明预定租约的情况下,用户希望在客户端配置脚本如果使用预定义的租赁使用的值提供的选项的值。


     script "script-name";
             The 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
             dhclient.leases(5).




     medium "media setup";
             The 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(8)
             command line when configuring the interface.




             The DHCP client automatically declares this parameter if it used
             a media type (see the 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.




     renew date;




     rebind date;




     expire date;
             The 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 rebind statement defines the time at which the
             DHCP client should begin to try to contact any DHCP server in
             order to renew its lease.  The 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.




     These declarations are automatically set in leases acquired by the 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.




     Dates are specified as follows:




           _weekday_ _year_/_month_/_day__hour_:_minute_:_second_




     The weekday is present to make it easy for a human to tell when a lease
     expires - it is 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 59, and the second also a number between 0
     and 59.




ALIAS DECLARATIONS
     alias { declarations ... }




     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 does not 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 alias declaration.




     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.




OTHER DECLARATIONS
     reject ip-address;
             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 the bad DHCP server and fix it.

拒绝语句使DHCP客户端拒绝来自使用指定的地址作为服务器标识符的服务器的应答。这可以用来避免被恶意的或配置错误的DHCP服务器配置,尽管它应该是 更好地追查不良DHCP服务器并修复它的最后的手段 。


     interface "name" { declarations ... }
             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 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.




     media "media setup" [, "media setup", ...];
             The 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 are not 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).




             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.




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.




           timeout 60;
           retry 60;
           reboot 10;
           select-timeout 5;
           initial-interval 2;
           reject 192.33.137.209;




           interface "ep0" {
               send host-name "andare.fugue.com";
               send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
               send dhcp-lease-time 3600;
               supersede domain-name "fugue.com rc.vix.com home.vix.com";
               prepend domain-name-servers 127.0.0.1;
               request subnet-mask, broadcast-address, time-offset, routers,
                       domain-name, domain-name-servers, host-name;
               require subnet-mask, domain-name-servers;
               script "/etc/dhclient-script";
               media "media 10baseT/UTP", "media 10base2/BNC";
           }




           alias {
             interface "ep0";
             fixed-address 192.5.5.213;
             option subnet-mask 255.255.255.255;
           }




     This is a very complicated dhclient.conf file - in general, yours should
     be much simpler.  In many cases, it is sufficient to just create an empty
     dhclient.conf file - the defaults are usually fine.




SEE ALSO
     dhclient.leases(5), dhcpd.conf(5), dhcp-options(5), dhclient(8), dhcpd(8)




     RFC 2132, RFC 2131.




AUTHORS
     The dhclient(8) utility was written by Ted Lemon <mellon@vix.com> under a
     contract with Vixie Labs.




     The current implementation was reworked by Henning Brauer
     <henning@openbsd.org>.




FreeBSD 11.0-PRERELEASE         January 1, 1997        FreeBSD 11.0-PRERELEASE
NAME | DESCRIPTION | PROTOCOL TIMING | LEASE REQUIREMENTS AND REQUESTS | OPTION MODIFIERS | LEASE DECLARATIONS | ALIAS DECLARATIONS | OTHER DECLARATIONS | EXAMPLES | SEE ALSO | AUTHORS
Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=dhclient.conf&sektion=5&manpath=FreeBSD+10.3-RELEASE+and+Ports>
0 0