📄 dhcpd.conf.5
字号:
address is available to the client, the server will send a DHCPACK.If the address is no longer available, or the client isn't permittedto have it, the server will send a DHCPNAK. If the server knowsnothing about the address, it will remain silent, unless the addressis incorrect for the network segment to which the client has beenattached and the server is authoritative for that network segment, inwhich case the server will send a DHCPNAK even though it doesn't knowabout the address..PPThere may be a host declaration matching the client's identification.If that host declaration contains a fixed-address declaration that lists an IP address that is valid for the network segment to which theclient is connected. In this case, the DHCP server will never dodynamic address allocation. In this case, the client is \fIrequired\fRto take the address specified in the host declaration. If theclient sends a DHCPREQUEST for some other address, the server will respondwith a DHCPNAK..PPWhen the DHCP server allocates a new address for a client (remember,this only happens if the client has sent a DHCPDISCOVER), it firstlooks to see if the client already has a valid lease on an IP address,or if there is an old IP address the client had before that hasn't yetbeen reassigned. In that case, the server will take that address andcheck it to see if the client is still permitted to use it. If theclient is no longer permitted to use it, the lease is freed if theserver thought it was still in use - the fact that the client has senta DHCPDISCOVER proves to the server that the client is no longer usingthe lease..PPIf no existing lease is found, or if the client is forbidden toreceive the existing lease, then the server will look in the list ofaddress pools for the network segment to which the client is attachedfor a lease that is not in use and that the client is permitted tohave. It looks through each pool declaration in sequence (all.I rangedeclarations that appear outside of pool declarations are grouped intoa single pool with no permit list). If the permit list for the poolallows the client to be allocated an address from that pool, the poolis examined to see if there is an address available. If so, then theclient is tentatively assigned that address. Otherwise, the nextpool is tested. If no addresses are found that can be assigned tothe client, no response is sent to the client..PPIf an address is found that the client is permitted to have, and thathas never been assigned to any client before, the address isimmediately allocated to the client. If the address is available forallocation but has been previously assigned to a different client, theserver will keep looking in hopes of finding an address that has neverbefore been assigned to a client..PPThe DHCP server generates the list of available IP addresses from ahash table. This means that the addresses are not sorted in anyparticular order, and so it is not possible to predict the order inwhich the DHCP server will allocate IP addresses. Users of previousversions of the ISC DHCP server may have become accustomed to the DHCPserver allocating IP addresses in ascending order, but this is nolonger possible, and there is no way to configure this behavior withversion 3 of the ISC DHCP server..SH IP ADDRESS CONFLICT PREVENTIONThe DHCP server checks IP addresses to see if they are in use beforeallocating them to clients. It does this by sending an ICMP Echorequest message to the IP address being allocated. If no ICMP Echoreply is received within a second, the address is assumed to be free.This is only done for leases that have been specified in rangestatements, and only when the lease is thought by the DHCP server tobe free - i.e., the DHCP server or its failover peer has not listedthe lease as in use..PPIf a response is received to an ICMP Echo request, the DHCP serverassumes that there is a configuration error - the IP address is in useby some host on the network that is not a DHCP client. It marks theaddress as abandoned, and will not assign it to clients..PPIf a DHCP client tries to get an IP address, but none are available,but there are abandoned IP addresses, then the DHCP server willattempt to reclaim an abandoned IP address. It marks one IP addressas free, and then does the same ICMP Echo request check describedpreviously. If there is no answer to the ICMP Echo request, theaddress is assigned to the client..PPThe DHCP server does not cycle through abandoned IP addresses if thefirst IP address it tries to reclaim is free. Rather, when the nextDHCPDISCOVER comes in from the client, it will attempt a newallocation using the same method described here, and will typicallytry a new IP address..SH DHCP FAILOVERThis version of the ISC DHCP server supports the DHCP failoverprotocol as documented in draft-ietf-dhc-failover-07.txt. This isnot a final protocol document, and we have not done interoperabilitytesting with other vendors' implementations of this protocol, so youmust not assume that this implementation conforms to the standard.If you wish to use the failover protocol, make sure that both failoverpeers are running the same version of the ISC DHCP server..PPThe failover protocol allows two DHCP servers (and no more than two)to share a common address pool. Each server will have about half ofthe available IP addresses in the pool at any given time forallocation. If one server fails, the other server will continue torenew leases out of the pool, and will allocate new addresses out ofthe roughly half of available addresses that it had whencommunications with the other server were lost..PPIt is possible during a prolonged failure to tell the remaining serverthat the other server is down, in which case the remaining server will(over time) reclaim all the addresses the other server had availablefor allocation, and begin to reuse them. This is called putting theserver into the PARTNER-DOWN state..PPYou can put the server into the PARTNER-DOWN state either by using the.B omshell (1)command or by stopping the server, editing the last peer statedeclaration in the lease file, and restarting the server. If you usethis last method, be sure to leave the date and time of the start ofthe state blank:.PP.nf.B failover peer "\fIname\fB" state {.B my state partner-down;.B peer state \fIstate\fB at \fIdate\fB;.B }.fi.PPWhen the other server comes back online, it should automaticallydetect that it has been offline and request a complete update from theserver that was running in the PARTNER-DOWN state, and then bothservers will resume processing together..PPIt is possible to get into a dangerous situation: if you put oneserver into the PARTNER-DOWN state, and then *that* server goes down,and the other server comes back up, the other server will not knowthat the first server was in the PARTNER-DOWN state, and may issueaddresses previously issued by the other server to different clients,resulting in IP address conflicts. Before putting a server intoPARTNER-DOWN state, therefore, make.I surethat the other server will not restart automatically..PPThe failover protocol defines a primary server role and a secondaryserver role. There are some differences in how primaries andsecondaries act, but most of the differences simply have to do withproviding a way for each peer to behave in the opposite way from theother. So one server must be configured as primary, and the othermust be configured as secondary, and it doesn't matter too much whichone is which..SH FAILOVER STARTUPWhen a server starts that has not previously communicated with itsfailover peer, it must establish communications with its failover peerand synchronize with it before it can serve clients. This can happeneither because you have just configured your DHCP servers to performfailover for the first time, or because one of your failover servershas failed catastrophically and lost its database..PPThe initial recovery process is designed to ensure that when onefailover peer loses its database and then resynchronizes, any leasesthat the failed server gave out before it failed will be honored.When the failed server starts up, it notices that it has no savedfailover state, and attempts to contact its peer..PPWhen it has established contact, it asks the peer for a complete copyits peer's lease database. The peer then sends its complete database,and sends a message indicating that it is done. The failed serverthen waits until MCLT has passed, and once MCLT has passed bothservers make the transition back into normal operation. This waitingperiod ensures that any leases the failed server may have given outwhile out of contact with its partner will have expired..PPWhile the failed server is recovering, its partner remains in thepartner-down state, which means that it is serving all clients. Thefailed server provides no service at all to DHCP clients until it hasmade the transition into normal operation..PPIn the case where both servers detect that they have never beforecommunicated with their partner, they both come up in this recoverystate and follow the procedure we have just described. In this case,no service will be provided to DHCP clients until MCLT has expired..SH CONFIGURING FAILOVERIn order to configure failover, you need to write a peer declarationthat configures the failover protocol, and you need to write peerreferences in each pool declaration for which you want to dofailover. You do not have to do failover for all pools on a givennetwork segment. You must not tell one server it's doing failoveron a particular address pool and tell the other it is not. You mustnot have any common address pools on which you are not doingfailover. A pool declaration that utilizes failover would look like this:.PP.nfpool { failover peer "foo"; deny dynamic bootp clients; \fIpool specific parameters\fR};.fi.PPDynamic BOOTP leases are not compatible with failover, and, as such,you need to disallow BOOTP in pools that you are using failover for..PPThe server currently does very little sanity checking, so if youconfigure it wrong, it will just fail in odd ways. I would recommendtherefore that you either do failover or don't do failover, but don'tdo any mixed pools. Also, use the same master configuration file forboth servers, and have a separate file that contains the peerdeclaration and includes the master file. This will help you to avoidconfiguration mismatches. As our implementation evolves, this willbecome less of a problem. A basic sample dhcpd.conf file for aprimary server might look like this:.PP.nffailover peer "foo" { primary; address anthrax.rc.vix.com; port 519; peer address trantor.rc.vix.com; peer port 520; max-response-delay 60; max-unacked-updates 10; mclt 3600; split 128; load balance max seconds 3;}include "/etc/dhcpd.master";.fi.PPThe statements in the peer declaration are as follows:.PPThe .I primaryand.I secondarystatements.RS 0.25i.PP[ \fBprimary\fR | \fBsecondary\fR ]\fB;\fR.PPThis determines whether the server is primary or secondary, asdescribed earlier under DHCP FAILOVER..RE.PPThe .I addressstatement.RS 0.25i.PP.B address \fIaddress\fR\fB;\fR.PPThe \fBaddress\fR statement declares the IP address or DNS name on which theserver should listen for connections from its failover peer, and also thevalue to use for the DHCP Failover Protocol server identifier. Because thisvalue is used as an identifier, it may not be omitted..RE.PPThe .I peer addressstatement.RS 0.25i.PP.B peer address \fIaddress\fR\fB;\fR.PPThe \fBpeer address\fR statement declares the IP address or DNS name towhich the server should connect to reach its failover peer for failovermessages..RE.PPThe .I portstatement.RS 0.25i.PP.B port \fIport-number\fR\fB;\fR.PPThe \fBport\fR statement declares the TCP port on which the servershould listen for connections from its failover peer. This statementmay not currently be omitted, because the failover protocol does notyet have a reserved TCP port number..RE.PPThe .I peer portstatement.RS 0.25i.PP.B peer port \fIport-number\fR\fB;\fR.PPThe \fBpeer port\fR statement declares the TCP port to which theserver should connect to reach its failover peer for failovermessages. This statement may not be omitted because the failoverprotocol does not yet have a reserved TCP port number. The portnumber declared in the \fBpeer port\fR statement may be the same asthe port number declared in the \fBport\fR statement..RE.PPThe .I max-response-delaystatement.RS 0.25i.PP.B max-response-delay \fIseconds\fR\fB;\fR.PPThe \fBmax-response-delay\fR statement tells the DHCP server howmany seconds may pass without receiving a message from its failoverpeer before it assumes that connection has failed. This numbershould be small enough that a transient network failure that breaksthe connection will not result in the servers being out ofcommunication for a long time, but large enough that the server isn'tconstantly making and breaking connections. This parameter must bespecified..RE.PPThe .I max-unacked-updatesstatement.RS 0.25i.PP.B max-unacked-updates \fIcount\fR\fB;\fR.PPThe \fBmax-unacked-updates\fR statement tells the DHCP server howmany BNDUPD messages it can send before it receives a BNDACKfrom the failover peer. We don't have enough operational experienceto say what a good value for this is, but 10 seems to work. Thisparameter must be specified..RE.PPThe
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -