multiple-options.json 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. // This is an example configuration file for DHCPv6 server in Kea.
  2. // It demonstrates simple configuration of the options for a subnet.
  3. { "Dhcp6":
  4. {
  5. // Kea is told to listen on ethX interface only.
  6. "interfaces-config": {
  7. "interfaces": [ "ethX" ]
  8. },
  9. // We need to specify the the database used to store leases. As of
  10. // September 2016, four database backends are supported: MySQL,
  11. // PostgreSQL, Cassandra, and the in-memory database, Memfile.
  12. // We'll use memfile because it doesn't require any prior set up.
  13. "lease-database": {
  14. "type": "memfile"
  15. },
  16. // Addresses will be assigned with preferred and valid lifetimes
  17. // being 3000 and 4000, respectively. Client is told to start
  18. // 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. "preferred-lifetime": 3000,
  23. "valid-lifetime": 4000,
  24. "renew-timer": 1000,
  25. "rebind-timer": 2000,
  26. // Defining a subnet. There are some DHCP options returned to the
  27. // clients connected to this subnet. The first option is identified
  28. // by the name. The second option is identified by the code.
  29. // There are two address pools defined within this subnet. Pool
  30. // specific value for option 12 is defined for the pool:
  31. // 2001:db8:1::1 - 2001:db8:1::100. Clients obtaining an address
  32. // from this pool will be assigned option 12 with a value of
  33. // 3001:cafe::21. Clients belonging to this subnet but obtaining
  34. // addresses from the other pool, or the clients obtaining
  35. // stateless configuration will be assigned subnet specific value
  36. // of option 12, i.e. 2001:db8:1:0:ff00::1.
  37. // For DHCPv6 subnets can have prefix delegation pools too so
  38. // a pd-pools with an option-data is defined too.
  39. "subnet6": [
  40. {
  41. // This is how option values are defined for this particular subnet.
  42. "option-data": [
  43. // When specifying options, you typically need to specify
  44. // one of (name or code) and data. The full option specification
  45. // covers name, code, space, csv-format and data.
  46. // space defaults to "dhcp6" which is usually correct, unless you
  47. // use encapsulate options. csv-format defaults to "true", so
  48. // this is also correct, unless you want to specify the whole
  49. // option value as long hex string. For example, to specify
  50. // domain-name-servers you could do this:
  51. // {
  52. // "name": "dns-servers",
  53. // "code": 23,
  54. // "csv-format": "true",
  55. // "space": "dhcp6",
  56. // "data": "2001:db8:2::45, 2001:db8:2::100"
  57. // }
  58. // but it's a lot of writing, so it's easier to do this instead:
  59. {
  60. "name": "dns-servers",
  61. "data": "2001:db8:2::45, 2001:db8:2::100"
  62. },
  63. // Typically people prefer to refer to options by their names, so they
  64. // don't need to remember the code names. However, some people like
  65. // to use numerical values. For example, DHCPv6 can optionally use
  66. // server unicast communication, if extra option is present. Option
  67. // "unicast" uses option code 12, so you can reference to it either
  68. // by "name": "unicast" or "code": 12.
  69. {
  70. "code": 12,
  71. "data": "2001:db8:1:0:ff00::1"
  72. },
  73. // String options that have a comma in their values need to have
  74. // it escaped (i.e. each comma is predeced by two backslashes).
  75. // That's because commas are reserved for separating fields in
  76. // compound options. At the same time, we need to be conformant
  77. // with JSON spec, that does not allow "\,". Therefore the
  78. // slightly uncommon double backslashes notation is needed.
  79. // Legal JSON escapes are \ followed by "\/bfnrt character
  80. // or \u followed by 4 hexa-decimal numbers (currently Kea
  81. // supports only \u0000 to \u00ff code points).
  82. // CSV processing translates '\\' into '\' and '\,' into ','
  83. // only so for instance '\x' is translated into '\x'. But
  84. // as it works on a JSON string value each of these '\'
  85. // characters must be doubled on JSON input.
  86. {
  87. "name": "new-posix-timezone",
  88. "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
  89. },
  90. // Options that take integer values can either be specified in
  91. // dec or hex format. Hex format could be either plain (e.g. abcd)
  92. // or prefixed with 0x (e.g. 0xabcd).
  93. {
  94. "name": "preference",
  95. "data": "0xf0"
  96. },
  97. // A few options are encoded in (length, string) tuples
  98. // which can be defined using only strings as the CSV
  99. // processing computes lengths.
  100. {
  101. "name": "bootfile-param",
  102. "data": "root=/dev/sda2, quiet, splash"
  103. }
  104. ],
  105. "pools": [
  106. {
  107. "pool": "2001:db8:1::1 - 2001:db8:1::100",
  108. "option-data": [
  109. {
  110. "code": 12,
  111. "data": "3001:cafe::21"
  112. }
  113. ]
  114. },
  115. {
  116. "pool": "2001:db8:1::500 - 2001:db8:1::1000"
  117. }
  118. ],
  119. "pd-pools": [
  120. {
  121. "prefix": "2001:2b8:2::",
  122. "prefix-len": 56,
  123. "delegated-len": 64,
  124. "option-data": [
  125. {
  126. "code": 12,
  127. "data": "3001:cafe::12:"
  128. }
  129. ]
  130. }
  131. ],
  132. "subnet": "2001:db8:1::/64",
  133. "interface": "ethX"
  134. }
  135. ]
  136. },
  137. // The following configures logging. It assumes that messages with at least
  138. // informational level (info, warn, error and fatal) should be logged to stdout.
  139. "Logging": {
  140. "loggers": [
  141. {
  142. "name": "kea-dhcp6",
  143. "output_options": [
  144. {
  145. "output": "stdout"
  146. }
  147. ],
  148. "debuglevel": 0,
  149. "severity": "INFO"
  150. }
  151. ]
  152. }
  153. }