reservations.json 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. // This is an example configuration file for DHCPv6 server in Kea
  2. // that showcases how to do host reservations. It is
  3. // assumed that one subnet (2001:db8:1::/64) is available directly
  4. // over ethX interface. A number of hosts have various combinations
  5. // of addresses and prefixes reserved for them.
  6. { "Dhcp6":
  7. {
  8. // Kea is told to listen on ethX interface only.
  9. "interfaces-config": {
  10. "interfaces": [ "ethX" ]
  11. },
  12. // We need to specify the the database used to store leases. As of
  13. // September 2016, four database backends are supported: MySQL,
  14. // PostgreSQL, Cassandra, and the in-memory database, Memfile.
  15. // We'll use memfile because it doesn't require any prior set up.
  16. "lease-database": {
  17. "type": "memfile",
  18. "lfc-interval": 3600
  19. },
  20. // This is pretty basic stuff, it has nothing to do with reservations.
  21. "preferred-lifetime": 3000,
  22. "valid-lifetime": 4000,
  23. "renew-timer": 1000,
  24. "rebind-timer": 2000,
  25. // Kea supports three types of identifiers in DHCPv6: hw-address (hardware/MAC
  26. // address of the client), duid (DUID inserted by the client) and flex-id
  27. // (flexible identifier available when flex_id hook library is loaded) When told
  28. // to do so, Kea can check for each of these identifier types, but it takes a
  29. // costly database lookup to do so. It is therefore useful from a performance
  30. // perspective to use only the reservation types that are actually used in a
  31. // given network.
  32. "host-reservation-identifiers": [ "duid", "hw-address", "flex-id" ],
  33. // The following list defines subnets. Subnet, pools and interface definitions
  34. // are the same as in the regular scenario, without host reservations.
  35. // least subnet and pool entries.
  36. "subnet6": [
  37. {
  38. "subnet": "2001:db8:1::/48",
  39. // This directive tells Kea that reservations may be made both in-pool
  40. // and out-of-pool. For improved performance, you may move all reservations
  41. // out of the dynamic pool and change reservation-mode to "out-of-pool".
  42. // Kea will then be able to skip querying for host reservations when
  43. // assigning leases from dynamic pool.
  44. "reservation-mode": "all",
  45. "pools": [ { "pool": "2001:db8:1::/120" } ],
  46. "pd-pools": [
  47. {
  48. "prefix": "2001:db8:1:8000::",
  49. "prefix-len": 56,
  50. "delegated-len": 64
  51. }
  52. ],
  53. "interface": "ethX",
  54. // Host reservations. Define several reservations, note that
  55. // they are all within the range of the pool of the dynamically
  56. // allocated address. The server will exclude the addresses from this
  57. // pool and only assign them to the client which has a reservation for
  58. // them.
  59. "reservations": [
  60. // This is a simple host reservation. The host with DUID matching
  61. // the specified value will get an address of 2001:db8:1::100.
  62. {
  63. "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
  64. "ip-addresses": [ "2001:db8:1::100" ]
  65. },
  66. // This is similar to the previous one, but this time the reservation
  67. // is done based on hardware/MAC address. The server will do its best to
  68. // extract the hardware/MAC address from received packets (see
  69. // 'mac-sources' directive for details). This particular reservation
  70. // also specifies two extra options to be available for this client. If
  71. // there are options with the same code specified in a global, subnet or
  72. // class scope, the values defined at host level take precedence.
  73. {
  74. "hw-address": "00:01:02:03:04:05",
  75. "ip-addresses": [ "2001:db8:1::101" ],
  76. "option-data": [
  77. {
  78. "name": "dns-servers",
  79. "data": "3000:1::234"
  80. },
  81. {
  82. "name": "nis-servers",
  83. "data": "3000:1::234"
  84. }],
  85. "client-classes": [ "special_snowflake", "office" ]
  86. },
  87. // This is a bit more advanced reservation. The client with the specified
  88. // DUID will get a reserved address, a reserved prefix and a hostname.
  89. // This reservation is for an address that it not within the dynamic pool.
  90. // Finally, this reservation features vendor specific options for CableLabs,
  91. // which happen to use enterprise-id 4491. Those particular values will
  92. // be returned only to the client that has a DUID matching this reservation.
  93. {
  94. "duid": "01:02:03:04:05:06:07:08:09:0A",
  95. "ip-addresses": [ "2001:db8:1:cafe::1" ],
  96. "prefixes": [ "2001:db8:2:abcd::/64" ],
  97. "hostname": "foo.example.com",
  98. "option-data": [ {
  99. "name": "vendor-opts",
  100. "data": "4491"
  101. },
  102. {
  103. "name": "tftp-servers",
  104. "space": "vendor-4491",
  105. "data": "3000:1::234"
  106. } ]
  107. },
  108. // This reservation is using flexible identifier. Instead of relying
  109. // on specific field, sysadmin can define an expression similar to what
  110. // is used for client classification,
  111. // e.g. substring(relay[0].option[17],0,6). Then, based on the value of
  112. // that expression for incoming packet, the reservation is matched.
  113. // Expression can be specified either as hex or plain text using single
  114. // quotes.
  115. // Note: flexible identifier requires flex_id hook library to be
  116. //loaded to work.
  117. {
  118. "flex-id": "'somevalue'",
  119. "ip-addresses": [ "2001:db8:1:cafe::2" ]
  120. }
  121. ]
  122. }
  123. ]
  124. },
  125. // The following configures logging. It assumes that messages with at
  126. // least informational level (info, warn, error and fatal) should be
  127. // logged to stdout.
  128. "Logging": {
  129. "loggers": [
  130. {
  131. "name": "kea-dhcp6",
  132. "output_options": [
  133. {
  134. "output": "stdout"
  135. }
  136. ],
  137. "debuglevel": 0,
  138. "severity": "INFO"
  139. }
  140. ]
  141. }
  142. }