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

📄 dhcpd.conf.5

📁 DHCP服务器源码
💻 5
📖 第 1 页 / 共 5 页
字号:
.\"	dhcpd.conf.5.\".\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC").\" Copyright (c) 1996-2003 by Internet Software Consortium.\".\" Permission to use, copy, modify, and distribute this software for any.\" purpose with or without fee is hereby granted, provided that the above.\" copyright notice and this permission notice appear in all copies..\".\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF.\" MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT.\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE..\".\"   Internet Systems Consortium, Inc..\"   950 Charter Street.\"   Redwood City, CA 94063.\"   <info@isc.org>.\"   http://www.isc.org/.\".\" This software has been written for Internet Systems Consortium.\" by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc..\" To learn more about Internet Systems Consortium, see.\" ``http://www.isc.org/''.  To learn more about Vixie Enterprises,.\" see ``http://www.vix.com''.   To learn more about Nominum, Inc., see.\" ``http://www.nominum.com''..\".\" $Id: dhcpd.conf.5,v 1.63.2.19 2004/06/10 17:59:53 dhankins Exp $.\".TH dhcpd.conf 5.SH NAMEdhcpd.conf - dhcpd configuration file.SH DESCRIPTIONThe dhcpd.conf file contains configuration information for.IR dhcpd,the Internet Systems Consortium DHCP Server..PPThe dhcpd.conf file is a free-form ASCII text file.   It is parsed bythe recursive-descent parser built into dhcpd.   The file may containextra tabs and newlines for formatting purposes.  Keywords in the fileare case-insensitive.   Comments may be placed anywhere within thefile (except within quotes).   Comments begin with the # character andend at the end of the line..PPThe file essentially consists of a list of statements.   Statementsfall into two broad categories - parameters and declarations..PPParameter statements either say how to do something (e.g., how long alease to offer), whether to do something (e.g., should dhcpd provideaddresses to unknown clients), or what parameters to provide to theclient (e.g., use gateway 220.177.244.7)..PPDeclarations are used to describe the topology of thenetwork, to describe clients on the network, to provide addresses thatcan be assigned to clients, or to apply a group of parameters to agroup of declarations.   In any group of parameters and declarations,all parameters must be specified before any declarations which dependon those parameters may be specified..PPDeclarations about network topology include the \fIshared-network\fRand the \fIsubnet\fR declarations.   If clients on a subnet are to beassigned addressesdynamically, a \fIrange\fR declaration must appear within the\fIsubnet\fR declaration.   For clients with statically assignedaddresses, or for installations where only known clients will beserved, each such client must have a \fIhost\fR declaration.   Ifparameters are to be applied to a group of declarations which are notrelated strictly on a per-subnet basis, the \fIgroup\fR declarationcan be used..PPFor every subnet which will be served, and for every subnetto which the dhcp server is connected, there must be one \fIsubnet\fRdeclaration, which tells dhcpd how to recognize that an address is onthat subnet.  A \fIsubnet\fR declaration is required for each subneteven if no addresses will be dynamically allocated on that subnet..PPSome installations have physical networks on which more than one IPsubnet operates.   For example, if there is a site-wide requirementthat 8-bit subnet masks be used, but a department with a singlephysical ethernet network expands to the point where it has more than254 nodes, it may be necessary to run two 8-bit subnets on the sameethernet until such time as a new physical network can be added.   Inthis case, the \fIsubnet\fR declarations for these two networks must beenclosed in a \fIshared-network\fR declaration..PPSome sites may have departments which have clients on more than onesubnet, but it may be desirable to offer those clients a uniform setof parameters which are different than what would be offered toclients from other departments on the same subnet.   For clients whichwill be declared explicitly with \fIhost\fR declarations, thesedeclarations can be enclosed in a \fIgroup\fR declaration along withthe parameters which are common to that department.   For clientswhose addresses will be dynamically assigned, class declarations andconditional declarations may be used to group parameter assignmentsbased on information the client sends..PPWhen a client is to be booted, its boot parameters are determined byconsulting that client's \fIhost\fR declaration (if any), and thenconsulting any \fIclass\fR declarations matching the client,followed by the \fIpool\fR, \fIsubnet\fR and \fIshared-network\fRdeclarations for the IP address assigned to the client.   Each ofthese declarations itself appears within a lexical scope, and alldeclarations at less specific lexical scopes are also consulted forclient option declarations.   Scopes are never consideredtwice, and if parameters are declared in more than one scope, theparameter declared in the most specific scope is the one that isused..PPWhen dhcpd tries to find a \fIhost\fR declaration for a client, itfirst looks for a \fIhost\fR declaration which has a\fIfixed-address\fR declaration that lists an IP address that is validfor the subnet or shared network on which the client is booting.   Ifit doesn't find any such entry, it tries to find an entry which hasno \fIfixed-address\fR declaration..SH EXAMPLES.PPA typical dhcpd.conf file will look something like this:.nf.I global parameters...subnet 204.254.239.0 netmask 255.255.255.224 {  \fIsubnet-specific parameters...\fR  range 204.254.239.10 204.254.239.30;}subnet 204.254.239.32 netmask 255.255.255.224 {  \fIsubnet-specific parameters...\fR  range 204.254.239.42 204.254.239.62;}subnet 204.254.239.64 netmask 255.255.255.224 {  \fIsubnet-specific parameters...\fR  range 204.254.239.74 204.254.239.94;}group {  \fIgroup-specific parameters...\fR  host zappo.test.isc.org {    \fIhost-specific parameters...\fR  }  host beppo.test.isc.org {    \fIhost-specific parameters...\fR  }  host harpo.test.isc.org {    \fIhost-specific parameters...\fR  }}.ce 1Figure 1.fi.PPNotice that at the beginning of the file, there's a placefor global parameters.   These might be things like the organization'sdomain name, the addresses of the name servers (if they are common tothe entire organization), and so on.   So, for example:.nf	option domain-name "isc.org";	option domain-name-servers ns1.isc.org, ns2.isc.org;.ce 1Figure 2.fi.PPAs you can see in Figure 2, you can specify host addresses inparameters using their domain names rather than their numeric IPaddresses.  If a given hostname resolves to more than one IP address(for example, if that host has two ethernet interfaces), then wherepossible, both addresses are supplied to the client..PPThe most obvious reason for having subnet-specific parameters asshown in Figure 1 is that each subnet, of necessity, has its ownrouter.   So for the first subnet, for example, there should besomething like:.nf	option routers 204.254.239.1;.fi.PPNote that the address here is specified numerically.   This is notrequired - if you have a different domain name for each interface onyour router, it's perfectly legitimate to use the domain name for thatinterface instead of the numeric address.   However, in many casesthere may be only one domain name for all of a router's IP addresses, andit would not be appropriate to use that name here..PPIn Figure 1 there is also a \fIgroup\fR statement, which providescommon parameters for a set of three hosts - zappo, beppo and harpo.As you can see, these hosts are all in the test.isc.org domain, so itmight make sense for a group-specific parameter to override the domainname supplied to these hosts:.nf	option domain-name "test.isc.org";.fi.PPAlso, given the domain they're in, these are probably test machines.If we wanted to test the DHCP leasing mechanism, we might set thelease timeout somewhat shorter than the default:.nf	max-lease-time 120;	default-lease-time 120;.fi.PPYou may have noticed that while some parameters start with the\fIoption\fR keyword, some do not.   Parameters starting with the\fIoption\fR keyword correspond to actual DHCP options, whileparameters that do not start with the option keyword either controlthe behavior of the DHCP server (e.g., how long a lease dhcpd willgive out), or specify client parameters that are not optional in theDHCP protocol (for example, server-name and filename)..PPIn Figure 1, each host had \fIhost-specific parameters\fR.   Thesecould include such things as the \fIhostname\fR option, the name of afile to upload (the \fIfilename\fR parameter) and the address of theserver from which to upload the file (the \fInext-server\fRparameter).   In general, any parameter can appear anywhere thatparameters are allowed, and will be applied according to the scope inwhich the parameter appears..PPImagine that you have a site with a lot of NCD X-Terminals.   Theseterminals come in a variety of models, and you want to specify theboot files for each model.   One way to do this would be to have hostdeclarations for each server and group them by model:.nfgroup {  filename "Xncd19r";  next-server ncd-booter;  host ncd1 { hardware ethernet 0:c0:c3:49:2b:57; }  host ncd4 { hardware ethernet 0:c0:c3:80:fc:32; }  host ncd8 { hardware ethernet 0:c0:c3:22:46:81; }}group {  filename "Xncd19c";  next-server ncd-booter;  host ncd2 { hardware ethernet 0:c0:c3:88:2d:81; }  host ncd3 { hardware ethernet 0:c0:c3:00:14:11; }}group {  filename "XncdHMX";  next-server ncd-booter;  host ncd1 { hardware ethernet 0:c0:c3:11:90:23; }  host ncd4 { hardware ethernet 0:c0:c3:91:a7:8; }  host ncd8 { hardware ethernet 0:c0:c3:cc:a:8f; }}.fi.SH ADDRESS POOLS.PPThe.B pooldeclaration can be used to specify a pool of addresses that will betreated differently than another pool of addresses, even on the samenetwork segment or subnet.   For example, you may want to provide alarge set of addresses that can be assigned to DHCP clients that areregistered to your DHCP server, while providing a smaller set ofaddresses, possibly with short lease times, that are available forunknown clients.   If you have a firewall, you may be able to arrangefor addresses from one pool to be allowed access to the Internet,while addresses in another pool are not, thus encouraging users toregister their DHCP clients.   To do this, you would set up a pair ofpool declarations:.PP.nfsubnet 10.0.0.0 netmask 255.255.255.0 {  option routers 10.0.0.254;  # Unknown clients get this pool.  pool {    option domain-name-servers bogus.example.com;    max-lease-time 300;    range 10.0.0.200 10.0.0.253;    allow unknown-clients;  }  # Known clients get this pool.  pool {    option domain-name-servers ns1.example.com, ns2.example.com;    max-lease-time 28800;    range 10.0.0.5 10.0.0.199;    deny unknown-clients;  }}.fi.PPIt is also possible to set up entirely different subnets for known andunknown clients - address pools exist at the level of shared networks,so address ranges within pool declarations can be on differentsubnets..PPAs you can see in the preceding example, pools can have permit liststhat control which clients are allowed access to the pool and whicharen't.  Each entry in a pool's permit list is introduced with the.I allowor \fIdeny\fR keyword.   If a pool has a permit list, then only thoseclients that match specific entries on the permit list will beeligible to be assigned addresses from the pool.   If a pool has adeny list, then only those clients that do not match any entries onthe deny list will be eligible.    If both permit and deny lists existfor a pool, then only clients that match the permit list and do notmatch the deny list will be allowed access..SH DYNAMIC ADDRESS ALLOCATIONAddress allocation is actually only done when a client is in the INITstate and has sent a DHCPDISCOVER message.  If the client thinks ithas a valid lease and sends a DHCPREQUEST to initiate or renew thatlease, the server has only three choices - it can ignore theDHCPREQUEST, send a DHCPNAK to tell the client it should stop usingthe address, or send a DHCPACK, telling the client to go ahead and usethe address for a while..PPIf the server finds the address the client is requesting, and that

⌨️ 快捷键说明

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