config.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 a slightly modified JSON, in that they allow shell-style
  25. comments in the file: lines with the hash (#) character in the first column
  26. are comment lines and are ignored.</para>
  27. <para>The configuration file consists of a single object (often colloquially
  28. called a map) started with a curly bracket. It comprises the "Dhcp4", "Dhcp6",
  29. "DhcpDdns" and/or "Logging" objects. It is possible to define additional
  30. elements, but they will be ignored. For example, it is possible to define
  31. Dhcp4, Dhcp6 and Logging elements in a single configuration file that can
  32. be used to start both the DHCPv4 and DHCPv6 components. When starting,
  33. the DHCPv4 component will use Dhcp4 object to configure itself and the
  34. Logging object to configure logging parameters; it will ignore the Dhcp6
  35. object.</para>
  36. <para>For example, a very simple configuration for both DHCPv4 and DHCPv6
  37. could look like this:
  38. <screen>
  39. # The whole configuration starts here.
  40. {
  41. # DHCPv4 specific configuration starts here.
  42. "Dhcp4": {
  43. "interfaces-config": {
  44. "interfaces": [ "eth0" ],
  45. "dhcp-socket-type": "raw"
  46. },
  47. "valid-lifetime": 4000,
  48. "renew-timer": 1000,
  49. "rebind-timer": 2000,
  50. "subnet4": [{
  51. "pools": [ { "pool": "192.0.2.1-192.0.2.200" } ],
  52. "subnet": "192.0.2.0/24"
  53. }],
  54. ...
  55. },
  56. # DHCPv4 specific configuration ends here.
  57. # DHCPv6 specific configuration starts here.
  58. "Dhcp6": {
  59. "interfaces-config": {
  60. "interfaces": [ "eth1" ]
  61. },
  62. "preferred-lifetime": 3000,
  63. "valid-lifetime": 4000,
  64. "renew-timer": 1000,
  65. "rebind-timer": 2000,
  66. "subnet6": [{
  67. "pools": [ { "pool": "2001:db8::/80" } ],
  68. "subnet": "2001:db8::/64"
  69. }],
  70. ...
  71. },
  72. # DHCPv6 specific configuration ends here.
  73. # Logger parameters (that could be shared among several components) start here.
  74. # This section is used by both the DHCPv4 and DHCPv6 servers.
  75. "Logging": {
  76. "loggers": [{
  77. "name": "*",
  78. "severity": "DEBUG"
  79. }],
  80. ...
  81. }
  82. # Logger parameters end here.
  83. # The whole configuration structure ends here.
  84. }
  85. </screen>
  86. </para>
  87. <para>More examples are available in the installed
  88. <filename>share/doc/kea/examples</filename> directory.</para>
  89. <para>To avoid repetition of mostly similar structures, examples in the
  90. rest of this guide will showcase only the subset of parameters appropriate for a given
  91. context. For example, when discussing the IPv6 subnets configuration in
  92. DHCPv6, only subnet6 parameters will be mentioned. It is implied that
  93. the remaining elements (the global map that holds Dhcp6, Logging and possibly
  94. DhcpDdns) are present, but they are omitted for clarity. Usually, locations
  95. where extra parameters may appear are denoted with an ellipsis.</para>
  96. </section>
  97. <section>
  98. <title>Simplified Notation</title>
  99. <para>It is sometimes convenient to refer to a specific element in the
  100. configuration hierarchy. Each hierarchy level is separated by a slash.
  101. If there is an array, a specific instance within that array is referenced by
  102. a number in square brackets (with numbering starting at zero). For example, in the above configuration the
  103. valid-lifetime in the Dhcp6 component can be referred to as
  104. Dhcp6/valid-lifetime and the pool in the first subnet defined in the DHCPv6
  105. configuration as Dhcp6/subnet6[0]/pool.</para>
  106. <!-- @todo Add a reference here after #3422 is done -->
  107. </section>
  108. </section>
  109. </chapter>