advanced.json 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. // This is an example configuration file for DHCPv4 server in Kea.
  2. // It covers some of the more advanced features. This file may not be coherent
  3. // as its main purpose is to demonstrate the features. They don't necessarily
  4. // have to make sense used together.
  5. // The new parser supports 3 comment styles:
  6. // This is C++ style.
  7. # This is a bash style.
  8. /* This is a C style comment. */
  9. /* C style comment
  10. can span
  11. multiple lines */
  12. { "Dhcp4":
  13. {
  14. // Kea is told to listen on ethX interface only.
  15. "interfaces-config": {
  16. "interfaces": [ "ethX" ],
  17. // This specifies what type of socket Kea uses. Currently supported
  18. // are 'raw' (which is the default) and 'udp'. Raw has the benefit
  19. // of receiving all traffic every time and a downside of bypassing
  20. // all firewall rules and having marginally bigger performance impact.
  21. // 'udp' is generally better if you have only relayed traffic. Kea
  22. // than opens up normal UDP socket and the kernel does all the
  23. // Ethernet/IP stack processing.
  24. "dhcp-socket-type": "udp",
  25. // This makes interfaces to be re-detected at each (re-)configuration.
  26. // By default it is true.
  27. "re-detect": true
  28. },
  29. // Option 43 last resort definition can make legal messages to be
  30. // rejected because they use not compatible "raw" value.
  31. // The option definition can be applied to avoid this problem.
  32. "option-def": [ {
  33. "name": "vendor-encapsulated-options",
  34. "code": 43,
  35. "type": "binary"
  36. } ],
  37. // We need to specify the the database used to store leases. As of
  38. // September 2016, four database backends are supported: MySQL,
  39. // PostgreSQL, Cassandra, and the in-memory database, Memfile.
  40. // We'll use memfile because it doesn't require any prior set up.
  41. // For memfile, it's important to always specify lfc-interval, so
  42. // the lease file would not grow without bounds and be sanitized
  43. // once per hour.
  44. "lease-database": {
  45. "type": "memfile",
  46. "lfc-interval": 3600
  47. },
  48. // This defines a control socket. If defined, Kea will open a UNIX socket
  49. // and will listen for incoming commands. See section 15 of the Kea User's
  50. // Guide for list of supported commands.
  51. "control-socket": {
  52. "socket-type": "unix",
  53. "socket-name": "/tmp/kea4-ctrl-socket"
  54. },
  55. // Addresses will be assigned with a lifetime of 4000 seconds.
  56. // The client is told to start renewing after 1000 seconds. If the server
  57. // does not respond within 2000 seconds of the lease being granted, client
  58. // is supposed to start REBIND procedure (emergency renewal that allows
  59. // switching to a different server).
  60. "valid-lifetime": 4000,
  61. "renew-timer": 1000,
  62. "rebind-timer": 2000,
  63. // RFC6842 says that the server is supposed to echo back client-id option.
  64. // However, some older clients do not support this and are getting confused
  65. // when they get their own client-id. Kea can disable RFC6842 support.
  66. "echo-client-id": false,
  67. // Some clients don't use stable client identifier, but rather
  68. // generate them during each boot. This may cause a client that
  69. // reboots frequently to get multiple leases, which may not be
  70. // desirable. As such, sometimes admins prefer to tell their DHCPv4
  71. // server to ignore client-id value altogether and rely exclusively
  72. // on MAC address. This is a parameter that is defined globally, but
  73. // can be overridden on a subnet level.
  74. "match-client-id": true,
  75. // The following list defines subnets. Each subnet consists of at
  76. // least subnet and pool entries. One extra feature that requires some
  77. // explanation is user-context. This is a structure that you can define
  78. // in subnets and pools. It is parsed by Kea, but not used directly.
  79. // It is intended to keep anything you may want to put there - comments,
  80. // extra designations, floor or department names etc. These structures
  81. // will be made available to Kea hooks.
  82. "subnet4": [
  83. {
  84. "pools": [ {
  85. "pool": "192.0.2.1 - 192.0.2.200",
  86. "user-context": { "info": "what a large pool" }
  87. } ],
  88. "subnet": "192.0.2.0/24",
  89. "user-context": {
  90. "comment": "Our first subnet!"
  91. }
  92. },
  93. {
  94. // This particular subnet has match-client-id value changed.
  95. // This causes Kea to ignore client-id values in this subnet
  96. // and rely exclusively on MAC addresses.
  97. "pools": [ { "pool": "192.0.3.100 - 192.0.3.200" } ],
  98. "subnet": "192.0.3.0/24",
  99. "match-client-id": false
  100. },
  101. {
  102. "pools": [ { "pool": "192.0.4.1 - 192.0.4.254" } ],
  103. "subnet": "192.0.4.0/24",
  104. // Sometimes the relay may use an IPv4 address that does
  105. // not match the subnet. This is discouraged, but there are
  106. // valid cases when it makes sense. One case is when there
  107. // is a shared subnet.
  108. "relay": {
  109. "ip-address": "192.168.1.1"
  110. }
  111. }
  112. ]
  113. },
  114. // The following configures logging. It assumes that messages with
  115. // at least informational level (info, warn, error and fatal) should
  116. // be logged to stdout.
  117. "Logging": {
  118. "loggers": [
  119. {
  120. "name": "kea-dhcp4",
  121. "output_options": [
  122. {
  123. "output": "stdout",
  124. // Several additional parameters are possible in addition
  125. // to the typical output. Flush determines whether logger
  126. // flushes output to a file. Maxsize determines maximum
  127. // filesize before the file is being rotated. maxver
  128. // specifies the maximum number of rotated files being
  129. // kept.
  130. "flush": true,
  131. "maxsize": 204800,
  132. "maxver": 4
  133. }
  134. ],
  135. "severity": "INFO"
  136. }
  137. ]
  138. }
  139. }