⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dhclient.conf.5

📁 DHCP服务器源码
💻 5
📖 第 1 页 / 共 2 页
字号:
If for some set of options the client should first use the valuessupplied by the server, if any, and then use values you supply, thesevalues can be defined in the.B appendstatement.   The.B appendstatement can only be used for options whichallow more than one value to be given.   This restriction is notenforced - 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.PPThe DHCP client may decide after some period of time (see \fBPROTOCOLTIMING\fR) that it is not going to succeed in contacting aserver.   At that time, it consults its own database of old leases andtests each one that has not yet timed out by pinging the listed routerfor that lease to see if that lease could work.   It is possible todefine one or more \fIfixed\fR leases in the client configuration filefor networks where there is no DHCP or BOOTP service, so that theclient can still automatically configure its address.   This is donewith the.B leasestatement..PPNOTE: the lease statement is also used in the dhclient.leases file inorder to record leases that have been received from DHCP servers.Some of the syntax for leases as described below is only needed in thedhclient.leases file.   Such syntax is documented here forcompleteness..PPA lease statement consists of the lease keyword, followed by a leftcurly brace, followed by one or more lease declaration statements,followed by a right curly brace.   The following lease declarationsare possible:.PP \fBbootp;\fR.PPThe.B bootpstatement is used to indicate that the lease was acquired using theBOOTP protocol rather than the DHCP protocol.   It is never necessaryto specify this in the client configuration file.   The client usesthis syntax in its lease database file..PP \fBinterface\fR \fB"\fR\fIstring\fR\fB";\fR.PPThe.B interfacelease statement is used to indicate the interface on which the leaseis valid.   If set, this lease will only be tried on a particularinterface.   When the client receives a lease from a server, it alwaysrecords the interface number on which it received that lease.If predefined leases are specified in the dhclient.conf file, theinterface should also be specified, although this is not required..PP \fBfixed-address\fR \fIip-address\fR\fB;\fR.PPThe.B fixed-addressstatement is used to set the ip address of a particular lease.   Thisis required for all lease statements.   The IP address must bespecified as a dotted quad (e.g., 12.34.56.78)..PP \fBfilename "\fR\fIstring\fR\fB";\fR.PPThe.B filenamestatement specifies the name of the boot filename to use.   This isnot used by the standard client configuration script, but is includedfor completeness..PP \fBserver-name "\fR\fIstring\fR\fB";\fR.PPThe.B server-namestatement specifies the name of the boot server name to use.   This isalso not used by the standard client configuration script..PP \fBoption\fR \fIoption-declaration\fR\fB;\fR.PPThe.B optionstatement is used to specify the value of an option supplied by theserver, or, in the case of predefined leases declared indhclient.conf, the value that the user wishes the client configurationscript to use if the predefined lease is used..PP \fBscript "\fIscript-name\fB";\fR.PPThe.B scriptstatement is used to specify the pathname of the dhcp clientconfiguration script.  This script is used by the dhcp client to seteach interface's initial configuration prior to requesting an address,to test the address once it has been offered, and to set theinterface's final configuration once a lease has been acquired.   Ifno lease is acquired, the script is used to test predefined leases, ifany, and also called once if no valid lease can be identified.   Formore information, see.B dhclient-script(8)..PP \fBvendor option space "\fIname\fB";\fR.PPThe.B vendor option spacestatement is used to specify which option space should be used fordecoding the vendor-encapsulate-options option if one is received.The \fIdhcp-vendor-identifier\fR can be used to request a specificclass of vendor options from the server.   See.B dhcp-options(5)for details..PP \fBmedium "\fImedia setup\fB";\fR.PPThe.B mediumstatement can be used on systems where network interfaces cannotautomatically determine the type of network to which they areconnected.  The media setup string is a system-dependent parameterwhich is passed to the dhcp client configuration script wheninitializing the interface.  On Unix and Unix-like systems, theargument is passed on the ifconfig command line when configuring theinterface..PPThe dhcp client automatically declares this parameter if it uses amedia type (see the.B mediastatement) when configuring the interface in order to obtain a lease.This statement should be used in predefined leases only if the networkinterface requires media type configuration..PP \fBrenew\fR \fIdate\fB;\fR.PP \fBrebind\fR \fIdate\fB;\fR.PP \fBexpire\fR \fIdate\fB;\fR.PPThe \fBrenew\fR statement defines the time at which the dhcp clientshould begin trying to contact its server to renew a lease that it isusing.   The \fBrebind\fR statement defines the time at which the dhcpclient should begin to try to contact \fIany\fR dhcp server in orderto renew its lease.   The \fBexpire\fR statement defines the time atwhich the dhcp client must stop using a lease if it has not been ableto contact a server in order to renew it..PPThese declarations are automatically set in leases acquired by theDHCP client, but must also be configured in predefined leases - apredefined lease whose expiry time has passed will not be used by theDHCP client..PPDates are specified as follows:.PP \fI<weekday> <year>\fB/\fI<month>\fB/\fI<day><hour>\fB:\fI<minute>\fB:\fI<second>\fR.PPThe weekday is present to make it easy for a human to tell when alease expires - it's specified as a number from zero to six, with zerobeing Sunday.  When declaring a predefined lease, it can always bespecified as zero.  The year is specified with the century, so itshould generally be four digits except for really long leases.  Themonth is specified as a number starting with 1 for January.  The dayof the month is likewise specified starting with 1.  The hour is anumber between 0 and 23, the minute a number between 0 and 59, and thesecond also a number between 0 and 59..SH ALIAS DECLARATIONS \fBalias { \fI declarations ... \fB}\fR.PPSome DHCP clients running TCP/IP roaming protocols may require that inaddition to the lease they may acquire via DHCP, their interface alsobe configured with a predefined IP alias so that they can have apermanent IP address even while roaming.   The Internet SystemsConsortium DHCP client doesn't support roaming with fixed addressesdirectly, but in order to facilitate such experimentation, the dhcpclient can be set up to configure an IP alias using the.B aliasdeclaration..PPThe alias declaration resembles a lease declaration, except thatoptions other than the subnet-mask option are ignored by the standardclient configuration script, and expiry times are ignored.  A typicalalias declaration includes an interface declaration, a fixed-addressdeclaration for the IP alias address, and a subnet-mask optiondeclaration.   A medium statement should never be included in an aliasdeclaration..SH OTHER DECLARATIONS \fBreject \fIip-address\fB;\fR.PPThe.B rejectstatement causes the DHCP client to reject offers fromservers who use the specified address as a server identifier.   Thiscan be used to avoid being configured by rogue or misconfigured dhcpservers, although it should be a last resort - better to track downthe bad DHCP server and fix it..PP \fBinterface "\fIname\fB" { \fIdeclarations ... \fB }.PPA client with more than one network interface may require differentbehaviour depending on which interface is being configured.   Alltiming parameters and declarations other than lease and aliasdeclarations can be enclosed in an interface declaration, and thoseparameters will then be used only for the interface that matches thespecified name.   Interfaces for which there is no interfacedeclaration will use the parameters declared outside of any interfacedeclaration, or the default settings..PP \fBpseudo "\fIname\fR" "\fIreal-name\fB" { \fIdeclarations ... \fB }.PPUnder some circumstances it can be useful to declare a pseudo-interface and have the DHCP client acquire a configuration for that interface.Each interface that the DHCP client is supporting normally has a DHCPclient state machine running on it to acquire and maintain its lease.A pseudo-interface is just another state machine running on theinterface named \fIreal-name\fR, with its own lease and its ownstate.   If you use this feature, you must provide a client identifierfor both the pseudo-interface and the actual interface, and the twoidentifiers must be different.   You must also provide a separateclient script for the pseudo-interface to do what you want with the IPaddress.   For example:.PP.nf	interface "ep0" {		send dhcp-client-identifier "my-client-ep0";	}	pseudo "secondary" "ep0" {		send dhcp-client-identifier "my-client-ep0-secondary";		script "/etc/dhclient-secondary";	}.fi.PPThe client script for the pseudo-interface should not configure theinterface up or down - essentially, all it needs to handle are thestates where a lease has been acquired or renewed, and the stateswhere a lease has expired.   See \fBdhclient-script(8)\fR for moreinformation..PP \fBmedia "\fImedia setup\fB"\fI [ \fB, "\fImedia setup\fB", \fI... ]\fB;\fR.PPThe.B mediastatement defines one or more media configuration parameters which maybe tried while attempting to acquire an IP address.   The dhcp clientwill cycle through each media setup string on the list, configuringthe interface using that setup and attempting to boot, and then tryingthe next one.   This can be used for network interfaces which aren'tcapable of sensing the media type unaided - whichever media typesucceeds in getting a request to the server and hearing the reply isprobably right (no guarantees)..PPThe media setup is only used for the initial phase of addressacquisition (the DHCPDISCOVER and DHCPOFFER packets).   Once anaddress has been acquired, the dhcp client will record it in its leasedatabase and will record the media type used to acquire the address.Whenever the client tries to renew the lease, it will use that samemedia type.   The lease must expire before the client will go back tocycling through media types..SH SAMPLEThe following configuration file is used on a laptop running NetBSD1.3.   The laptop has an IP alias of 192.5.5.213, and has oneinterface, ep0 (a 3com 3C589C).   Booting intervals have beenshortened somewhat from the default, because the client is known tospend most of its time on networks with little DHCP activity.   Thelaptop does roam to multiple networks..nftimeout 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 "CLIENTBINDIR/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;}.fiThis is a very complicated dhclient.conf file - in general, yoursshould be much simpler.   In many cases, it's sufficient to justcreate an empty dhclient.conf file - the defaults are usually fine..SH SEE ALSOdhcp-options(5), dhclient.leases(5), dhcpd(8), dhcpd.conf(5), RFC2132,RFC2131..SH AUTHOR.B dhclient(8)was written by Ted Lemonunder a contract with Vixie Labs.   Fundingfor this project was provided by Internet Systems Consortium.Information about Internet Systems Consortium can be found at.B http://www.isc.org.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -