2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-09-02 23:15:20 +00:00

[3418] Several sections converted.

This commit is contained in:
Tomek Mrugalski
2014-06-12 22:51:39 +02:00
parent f594cdd68b
commit ad1b6f00ad

View File

@@ -67,400 +67,365 @@
is started, its configuration file has to be prepared. The is started, its configuration file has to be prepared. The
basic configuration looks as follows: basic configuration looks as follows:
<screen> <screen>
1. # This is an example configuration file for the DHCPv4 server in Kea. {
2. # It is a basic scenario with one IPv4 subnet configured. The subnet # DHCPv4 configuration starts in this line
3. # contains a single pool of dynamically allocated addresses. "Dhcp4": {
5. { "Dhcp4": # First we set up global values
"interfaces": [ "eth0" ],
"valid-lifetime": 4000,
"renew-timer": 1000,
"rebind-timer": 2000,
7. { # Next we specify the type of lease database
8. # Kea is told to listen on eth0 interface only. "lease-database": {
9. "interfaces": [ "eth0" ], "type": "memfile"
},
11. # We need to specify lease type. As of May 2014, three backends are supported: # Finally, we list the subnets from which we will be leasing addresses.
12. # memfile, mysql and pgsql. We'll just use memfile, because it doesn't require "subnet4": [
13. # any prior set up. {
14. "lease-database": { "subnet": "192.0.2.0/24",
15. "type": "memfile" "pool": [ "192.0.2.1 - 192.0.2.200" ]
16. }, }
]
17. # Addresses will be assigned with valid lifetimes being 4000. Client # DHCPv4 configuration ends with this line
18. # is told to start renewing after 1000 seconds. If the server does not respond }
19. # after 2000 seconds since the lease was granted, client is supposed
20. # to start REBIND procedure (emergency renewal that allows switching
21. # to a different server).
22. "valid-lifetime": 4000,
24. # Renew and rebind timers are commented out. This implies that options } </screen>
25. # 58 and 59 will not be sent to the client. In this case it is up to Note that line numbers are specified for easier reference only and
26. # the client to pick the timer values according to RFC2131. Uncomment the are not part of the configuration. The examples in following sections do not
27. # timers to send these options to the client. have reference numbers.</para>
28. # "renew-timer": 1000,
29. # "rebind-timer": 2000,
31. # The following list defines subnets. We have only one subnet <para>The following paragraphs provide brief overview of the parameters and
32. # here. their format. Following sections in this chapter go into much greater details
33. "subnet4": [ for aforementioned parameters and also introduce new ones.</para>
34. { "pool": [ "192.0.2.1 - 192.0.2.200" ],
35. "subnet": "192.0.2.0/24" } ]
36. }
38. } <para>The lines starting with a hash (#) are comments and do not impact the server
</screen>Note that line numbers are specified for easier reference only and operation in any way.</para>
are not part of the configuration. The examples in following sections do
not have reference numbers.</para>
<para>The following paragraphs provide brief overview of the parameters <para>The configuration starts in the first line with the initial opening curly
and their format. Following sections in this chapter go into much greater bracket. Each configuration consists of one or more objects. In this specific
details for aforementioned parameters and also introduce new ones.</para> example, we have only one object called Dhcp4. This is a simplified
configuration, as usually there will be additional objects, like
<command>Logging</command> or <command>DhcpDns</command>, but we omit them now
for clarity. The Dhcp4 configuration starts after the first comment
("<command>Dhcp4</command>": {) and ends after the last comment (}). Everything
defined between those lines is considered Dhcp4 configuration.</para>
<para>The lines 1-3 are comments and do not impact the server <para>In general case, the order in which those parameters appear doesn't
operation in any way. The configuration starts in line 5 with the matter. There are two caveats here, though. The first one is to remember that
initial opening curly bracket. Each configuration consists of one or the configuration file must be a well formed JSON. That means that parameters
more objects. In this specific example, we have only one object called for any given scope must be separate by a coma and there must not be a coma
Dhcp4. This is simplified configuration, as usually there will be after the last parameter. When reordering configuration file, keep in mind that
additional objects, like Logging or DhcpDns, but we omit them now for moving a parameter to or from the last position in a given scope may require
clarity. The Dhcp4 configuration starts in line 7 and finished in line moving the coma as well. The second caveat is that it is uncommon, but legal to
36. Everything defined between those lines is considered Dhcp4 repeat the same parameter multiple times. In that case the last occurrence of a
configuration.</para> given parameter in a given scope is used while all previous instances are
ignored. That is unlikely to cause any confusion, as there are no real life
reasons to keep multiple copies of the same parameter in your configuration
file.</para>
<para>In general case, the order in which those parameters appear <para>The line defining <command>interfaces</command> parameter specifies a list
doesn't matter. For example swapping line 9 and lines 14-16 does not of network interfaces, over which the server should listen. Please note the
change the configuration in any way. There are two caveats here, notation. Lists are opened and closed with square brackets, with elements
though. The first one is to remember that the configuration file must separated by comas. Had we wanted to listen on two interfaces, the line could
be a well formed JSON. That means that parameters for any given scope look like this:
must be separate by a coma and there must not be a coma after the last
parameter. When reordering configuration file, keep in mind that
moving a parameter to or from the last position in a given scope may
require moving the coma as well. The second caveat is that it is
uncommon, but legal to repeat the same parameter multiple times. In
that case the last occurrence of a given parameter is used while all
previous instances are ignored. That is unliekly to cause any
confusion, as there are no real life reasons to keep multiple copies
of the same parameter in your configuration file.</para>
<para>Line 9 contains the first parameter that specifies a list of
network interfaces, over which the server should listen. Please note
the notation. Lists are defined as square brackets, with elements
separated by comas. Had we wanted to listen on two interfaces, the
line could look like this:
<screen> <screen>
"interfaces": [ "eth0", "eth1" ], "interfaces": [ "eth0", "eth1" ],
</screen> </screen>
As "interfaces" is not the last parameter and there are others that As "<command>interfaces</command>" is not the last parameter and there are
follow, a trailing coma is required.</para> others that follow, a trailing coma is required. A number of other parameters
follow. Valid lifetime defines how long the addresses (leases) given out by the
server are valid. If nothing changes, client that got the address is allowed to
use it for 4000 seconds. Please note that integer numbers are specified as is,
without any quotes around them. Renew-timer and rebind-timer are values that
define T1 and T2 timers that govern when the client will begin renewal and
rebind procedures.</para>
<para>Lines 14-16 define lease database. It informs the server where <para>The next couple lines define lease database. It informs the server where
to store its leases information. This specific example tells the to store its leases information. This specific example tells the server to use
server to use memfile, which is the simplest (and fastest) database <command>memfile</command>, which is the simplest (and fastest) database
backend. It uses in-memory database and stores leases on disk using backend. It uses in-memory database and stores leases on disk using CSV
CSV file. This is a very simple configuration. Usually, lease database file. This is a very simple configuration. Usually, lease database configuration
configuration is more extensive and contains additional parameters. is more extensive and contains additional parameters. Note that lease-database
Note that lease-database is defined as object or list and it opens up is defined as an object and it opens up a new scope, using opening curly
a new scope, using opening curly bracket. Its parameters (just one -- bracket. Its parameters (just one in this example -- called &quot;type&quot;)
called &quot;type&quot;) follow. Had there been more than one, they follow. Had there been more than one, they would be separated by comas. This
would be separated by comas. This scope is closed in line 16. As more scope is closed with closing curly bracket. As more parameters follow, trailing
parameters follow, trailing coma is present.</para> coma is present.</para>
<para>Line 22 has a simple definition of a valid lifetime. That value <para>Finally, we need to define a list of IPv4 subnets. This is the most
defines how long the addresses (leases) given out by the server are important DHCPv4 configuration structure as the server uses that information to
valid. If nothing changes, client that got the address is allowed to process clients' requests. It defines all subnets that the server is expected to
use it for 4000 seconds. Please note that integer numbers are specified receive DHCP requests from. It is a list, so it start and ends with square
as is, without any quotes around them.</para> brackets. In this example we have only one subnet defined. Subnet itself has
several parameters, hence it is a structure, so it is opened and closed using
curly brackets. Each subnet has to have at least two parameters: subnet (that
defines the whole subnet) and pool (which is a list of dynamically allocated
pools that are governed by the DHCP server. Subnet4 list is closed with closing
square bracket at the end of line 35. As this is the last parameter in Dhcp4
context, there is no trailing coma.</para>
<para>The next paragraph, metions parameters that are optional. In <para>Had there been more than one subnet defined, additional subnet4 objects
particular, renew-timer and rebind-timer are values that may or may would be specified and separated by comas. For example, to define 3 subnets, the
not appear. If they are not present, the server will say nothing about following syntax should be used:
renewal (T1) and rebing (T2) timers and it will be up to the client to
choose appropriate timer values. <ulink
url="http://tools.ietf.org/html/rfc2131">RFC 2131</ulink> says that in
such cases client is supposed to use default values of 0.5 *
valid-lifetime for renewal (T1) and 0.875 * valid-lifetime for rebind
(T2). Administrator may want to decide on different values and specify
those parameters explicitly.</para>
<para>Lines 33 to 36 define a list of IPv4 subnets. This is the most
important DHCPv4 configuration structure as this is the essense of the
network topology. It defines all subnets that the server is expected
to receive DHCP requests from. It is a list, so it start and ends with
square brackets. In this example we have only one subnet
defined. Subnet itself has several parameters, hence it is a
structure, so it is opened and closed using curly brackets. Each
subnet has to have at least two parameters: subnet (that defines the
whole subnet) and pool (which is a list of dynamically allocated pools
that are governed by the DHCP server. Subnet4 list is closed with
closing square bracket at the end of line 35. As this is the last
parameter in Dhcp4 context, there is no trailing coma.</para>
<para>Had there been more than one subnet defined, additional subnet4
objects would be specified and separated by comas. For example, to
define 3 subnets, the following syntax should be used:
<screen> <screen>
"subnet4": [ "subnet4": [
{ "pool": [ "192.0.2.1 - 192.0.2.200" ], {
"subnet": "192.0.2.0/24" }, "pool": [ "192.0.2.1 - 192.0.2.200" ],
{ "pool": [ "192.0.3.100 - 192.0.3.200" ], "subnet": "192.0.2.0/24"
"subnet": "192.0.3.0/24" }, },
{ "pool": [ "192.0.4.1 - 192.0.4.254" ], {
"subnet": "192.0.4.0/24" } ] "pool": [ "192.0.3.100 - 192.0.3.200" ],
"subnet": "192.0.3.0/24"
},
{
"pool": [ "192.0.4.1 - 192.0.4.254" ],
"subnet": "192.0.4.0/24"
}
]
</screen> </screen>
</para> </para>
<para>Line 36 closes Dhcp4 context. In a real life configuration file <para>After all parameters are specified, we have two contexts open: global and
there likely would be additional components defined, like Logging or Dhcp4, hence we need two closing curly brackets to close them. In a real life
DhcpDdns, so line 36 would have a coma behind the closing curly configuration file there likely would be additional components defined, like
bracket.</para> Logging or DhcpDdns, so after the first bracket would have a coma behind it and
a new object definition would follow.</para>
<para>The whole configuration ends in line 38, which closes the global
configuration scope, opened in line 5.</para>
<para>Kea 0.9 does not have configuration syntax validation <para>Kea 0.9 does not have configuration syntax validation
implemented yet. Such a feature is planned for the near future. For implemented yet. Such a feature is planned for the near future. For
the time being, it is convenient to use on-line JSON validators to the time being, it is convenient to use on-line JSON validators and/or
check whether the syntax is correct. One example of such JSON viewers to check whether the syntax is correct. One example of such a
validator is available at <ulink url="http://jsonviewer.stack.hu/"/>. JSON validator is available at <ulink
url="http://jsonviewer.stack.hu/"/>.
</para> </para>
<section> <section>
<title>Default storage for leases</title> <title>Memfile - a basic storage for leases</title>
<para>
The server is able to store lease data in different repositories. Larger deployments
may elect to store leases in a database.
<xref linkend="database-configuration4"/> describes one way to do it.
By default, the server will use a CSV file rather than a database to store
lease information. One of the advantages of using a file is that it eliminates
dependency on third party database software.
</para>
<para>
The configuration of the file backend (Memfile)
is controlled through the Dhcp4/lease-database parameters. When default
parameters are used, the Memfile backend will write leases to a disk in the
[bind10-install-dir]/var/bind10/kea-leases4.csv.
</para>
<para>
It is possible to alter the default location of the lease file. The following
configuration:
<screen>
&gt; <userinput>config set Dhcp4/lease-database/type "memfile"</userinput>
&gt; <userinput>config set Dhcp4/lease-database/persist true</userinput>
&gt; <userinput>config set Dhcp4/lease-database/name "/tmp/kea-leases4.csv"</userinput>
&gt; <userinput>config commit</userinput>
</screen>
will change the default location of the lease file to /tmp/kea-leases4.csv.
</para>
<para>
The "persist" parameter controls whether the leases are written to disk.
It is strongly recommended that this parameter is set to "true" at all times
during the normal operation of the server
</para>
</section>
<section id="database-configuration4"> <para>The server is able to store lease data in different repositories. Larger
<title>Database Configuration</title> deployments may elect to store leases in a database. <xref
<para> linkend="database-configuration4"/> describes one way to do it. In typical
All leases issued by the server are stored in the lease database. Currently smaller deployments the server will use a CSV file rather than a database to
there are 3 database backends available: MySQL, PostgreSQL and memfile (which store lease information. One of the advantages of using a file is that it
is the default backend). eliminates dependency on third party database software.</para>
</para>
<note> <para>The configuration of the file backend (Memfile) is controlled through
<para> the Dhcp4/lease-database parameters. <!-- @todo: we don't have default
Database access information must be configured for the DHCPv4 server, even if parameters. Let's comment this out When default parameters are used, the
it has already been configured for the DHCPv6 server. The servers store their Memfile backend will write leases to a disk in the
information independently, so each server can use a separate [kea-install-dir]/var/kea/kea-leases4.csv. --></para>
database or both servers can use the same database.
</para> <para>It is possible to alter the default location of the lease file. The
</note> following configuration:
<para>
Database configuration is controlled through the Dhcp4/lease-database parameters.
The type of the database must be set to "mysql", "postgresql" or "memfile":
<screen>
<userinput>"Dhcp4": { "lease-database": { "type": "memfile" } }</userinput>
</screen>
Next, the name of the database is to hold the leases must be set: this is the
name used when the lease database was created (see <xref linkend="dhcp-mysql-database-create"/>
or <xref linkend="dhcp-pgsql-database-create"/>).
<screen>
"Dhcp4": { "lease-database": { <userinput>"name": "<replaceable>database-name</replaceable>" </userinput>} }
</screen>
If the database is located on a different system to the DHCPv4 server, the
database host name must also be specified (although note that this configuration
may have a severe impact on server performance):
<screen>
<userinput>"Dhcp4": { "lease-database": { "host": <replaceable>remote-host-name</replaceable>"</userinput>, ... }, ... }
</screen>
The usual state of affairs will be to have the database on the same machine as the
DHCPv4 server. In this case, set the value to the empty string:
<screen> <screen>
"Dhcp4": { "Dhcp4": {
"lease-database": { "lease-database": {
<userinput>"host" : ""</userinput>, <userinput>"type": "memfile"</userinput>,
... <userinput>"persist": true</userinput>,
}, <userinput>"name": "/tmp/kea-leases4.csv"</userinput>
}
... ...
} }
</screen> </screen>
</para> will change the default location of the lease file to /tmp/kea-leases4.csv.
<para> </para>
Finally, the credentials of the account under which the server will access the database
should be set: <para>The "persist" parameter controls whether the leases are written to disk.
It is strongly recommended that this parameter is set to "true" at all times
during the normal operation of the server</para>
</section>
<section id="database-configuration4">
<title>Database Configuration</title>
<para>All leases issued by the server are stored in the lease database.
Currently there are 3 database backends available: MySQL, PostgreSQL and
memfile (which is the default backend).</para>
<note>
<para>Database access information must be configured for the DHCPv4 server,
even if it has already been configured for the DHCPv6 server. The servers
store their information independently, so each server can use a separate
database or both servers can use the same database.</para>
</note>
<para>Database configuration is controlled through the Dhcp4/lease-database
parameters. The type of the database must be set to "mysql", "postgresql" or
"memfile":
<screen> <screen>
<userinput>"Dhcp4": { "lease-database": { "user": "<replaceable>user-name</replaceable>",</userinput> "Dhcp4": { "lease-database": { <userinput>"type": "memfile"</userinput>, ... }, ... }
<userinput> "password" "<replaceable>password</replaceable>" } }</userinput>
</screen> </screen>
If there is no password to the account, set the password to the empty string "". (This is also the default.) Next, the name of the database is to hold the leases must be set: this is the
</para> name used when the lease database was created (see <xref linkend="dhcp-mysql-database-create"/>
<note> or <xref linkend="dhcp-pgsql-database-create"/>).
<para>The password is echoed when entered and is stored in clear text in the configuration <screen>
database. Improved password security will be added in a future version of Kea.</para> "Dhcp4": { "lease-database": { <userinput>"name": "<replaceable>database-name</replaceable>" </userinput>, ... }, ... }
</note> </screen>
</section> If the database is located on a different system to the DHCPv4 server, the
database host name must also be specified (although note that this
configuration may have a severe impact on server performance):
<screen>
"Dhcp4": { "lease-database": { <userinput>"host": <replaceable>remote-host-name</replaceable>"</userinput>, ... }, ... }
</screen>
The usual state of affairs will be to have the database on the same machine as
the DHCPv4 server. In this case, set the value to the empty string:
<screen>
"Dhcp4": { "lease-database": { <userinput>"host" : ""</userinput>, ... }, ... }
</screen>
</para>
<para>Finally, the credentials of the account under which the server will
access the database should be set:
<screen>
"Dhcp4": { "lease-database": { <userinput>"user": "<replaceable>user-name</replaceable>"</userinput>,
<userinput>"password" "<replaceable>password</replaceable>"</userinput>,
... },
... }
</screen>
If there is no password to the account, set the password to the empty string
"". (This is also the default.)</para>
</section>
<section id="dhcp4-interface-selection"> <section id="dhcp4-interface-selection">
<title>Interface selection</title> <title>Interface selection</title>
<para> <para>DHCPv4 server has to be configured to listen on specific network
When DHCPv4 server starts up, by default it will listen to the DHCP interfaces. The simplest network interface configuration tells the server to
traffic and respond to it on all interfaces detected during startup. listen on all available interfaces:
However, in many cases it is desired to configure the server to listen and <screen>
respond on selected interfaces only. The sample commands in this section "Dhcp4": { <userinput>"interfaces": ["*"]</userinput>, ... }</screen>
show how to make interface selection using bindctl. An asterisk sign plays a role of the wildcard and means "listen on all interfaces".
</para> </para>
<para> <para>It is usually a good idea to explicitly specify interface names:
The default configuration can be presented with the following command: <screen>
<screen> "Dhcp4": { <userinput>"interfaces": [ "eth1", "eth3" ]</userinput>, ... }</screen>
&gt; <userinput>config show Dhcp4/interfaces</userinput> </para>
<userinput>Dhcp4/interfaces[0] "*" string</userinput></screen> <para>It is possible to use wildcard interface name (asterisk) concurrently
An asterisk sign plays a role of the wildcard and means "listen on all interfaces". with explicit interface names:
</para> <screen>
<para> "Dhcp4": { <userinput>"interfaces": [ "eth1", "eth3", "*" ]</userinput>, ... }</screen>
In order to override the default configuration, the existing entry can be replaced This configuration will tell the server to listen on all interfaces. It may be useful
with the actual interface name: to temporary add asterisk and retain the list of interface names.
<screen> </para>
&gt; <userinput>config set Dhcp4/interfaces[0] eth1</userinput> </section>
&gt; <userinput>config commit</userinput></screen>
Other interface names can be added on one-by-one basis:
<screen>
&gt; <userinput>config add Dhcp4/interfaces eth2</userinput>
&gt; <userinput>config commit</userinput></screen>
Configuration will now contain two interfaces which can be presented as follows:
<screen>
&gt; <userinput>config show Dhcp4/interfaces</userinput>
<userinput>Dhcp4/interfaces[0] "eth1" string</userinput>
<userinput>Dhcp4/interfaces[1] "eth2" string</userinput></screen>
When configuration gets committed, the server will start to listen on
eth1 and eth2 interfaces only.
</para>
<para>
It is possible to use wildcard interface name (asterisk) concurrently with explicit
interface names:
<screen>
&gt; <userinput>config add Dhcp4/interfaces *</userinput>
&gt; <userinput>config commit</userinput></screen>
This will result in the following configuration:
<screen>
&gt; <userinput>config show Dhcp4/interfaces</userinput>
<userinput>Dhcp4/interfaces[0] "eth1" string</userinput>
<userinput>Dhcp4/interfaces[1] "eth2" string</userinput>
<userinput>Dhcp4/interfaces[2] "*" string</userinput></screen>
The presence of the wildcard name implies that server will listen on all interfaces.
In order to fall back to the previous configuration when server listens on eth1 and eth2:
<screen>
&gt; <userinput>config remove Dhcp4/interfaces[2]</userinput>
&gt; <userinput>config commit</userinput></screen>
</para>
</section>
<section id="ipv4-subnet-id"> <section id="ipv4-subnet-id">
<title>IPv4 Subnet Identifier</title> <title>IPv4 Subnet Identifier</title>
<para> <para>
Subnet identifier is a unique number associated with a particular subnet. Subnet identifier is a unique number associated with a particular subnet.
In principle, it is used to associate clients' leases with respective subnets. In principle, it is used to associate clients' leases with respective subnets.
When subnet identifier is not specified for a subnet being configured, it will When subnet identifier is not specified for a subnet being configured, it will
be automatically assigned by the configuration mechanism. The identifiers be automatically assigned by the configuration mechanism. The identifiers
are assigned from 1 and are monotonically increased for each subsequent are assigned from 1 and are monotonically increased for each subsequent
subnet: 1, 2, 3 .... subnet: 1, 2, 3 ....
</para> </para>
<para> <para>
If there are multiple subnets configured with auto-generated identifiers and If there are multiple subnets configured with auto-generated identifiers and
one of them is removed, the subnet identifiers may be renumbered. For example: one of them is removed, the subnet identifiers may be renumbered. For example:
if there are 4 subnets and 3rd is removed the last subnet will be assigned if there are 4 subnets and 3rd is removed the last subnet will be assigned
identifier that the 3rd subnet had before removal. As a result, the leases identifier that the 3rd subnet had before removal. As a result, the leases
stored in the lease database for subnet 3 are now associated with the stored in the lease database for subnet 3 are now associated with the
subnet 4, which may have unexpected consequences. In the future it is planned subnet 4, which may have unexpected consequences. In the future it is planned
to implement the mechanism to preserve auto-generated subnet ids upon removal to implement the mechanism to preserve auto-generated subnet ids upon removal
of one of the subnets. Currently, the only remedy for this issue is to of one of the subnets. Currently, the only remedy for this issue is to
manually specify the unique subnet identifier for each subnet. manually specify the unique subnet identifier for each subnet.
</para> </para>
<para> <para>
The following configuration: The following configuration:
<screen> <screen>
&gt; <userinput>config add Dhcp4/subnet4</userinput> "Dhcp4": {
&gt; <userinput>config set Dhcp4/subnet4[0]/subnet "192.0.2.0/24"</userinput> "subnet4": [
&gt; <userinput>config set Dhcp4/subnet4[0]/id 1024</userinput> "subnet": "192.0.2.0/24",
&gt; <userinput>config commit</userinput> <userinput>"id": 1024</userinput>,
</screen> ...
will assign the arbitrary subnet identifier to the newly configured subnet. ]
This identifier will not change for this subnet until "id" parameter is }
removed or set to 0. The value of 0 forces auto-generation of subnet </screen>
identifier. will assign the arbitrary subnet identifier to the newly configured subnet.
</para> This identifier will not change for this subnet until "id" parameter is
</section> removed or set to 0. The value of 0 forces auto-generation of subnet
identifier.
</para>
<!-- @todo: describe whether database needs to be updated after changing
id -->
</section>
<section id="dhcp4-address-config"> <section id="dhcp4-address-config">
<title>Configuration of IPv4 Address Pools</title> <title>Configuration of IPv4 Address Pools</title>
<para> <para>
The essential role of DHCPv4 server is address assignment. The server The essential role of DHCPv4 server is address assignment. The server has to
has to be configured with at least one subnet and one pool of dynamic be configured with at least one subnet and one pool of dynamic addresses to
addresses to be managed. For example, assume that the server be managed. For example, assume that the server is connected to a network
is connected to a network segment that uses the 192.0.2.0/24 segment that uses the 192.0.2.0/24 prefix. The Administrator of that network
prefix. The Administrator of that network has decided that addresses from range has decided that addresses from range 192.0.2.10 to 192.0.2.20 are going to
192.0.2.10 to 192.0.2.20 are going to be managed by the Dhcp4 be managed by the Dhcp4 server. Such a configuration can be achieved in the
server. Such a configuration can be achieved in the following way: following way:
<screen> <screen>
&gt; <userinput>config add Dhcp4/subnet4</userinput> "Dhcp4": {
&gt; <userinput>config set Dhcp4/subnet4[0]/subnet "192.0.2.0/24"</userinput> <userinput>"subnet4": [
&gt; <userinput>config set Dhcp4/subnet4[0]/pool [ "192.0.2.10 - 192.0.2.20" ]</userinput> "subnet": "192.0.2.0/24",
&gt; <userinput>config commit</userinput></screen> "pool": [ "192.0.2.10 - 192.0.2.20" ]</userinput>,
Note that subnet is defined as a simple string, but the pool parameter ...
is actually a list of pools: for this reason, the pool definition is ]
enclosed in square brackets, even though only one range of addresses }</screen>
is specified.</para>
<para>It is possible to define more than one pool in a Note that subnet is defined as a simple string, but the pool parameter is
subnet: continuing the previous example, further assume that actually a list of pools: for this reason, the pool definition is enclosed
192.0.2.64/26 should be also be managed by the server. It could be written as in square brackets, even though only one range of addresses is
192.0.2.64 to 192.0.2.127. Alternatively, it can be expressed more simply as specified.</para>
192.0.2.64/26. Both formats are supported by Dhcp4 and can be mixed in the pool list.
For example, one could define the following pools: <para>It is possible to define more than one pool in a subnet: continuing
<screen> the previous example, further assume that 192.0.2.64/26 should be also be
&gt; <userinput>config set Dhcp4/subnet4[0]/pool [ "192.0.2.10-192.0.2.20", "192.0.2.64/26" ]</userinput> managed by the server. It could be written as 192.0.2.64 to
&gt; <userinput>config commit</userinput></screen> 192.0.2.127. Alternatively, it can be expressed more simply as
The number of pools is not limited, but for performance reasons it is recommended to 192.0.2.64/26. Both formats are supported by Dhcp4 and can be mixed in the
use as few as possible. Space and tabulations in pool definitions are ignored, so pool list. For example, one could define the following pools:
spaces before and after hyphen are optional. They can be used to improve readability. <screen>
</para> "Dhcp4": {
<para> "subnet4": [
The server may be configured to serve more than one subnet. To add a second subnet, <userinput>"pool": [ "192.0.2.10-192.0.2.20", "192.0.2.64/26" ]</userinput>,
use a command similar to the following: ...
<screen> ],
&gt; <userinput>config add Dhcp4/subnet4</userinput> ...
&gt; <userinput>config set Dhcp4/subnet4[1]/subnet "192.0.3.0/24"</userinput> }
&gt; <userinput>config set Dhcp4/subnet4[1]/pool [ "192.0.3.0/24" ]</userinput> </screen>
&gt; <userinput>config commit</userinput></screen> The number of pools is not limited, but for performance reasons it is recommended to
Arrays are counted from 0. subnet[0] refers to the subnet defined in the use as few as possible. Space and tabulations in pool definitions are ignored, so
previous example. The <command>config add Dhcp4/subnet4</command> command adds spaces before and after hyphen are optional. They can be used to improve readability.
another (second) subnet. It can be referred to as </para>
<command>Dhcp4/subnet4[1]</command>. In this example, we allow server to <para>
dynamically assign all addresses available in the whole subnet. The server may be configured to serve more than one subnet:
</para> <screen>
<para> "subnet4": [
When configuring a DHCPv4 server using prefix/length notation, please pay {
attention to the boundary values. When specifying that the server should use "subnet": "192.0.2.0/24",
a given pool, it will be able to allocate also first (typically network "pool": [ "192.0.2.1 - 192.0.2.200" ],
address) and the last (typically broadcast address) address from that pool. ...
In the aforementioned example of pool 192.0.3.0/24, both 192.0.3.0 and },
192.0.3.255 addresses may be assigned as well. This may be invalid in some {
network configurations. If you want to avoid this, please use the "min-max" notation. "subnet": "192.0.3.0/24",
</para> "pool": [ "192.0.3.100 - 192.0.3.200" ],
</section> ...
},
{
"subnet": "192.0.4.0/24",
"pool": [ "192.0.4.1 - 192.0.4.254" ],
...
}
]
</screen>
</para>
<para>
When configuring a DHCPv4 server using prefix/length notation, please pay
attention to the boundary values. When specifying that the server should use
a given pool, it will be able to allocate also first (typically network
address) and the last (typically broadcast address) address from that pool.
In the aforementioned example of pool 192.0.3.0/24, both 192.0.3.0 and
192.0.3.255 addresses may be assigned as well. This may be invalid in some
network configurations. If you want to avoid this, please use the "min-max" notation.
</para>
</section>
<section id="dhcp4-std-options"> <section id="dhcp4-std-options">
<title>Standard DHCPv4 options</title> <title>Standard DHCPv4 options</title>