multiple-options.json 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. // String options that have a comma in their values need to have
  81. // it escaped (i.e. each comma is predeced by two backslashes).
  82. // That's because commas are reserved for separating fields in
  83. // compound options. At the same time, we need to be conformant
  84. // with JSON spec, that does not allow "\,". Therefore the
  85. // slightly uncommon double backslashes notation is needed.
  86. // Legal JSON escapes are \ followed by "\/bfnrt character
  87. // or \u followed by 4 hexa-decimal numbers (currently Kea
  88. // supports only \u0000 to \u00ff code points).
  89. // CSV processing translates '\\' into '\' and '\,' into ','
  90. // only so for instance '\x' is translated into '\x'. But
  91. // as it works on a JSON string value each of these '\'
  92. // characters must be doubled on JSON input.
  93. {
  94. "name": "boot-file-name",
  95. "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
  96. },
  97. // Options that take integer values can either be specified in
  98. // dec or hex format. Hex format could be either plain (e.g. abcd)
  99. // or prefixed with 0x (e.g. 0xabcd).
  100. {
  101. "name": "default-ip-ttl",
  102. "data": "0xf0"
  103. }
  104. ]
  105. }
  106. ]
  107. },
  108. // The following configures logging. It assumes that messages with at least
  109. // informational level (info, warn, error and fatal) should be logged to stdout.
  110. "Logging": {
  111. "loggers": [
  112. {
  113. "name": "kea-dhcp4",
  114. "output_options": [
  115. {
  116. "output": "stdout"
  117. }
  118. ],
  119. "severity": "INFO"
  120. }
  121. ]
  122. }
  123. }