multiple-options.json 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. // This is an example configuration file for the DHCPv4 server in Kea.
  2. // It demonstrates simple configuration of the options for a subnet.
  3. { "Dhcp4":
  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 a lifetime of 4000 seconds.
  17. "valid-lifetime": 4000,
  18. // Renew and rebind timers are commented out. This implies that options
  19. // 58 and 59 will not be sent to the client. In this case it is up to
  20. // the client to pick the timer values according to RFC2131. Uncomment the
  21. // timers to send these options to the client.
  22. // "renew-timer": 1000,
  23. // "rebind-timer": 2000,
  24. // Defining a subnet. There are some DHCP options returned to the
  25. // clients connected to this subnet. The first and third options are
  26. // clients connected to this subnet. The first two options are
  27. // identified by the name. The third option is identified by the
  28. // option code.
  29. // There is an address pool defined within this subnet. Pool
  30. // specific value for option domain-name-servers is defined
  31. // for the pool.
  32. "subnet4": [
  33. {
  34. "subnet": "192.0.2.0/24",
  35. "option-data": [
  36. // When specifying options, you typically need to specify
  37. // one of (name or code) and data. The full option specification
  38. // covers name, code, space, csv-format and data.
  39. // space defaults to "dhcp4" which is usually correct, unless you
  40. // use encapsulate options. csv-format defaults to "true", so
  41. // this is also correct, unless you want to specify the whole
  42. // option value as long hex string. For example, to specify
  43. // domain-name-servers you could do this:
  44. // {
  45. // "name": "domain-name-servers",
  46. // "code": 6,
  47. // "csv-format": true,
  48. // "space": "dhcp4",
  49. // "data": "192.0.2.1, 192.0.2.2"
  50. // }
  51. // but it's a lot of writing, so it's easier to do this instead:
  52. {
  53. "name": "domain-name-servers",
  54. "data": "192.0.2.1, 192.0.2.2"
  55. },
  56. // Note the Kea provides some of the options on its own. In
  57. // particular:
  58. // - IP address lease time (option 51) is governed by
  59. // valid-lifetime parameter, so you don't need to specify
  60. // it as option.
  61. // - Subnet mask (option 1) is calculated automatically from the
  62. // subnet parameter specified for each "subnet4" entry.
  63. // - renewal-timer (option 58) is calculated from renew-timer
  64. // parameter
  65. // - rebind timer (option 59) is calculated from rebind-timer
  66. // parameter
  67. // For each IPv4 subnet you most likely need to specify at least
  68. // one router.
  69. {
  70. "name": "routers",
  71. "data": "192.0.2.1"
  72. },
  73. // Typically people prefer to refer to options by their
  74. // names, so they don't need to remember the code names.
  75. // However, some people like to use numerical values. For
  76. // example, option "domain-name" uses option code 15, so you
  77. // can reference to it either by
  78. // "name": "domain-name" or "code": 15.
  79. {
  80. "code": 15,
  81. "data": "example.org"
  82. },
  83. // Domain search is also a popular option. It tells the client to
  84. // attempt to resolve names within those specificed domains. For
  85. // example, name "foo" would be attempted to be resolved as
  86. // foo.mydomain.example.com and if it fails, then as
  87. // foo.example.com
  88. {
  89. "name": "domain-search",
  90. "data": "mydomain.example.com, example.com"
  91. },
  92. // Options can also be specified using hexadecimal format.
  93. // This should be avoided if possible, because Kea ability to
  94. // validate correctness is limited when using hex values.
  95. {
  96. "name": "broadcast-address",
  97. "csv-format": false,
  98. "data": "ffff8000"
  99. },
  100. // String options that have a comma in their values need to have
  101. // it escaped (i.e. each comma is preceded by two backslashes).
  102. // That's because commas are reserved for separating fields in
  103. // compound options. At the same time, we need to be conformant
  104. // with JSON spec, that does not allow "\,". Therefore the
  105. // slightly uncommon double backslashes notation is needed.
  106. // Legal JSON escapes are \ followed by "\/bfnrt character
  107. // or \u followed by 4 hexa-decimal numbers (currently Kea
  108. // supports only \u0000 to \u00ff code points).
  109. // CSV processing translates '\\' into '\' and '\,' into ','
  110. // only so for instance '\x' is translated into '\x'. But
  111. // as it works on a JSON string value each of these '\'
  112. // characters must be doubled on JSON input.
  113. {
  114. "name": "boot-file-name",
  115. "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
  116. },
  117. // Options that take integer values can either be specified in
  118. // dec or hex format. Hex format could be either plain (e.g. abcd)
  119. // or prefixed with 0x (e.g. 0xabcd).
  120. {
  121. "name": "default-ip-ttl",
  122. "data": "0xf0"
  123. },
  124. // At a few exceptions options are added to response only when
  125. // the client requests them. The always-send flag should be used
  126. // to enforce a particular option.
  127. {
  128. "name": "vendor-class-identifier",
  129. "data": "isc",
  130. "always-send": true
  131. }
  132. ],
  133. // Now we define pools. There are two pools here.
  134. "pools": [ {
  135. // This is the first pool. Nothing spectacular here, just a range
  136. // of addresses.
  137. "pool": "192.0.2.10 - 192.0.2.100"
  138. }, {
  139. // This second pool is more interesting. Anyone who gets an
  140. // address from this pool will also get this specific option
  141. // value if asks for DNS servers configuration. This value,
  142. // being more specific, overrides any values that were specified
  143. // on either global or subnet scope.
  144. "pool": "192.0.2.101 - 192.0.2.200",
  145. "option-data": [
  146. {
  147. "name": "domain-name-servers",
  148. "data": "192.0.2.3, 192.0.2.4"
  149. }
  150. ]
  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-dhcp4",
  161. "output_options": [
  162. {
  163. "output": "stdout"
  164. }
  165. ],
  166. "severity": "INFO"
  167. }
  168. ]
  169. }
  170. }