config.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 form of 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>A very simple configuration for both DHCPv4 and
  37. DHCPv6 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. # DHCPv4 specific configuration ends here.
  56. # DHCPv6 specific configuration starts here.
  57. "Dhcp6": {
  58. "interfaces-config": {
  59. "interfaces": [ "eth1" ]
  60. },
  61. "preferred-lifetime": 3000,
  62. "valid-lifetime": 4000,
  63. "renew-timer": 1000,
  64. "rebind-timer": 2000,
  65. "subnet6": [{
  66. "pools": [ { "pool": "2001:db8::/80" } ],
  67. "subnet": "2001:db8::/64"
  68. }]
  69. },
  70. # DHCPv6 specific configuration ends here.
  71. # Logger parameters (that could be shared among several components) start here.
  72. # This section is used by both the DHCPv4 and DHCPv6 servers.
  73. "Logging": {
  74. "loggers": [{
  75. "name": "*",
  76. "severity": "DEBUG"
  77. }]
  78. }
  79. # Logger parameters end here.
  80. # The whole configuration structure ends here.
  81. }
  82. </screen>
  83. </para>
  84. <para>More examples are available in the installed
  85. <filename>share/doc/kea/examples</filename> directory.</para>
  86. <para>To avoid repetition of mostly similar structures, examples in the
  87. rest of this guide will showcase only the subset of parameters appropriate for a given
  88. context. For example, when discussing the IPv6 subnets configuration in
  89. DHCPv6, only subnet6 parameters will be mentioned. It is implied that
  90. the remaining elements (the global map that holds Dhcp6, Logging and possibly
  91. DhcpDdns) are present, but they are omitted for clarity. Usually, locations
  92. where extra parameters may appear are denoted by an ellipsis.</para>
  93. </section>
  94. <section>
  95. <title>Simplified Notation</title>
  96. <para>It is sometimes convenient to refer to a specific element in the
  97. configuration hierarchy. Each hierarchy level is separated by a slash.
  98. If there is an array, a specific instance within that array is referenced by
  99. a number in square brackets (with numbering starting at zero). For example, in the above configuration the
  100. valid-lifetime in the Dhcp6 component can be referred to as
  101. Dhcp6/valid-lifetime and the pool in the first subnet defined in the DHCPv6
  102. configuration as Dhcp6/subnet6[0]/pool.</para>
  103. <!-- @todo Add a reference here after #3422 is done -->
  104. </section>
  105. </section>
  106. </chapter>