📄 dhcpd.conf.5
字号:
.I mcltstatement.RS 0.25i.PP.B mclt \fIseconds\fR\fB;\fR.PPThe \fBmclt\fR statement defines the Maximum Client Lead Time. Itmust be specified on the primary, and may not be specified on thesecondary. This is the length of time for which a lease may berenewed by either failover peer without contacting the other. Thelonger you set this, the longer it will take for the running server torecover IP addresses after moving into PARTNER-DOWN state. Theshorter you set it, the more load your servers will experience whenthey are not communicating. A value of something like 3600 isprobably reasonable, but again bear in mind that we have no realoperational experience with this..RE.PPThe .I splitstatement.RS 0.25i.PP.B split \fIindex\fR\fB;\fR.PPThe split statement specifies the split between the primary andsecondary for the purposes of load balancing. Whenever a clientmakes a DHCP request, the DHCP server runs a hash on the clientidentification. If the hash comes out to less than the split value,the primary answers. If it comes out to equal to or more than thesplit, the secondary answers. The only meaningful value is 128, and canonly be configured on the primary..RE.PPThe .I hbastatement.RS 0.25i.PP.B hba \fIcolon-separated-hex-list\fB;\fR.PPThe hba statement specifies the split between the primary andsecondary as a bitmap rather than a cutoff, which theoretically allowsfor finer-grained control. In practice, there is probably no needfor such fine-grained control, however. An example hba statement:.PP.nf hba ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff: 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00;.fi.PPThis is equivalent to a \fBsplit 128;\fR statement. You must only have\fBsplit\fR or \fBhba\fR defined, never both. For most cases, thefine-grained control that \fBhba\fR offers isn't necessary, and \fBsplit\fRshould be used. As such, the use of \fBhba\fR is deprecated..RE.PPThe .I load balance max secondsstatement.RS 0.25i.PP.B load balance max seconds \fIseconds\fR\fB;\fR.PPThis statement allows you to configure a cutoff after which loadbalancing is disabled. The cutoff is based on the number of secondssince the client sent its first DHCPDISCOVER or DHCPREQUEST message,and only works with clients that correctly implement the \fIsecs\fRfield - fortunately most clients do. We recommend setting this tosomething like 3 or 5. The effect of this is that if one of thefailover peers gets into a state where it is responding to failovermessages but not responding to some client requests, the otherfailover peer will take over its client load automatically as theclients retry..RE.SH CLIENT CLASSINGClients can be separated into classes, and treated differentlydepending on what class they are in. This separation can be doneeither with a conditional statement, or with a match statement withinthe class declaration. It is possible to specify a limit on thetotal number of clients within a particular class or subclass that mayhold leases at one time, and it is possible to specify automaticsubclassing based on the contents of the client packet..PPTo add clients to classes based on conditional evaluation, you canspecify a matching expression in the class statement:.PP.nfclass "ras-clients" { match if substring (option dhcp-client-identifier, 1, 3) = "RAS";}.fi.PPNote that whether you use matching expressions or add statements (orboth) to classify clients, you must always write a class declarationfor any class that you use. If there will be no match statement andno in-scope statements for a class, the declaration should look likethis:.PP.nfclass "ras-clients" {}.fi.SH SUBCLASSES.PPIn addition to classes, it is possible to declare subclasses. Asubclass is a class with the same name as a regular class, but with aspecific submatch expression which is hashed for quick matching.This is essentially a speed hack - the main difference between fiveclasses with match expressions and one class with five subclasses isthat it will be quicker to find the subclasses. Subclasses work asfollows:.PP.nfclass "allocation-class-1" { match pick-first-value (option dhcp-client-identifier, hardware);}class "allocation-class-2" { match pick-first-value (option dhcp-client-identifier, hardware);}subclass "allocation-class-1" 1:8:0:2b:4c:39:ad;subclass "allocation-class-2" 1:8:0:2b:a9:cc:e3;subclass "allocation-class-1" 1:0:0:c4:aa:29:44;subnet 10.0.0.0 netmask 255.255.255.0 { pool { allow members of "allocation-class-1"; range 10.0.0.11 10.0.0.50; } pool { allow members of "allocation-class-2"; range 10.0.0.51 10.0.0.100; }}.fi.PPThe data following the class name in the subclass declaration is aconstant value to use in matching the match expression for the class.When class matching is done, the server will evaluate the matchexpression and then look the result up in the hash table. If itfinds a match, the client is considered a member of both the class andthe subclass..PPSubclasses can be declared with or without scope. In the aboveexample, the sole purpose of the subclass is to allow some clientsaccess to one address pool, while other clients are given access tothe other pool, so these subclasses are declared without scopes. Ifpart of the purpose of the subclass were to define different parametervalues for some clients, you might want to declare some subclasseswith scopes..PPIn the above example, if you had a single client that needed someconfiguration parameters, while most didn't, you might write thefollowing subclass declaration for that client:.PP.nfsubclass "allocation-class-2" 1:08:00:2b:a1:11:31 { option root-path "samsara:/var/diskless/alphapc"; filename "/tftpboot/netbsd.alphapc-diskless";}.fi.PPIn this example, we've used subclassing as a way to control addressallocation on a per-client basis. However, it's also possible to usesubclassing in ways that are not specific to clients - for example, touse the value of the vendor-class-identifier option to determine whatvalues to send in the vendor-encapsulated-options option. An exampleof this is shown under the VENDOR ENCAPSULATED OPTIONS head in the.B dhcp-options(5)manual page..SH PER-CLASS LIMITS ON DYNAMIC ADDRESS ALLOCATION.PPYou may specify a limit to the number of clients in a class that canbe assigned leases. The effect of this will be to make it difficultfor a new client in a class to get an address. Once a class withsuch a limit has reached its limit, the only way a new client in thatclass can get a lease is for an existing client to relinquish itslease, either by letting it expire, or by sending a DHCPRELEASEpacket. Classes with lease limits are specified as follows:.PP.nfclass "limited-1" { lease limit 4;}.fi.PPThis will produce a class in which a maximum of four members may holda lease at one time..SH SPAWNING CLASSES.PPIt is possible to declare a.I spawning class\fR.A spawning class is a class that automatically produces subclassesbased on what the client sends. The reason that spawning classeswere created was to make it possible to create lease-limited classeson the fly. The envisioned application is a cable-modem environmentwhere the ISP wishes to provide clients at a particular site with morethan one IP address, but does not wish to provide such clients withtheir own subnet, nor give them an unlimited number of IP addressesfrom the network segment to which they are connected..PPMany cable modem head-end systems can be configured to add a RelayAgent Information option to DHCP packets when relaying them to theDHCP server. These systems typically add a circuit ID or remote IDoption that uniquely identifies the customer site. To take advantageof this, you can write a class declaration as follows:.PP.nfclass "customer" { spawn with option agent.circuit-id; lease limit 4;}.fi.PPNow whenever a request comes in from a customer site, the circuit IDoption will be checked against the class's hash table. If a subclassis found that matches the circuit ID, the client will be classified inthat subclass and treated accordingly. If no subclass is foundmatching the circuit ID, a new one will be created and logged in the.B dhcpd.leasesfile, and the client will be classified in this new class. Once theclient has been classified, it will be treated according to the rulesof the class, including, in this case, being subject to the per-sitelimit of four leases..PPThe use of the subclass spawning mechanism is not restricted to relayagent options - this particular example is given only because it is afairly straightforward one..SH COMBINING MATCH, MATCH IF AND SPAWN WITH.PPIn some cases, it may be useful to use one expression to assign aclient to a particular class, and a second expression to put it into asubclass of that class. This can be done by combining the \fBmatchif\fR and \fBspawn with\fR statements, or the \fBmatch if\fR and\fBmatch\fR statements. For example:.PP.nfclass "jr-cable-modems" { match if option dhcp-vendor-identifier = "jrcm"; spawn with option agent.circuit-id; lease limit 4;}class "dv-dsl-modems" { match if opton dhcp-vendor-identifier = "dvdsl"; spawn with option agent.circuit-id; lease limit 16;}.fi.PPThis allows you to have two classes that both have the same \fBspawnwith\fR expression without getting the clients in the two classesconfused with each other..SH DYNAMIC DNS UPDATES.PPThe DHCP server has the ability to dynamically update the Domain NameSystem. Within the configuration files, you can define how you wantthe Domain Name System to be updated. These updates are RFC 2136compliant so any DNS server supporting RFC 2136 should be able toaccept updates from the DHCP server..PPTwo DNS update schemes are currently implemented, and another isplanned. The two that are currently available are the ad-hoc DNSupdate mode and the interim DHCP-DNS interaction draft update mode.If and when the DHCP-DNS interaction draft and the DHCID draft make itthrough the IETF standards process, there will be a third mode, whichwill be the standard DNS update method. The DHCP server must beconfigured to use one of the two currently-supported methods, or notto do dns updates. This can be done with the.I ddns-update-styleconfiguration parameter..SH THE AD-HOC DNS UPDATE SCHEMEThe ad-hoc Dynamic DNS update scheme is.B now deprecatedand.Bdoes not work.In future releases of the ISC DHCP server, this scheme will not likely beavailable. The interim scheme works, allows for failover, and should now beused. The following description is left here for informational purposesonly..PPThe ad-hoc Dynamic DNS update scheme implemented in this version ofthe ISC DHCP server is a prototype design, which does nothave much to do with the standard update method that is beingstandardized in the IETF DHC working group, but rather implements somevery basic, yet useful, update capabilities. This mode.B does not workwith the.I failover protocolbecause it does not account for the possibility of two different DHCPservers updating the same set of DNS records..PPFor the ad-hoc DNS update method, the client's FQDN is derived in twoparts. First, the hostname is determined. Then, the domain name isdetermined, and appended to the hostname..PPThe DHCP server determines the client's hostname by first looking fora \fIddns-hostname\fR configuration option, and using that if it ispresent. If no such option is present, the server looks for avalid hostname in the FQDN option sent by the client. If one isfound, it is used; otherwise, if the client sent a host-name option,that is used. Otherwise, if there is a host declaration that appliesto the client, the name from that declaration will be used. If noneof these applies, the server will not have a hostname for the client,and will not be able to do a DNS update..PPThe domain name is determined based strictly on the serverconfiguration, not on what the client sends. First, if there is a .I ddns-domainnameconfiguration option, it is used. Second, if there is a\fIdomain-name\fR option configured, that is used. Otherwise, theserver will not do the DNS update..PPThe client's fully-qualified domain name, derived as we havedescribed, is used as the name on which an "A" record will be stored.The A record will contain the IP address that the client was assignedin its lease. If there is already an A record with the same name inthe DNS server, no update of either the A or PTR records will occur -this prevents a client from claiming that its hostname is the name ofsome network server. For example, if you have a fileserver called
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -