multiple-options.json 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. "subnet4": [
  30. {
  31. "pools": [ { "pool": "192.0.2.10 - 192.0.2.200" } ],
  32. "subnet": "192.0.2.0/24",
  33. "interface": "ethX",
  34. "option-data": [
  35. // When specifying options, you typically need to specify
  36. // one of (name or code) and data. The full option specification
  37. // covers name, code, space, csv-format and data.
  38. // space defaults to "dhcp4" which is usually correct, unless you
  39. // use encapsulate options. csv-format defaults to "true", so
  40. // this is also correct, unless you want to specify the whole
  41. // option value as long hex string. For example, to specify
  42. // domain-name-servers you could do this:
  43. // {
  44. // "name": "domain-name-servers",
  45. // "code": 6,
  46. // "csv-format": "true",
  47. // "space": "dhcp4",
  48. // "data": "192.0.2.1, 192.0.2.2"
  49. // }
  50. // but it's a lot of writing, so it's easier to do this instead:
  51. {
  52. "name": "domain-name-servers",
  53. "data": "192.0.2.1, 192.0.2.2"
  54. },
  55. // Note the Kea provides some of the options on its own. In
  56. // particular:
  57. // - IP address lease time (option 51) is governed by valid-lifetime
  58. // parameter, so you don't need to specify it as option.
  59. // - Subnet mask (option 1) is calculated automatically from the
  60. // subnet parameter specified for each "subnet4" entry.
  61. // - renewal-timer (option 58) is calculated from renew-timer
  62. // parameter
  63. // - rebind timer (option 59) is calculated from rebind-timer
  64. // parameter
  65. // For each IPv4 subnet you most likely need to specify at least
  66. // one router.
  67. {
  68. "name": "routers",
  69. "data": "192.0.2.1"
  70. },
  71. // Typically people prefer to refer to options by their names, so they
  72. // don't need to remember the code names. However, some people like
  73. // to use numerical values. For example, option "domain-name" uses
  74. // option code 15, so you can reference to it either by
  75. // "name": "domain-name" or "code": 15.
  76. {
  77. "code": 15,
  78. "data": "example.org"
  79. },
  80. // Domain search is also a popular option. It tells the client to
  81. // attempt to resolve names within those specificed domains. For
  82. // example, name "foo" would be attempted to be resolved as
  83. // foo.mydomain.example.com and if it fails, then as foo.example.com
  84. {
  85. "name": "domain-search",
  86. "data": "mydomain.example.com, example.com"
  87. },
  88. // String options that have a comma in their values need to have
  89. // it escaped (i.e. each comma is predeced by two backslashes).
  90. // That's because commas are reserved for separating fields in
  91. // compound options. At the same time, we need to be conformant
  92. // with JSON spec, that does not allow "\,". Therefore the
  93. // slightly uncommon double backslashes notation is needed.
  94. // Legal JSON escapes are \ followed by "\/bfnrt character
  95. // or \u followed by 4 hexa-decimal numbers (currently Kea
  96. // supports only \u0000 to \u00ff code points).
  97. // CSV processing translates '\\' into '\' and '\,' into ','
  98. // only so for instance '\x' is translated into '\x'. But
  99. // as it works on a JSON string value each of these '\'
  100. // characters must be doubled on JSON input.
  101. {
  102. "name": "boot-file-name",
  103. "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
  104. },
  105. // Options that take integer values can either be specified in
  106. // dec or hex format. Hex format could be either plain (e.g. abcd)
  107. // or prefixed with 0x (e.g. 0xabcd).
  108. {
  109. "name": "default-ip-ttl",
  110. "data": "0xf0"
  111. }
  112. ]
  113. }
  114. ]
  115. },
  116. // The following configures logging. It assumes that messages with at least
  117. // informational level (info, warn, error and fatal) should be logged to stdout.
  118. "Logging": {
  119. "loggers": [
  120. {
  121. "name": "kea-dhcp4",
  122. "output_options": [
  123. {
  124. "output": "stdout"
  125. }
  126. ],
  127. "severity": "INFO"
  128. }
  129. ]
  130. }
  131. }