multiple-options.json 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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
  64. // names, so they don't need to remember the code
  65. // names. However, some people like to use numerical
  66. // values. For example, DHCPv6 can optionally use server
  67. // unicast communication, if extra option is present. Option
  68. // "unicast" uses option code 12, so you can reference to it
  69. // either by "name": "unicast" or "code": 12.
  70. {
  71. "code": 12,
  72. "data": "2001:db8:1:0:ff00::1"
  73. },
  74. // Options can also be specified using hexadecimal format.
  75. // This should be avoided if possible, because Kea ability to
  76. // validate correctness is limited when using hex values.
  77. {
  78. "name": "sntp-servers",
  79. "csv-format": false,
  80. "data": "20010db8000000000000000000000001"
  81. },
  82. // String options that have a comma in their values need to have
  83. // it escaped (i.e. each comma is preceded by two backslashes).
  84. // That's because commas are reserved for separating fields in
  85. // compound options. At the same time, we need to be conformant
  86. // with JSON spec, that does not allow "\,". Therefore the
  87. // slightly uncommon double backslashes notation is needed.
  88. // Legal JSON escapes are \ followed by "\/bfnrt character
  89. // or \u followed by 4 hexa-decimal numbers (currently Kea
  90. // supports only \u0000 to \u00ff code points).
  91. // CSV processing translates '\\' into '\' and '\,' into ','
  92. // only so for instance '\x' is translated into '\x'. But
  93. // as it works on a JSON string value each of these '\'
  94. // characters must be doubled on JSON input.
  95. {
  96. "name": "new-posix-timezone",
  97. "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
  98. },
  99. // Options that take integer values can either be specified in
  100. // dec or hex format. Hex format could be either plain (e.g. abcd)
  101. // or prefixed with 0x (e.g. 0xabcd).
  102. {
  103. "name": "preference",
  104. "data": "0xf0"
  105. },
  106. // A few options are encoded in (length, string) tuples
  107. // which can be defined using only strings as the CSV
  108. // processing computes lengths.
  109. {
  110. "name": "bootfile-param",
  111. "data": "root=/dev/sda2, quiet, splash"
  112. },
  113. // At a few exceptions options are added to response only when
  114. // the client requests them. The always-send flag should be used
  115. // to enforce a particular option.
  116. {
  117. "name": "pana-agent",
  118. "data": "2001:db8:2::123",
  119. "always-send": true
  120. }
  121. ],
  122. "pools": [
  123. {
  124. "pool": "2001:db8:1::1 - 2001:db8:1::100",
  125. "option-data": [
  126. {
  127. "code": 12,
  128. "data": "3001:cafe::21"
  129. }
  130. ]
  131. },
  132. {
  133. "pool": "2001:db8:1::500 - 2001:db8:1::1000"
  134. }
  135. ],
  136. "pd-pools": [
  137. {
  138. "prefix": "2001:2b8:2::",
  139. "prefix-len": 56,
  140. "delegated-len": 64,
  141. "option-data": [
  142. {
  143. "code": 12,
  144. "data": "3001:cafe::12"
  145. }
  146. ]
  147. }
  148. ],
  149. "subnet": "2001:db8:1::/64",
  150. "interface": "ethX"
  151. }
  152. ]
  153. },
  154. // The following configures logging. It assumes that messages with at
  155. // least informational level (info, warn, error and fatal) should be
  156. // logged to stdout.
  157. "Logging": {
  158. "loggers": [
  159. {
  160. "name": "kea-dhcp6",
  161. "output_options": [
  162. {
  163. "output": "stdout"
  164. }
  165. ],
  166. "debuglevel": 0,
  167. "severity": "INFO"
  168. }
  169. ]
  170. }
  171. }