config.xml 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
  4. <!ENTITY mdash "&#x2014;" >
  5. ]>
  6. <chapter id="kea-config">
  7. <title>Kea Configuration</title>
  8. <para>Kea is designed to allow different methods by which it can be
  9. configured, each method being implemented by a component known as a
  10. configuration backend. At present, only one such backend is
  11. available, that allowing configuration by means of a JSON file.</para>
  12. <section id="json-backend">
  13. <title>JSON Configuration Backend</title>
  14. <para>JSON is the default configuration backend.
  15. It assumes that the servers are started from the command line
  16. (either directly or using a script, e.g. <filename>keactrl</filename>).
  17. The JSON backend uses certain signals to influence Kea. The
  18. configuration file is specified upon startup using the -c parameter.</para>
  19. <section id="json-format">
  20. <title>JSON Syntax</title>
  21. <para>Configuration files for DHCPv4, DHCPv6 and DDNS modules are defined
  22. in an extended JSON format. Basic JSON is defined in <ulink
  23. url="http://tools.ietf.org/html/rfc4627">RFC 4627</ulink>. Kea components
  24. use an extended JSON with additional features allowed:
  25. in that they allow shell-style
  26. <itemizedlist>
  27. <listitem>
  28. <simpara>shell comments: any text after the hash (#)
  29. character is ignored. Dhcp6 allows # in any column, while
  30. Dhcp4 and Ddns require hash to be in the first
  31. column.</simpara>
  32. </listitem>
  33. <listitem>
  34. <simpara>C comments: any text after the double slashes (//)
  35. character is ignored. We're in a process of
  36. migrating the configuation parsers and currently only Dhcp6
  37. supports this feature.</simpara>
  38. </listitem>
  39. <listitem>
  40. <simpara>Multiline comments: any text between /* and */ is
  41. ignored. This commenting can span multiple lines. We're in a
  42. process of migrating the configuation parsers and currently
  43. only Dhcp6 supports this feature.</simpara>
  44. </listitem>
  45. <listitem>
  46. <simpara>File inclusion: JSON files can include other JSON
  47. files. This can be done by using &lt;?include
  48. "file.json"?&gt;. We're in a process of migrating the
  49. configuation parsers and currently only Dhcp6 supports this
  50. feature.</simpara>
  51. </listitem>
  52. </itemizedlist>
  53. </para>
  54. <para>The configuration file consists of a single object (often colloquially
  55. called a map) started with a curly bracket. It comprises the "Dhcp4", "Dhcp6",
  56. "DhcpDdns" and/or "Logging" objects. It is possible to define additional
  57. elements, but they will be ignored. For example, it is possible to define
  58. Dhcp4, Dhcp6 and Logging elements in a single configuration file that can
  59. be used to start both the DHCPv4 and DHCPv6 components. When starting,
  60. the DHCPv4 component will use Dhcp4 object to configure itself and the
  61. Logging object to configure logging parameters; it will ignore the Dhcp6
  62. object.</para>
  63. <para>A very simple configuration for both DHCPv4 and
  64. DHCPv6 could look like this:
  65. <screen>
  66. # The whole configuration starts here.
  67. {
  68. # DHCPv4 specific configuration starts here.
  69. "Dhcp4": {
  70. "interfaces-config": {
  71. "interfaces": [ "eth0" ],
  72. "dhcp-socket-type": "raw"
  73. },
  74. "valid-lifetime": 4000,
  75. "renew-timer": 1000,
  76. "rebind-timer": 2000,
  77. "subnet4": [{
  78. "pools": [ { "pool": "192.0.2.1-192.0.2.200" } ],
  79. "subnet": "192.0.2.0/24"
  80. }]
  81. },
  82. # DHCPv4 specific configuration ends here.
  83. # DHCPv6 specific configuration starts here.
  84. "Dhcp6": {
  85. "interfaces-config": {
  86. "interfaces": [ "eth1" ]
  87. },
  88. "preferred-lifetime": 3000,
  89. "valid-lifetime": 4000,
  90. "renew-timer": 1000,
  91. "rebind-timer": 2000,
  92. "subnet6": [{
  93. "pools": [ { "pool": "2001:db8::/80" } ],
  94. "subnet": "2001:db8::/64"
  95. }]
  96. },
  97. # DHCPv6 specific configuration ends here.
  98. # Logger parameters (that could be shared among several components) start here.
  99. # This section is used by both the DHCPv4 and DHCPv6 servers.
  100. "Logging": {
  101. "loggers": [{
  102. "name": "*",
  103. "severity": "DEBUG"
  104. }]
  105. }
  106. # Logger parameters end here.
  107. # The whole configuration structure ends here.
  108. }
  109. </screen>
  110. </para>
  111. <para>More examples are available in the installed
  112. <filename>share/doc/kea/examples</filename> directory.</para>
  113. <para>To avoid repetition of mostly similar structures, examples in the
  114. rest of this guide will showcase only the subset of parameters appropriate for a given
  115. context. For example, when discussing the IPv6 subnets configuration in
  116. DHCPv6, only subnet6 parameters will be mentioned. It is implied that
  117. the remaining elements (the global map that holds Dhcp6, Logging and possibly
  118. DhcpDdns) are present, but they are omitted for clarity. Usually, locations
  119. where extra parameters may appear are denoted by an ellipsis.</para>
  120. </section>
  121. <section>
  122. <title>Simplified Notation</title>
  123. <para>It is sometimes convenient to refer to a specific element in the
  124. configuration hierarchy. Each hierarchy level is separated by a slash.
  125. If there is an array, a specific instance within that array is referenced by
  126. a number in square brackets (with numbering starting at zero). For example, in the above configuration the
  127. valid-lifetime in the Dhcp6 component can be referred to as
  128. Dhcp6/valid-lifetime and the pool in the first subnet defined in the DHCPv6
  129. configuration as Dhcp6/subnet6[0]/pool.</para>
  130. <!-- @todo Add a reference here after #3422 is done -->
  131. </section>
  132. </section>
  133. </chapter>