reservations.json 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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. "pools": [ { "pool": "2001:db8:1::/120" } ],
  40. "pd-pools": [
  41. {
  42. "prefix": "2001:db8:1:8000::",
  43. "prefix-len": 56,
  44. "delegated-len": 64
  45. }
  46. ],
  47. "interface": "ethX",
  48. "reservation-mode": "out-of-pool",
  49. // Host reservations. Define several reservations, note that
  50. // they are all within the range of the pool of the dynamically
  51. // allocated address. The server will exclude the addresses from this
  52. // pool and only assign them to the client which has a reservation for
  53. // them.
  54. "reservations": [
  55. // This is a simple host reservation. The host with DUID matching
  56. // the specified value will get an address of 2001:db8:1::100.
  57. {
  58. "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
  59. "ip-addresses": [ "2001:db8:1::100" ]
  60. },
  61. // This is similar to the previous one, but this time the reservation
  62. // is done based on hardware/MAC address. The server will do its best to
  63. // extract the hardware/MAC address from received packets (see
  64. // 'mac-sources' directive for details). This particular reservation
  65. // also specifies two extra options to be available for this client. If
  66. // there are options with the same code specified in a global, subnet or
  67. // class scope, the values defined at host level take precedence.
  68. {
  69. "hw-address": "00:01:02:03:04:05",
  70. "ip-addresses": [ "2001:db8:1::101" ],
  71. "option-data": [
  72. {
  73. "name": "dns-servers",
  74. "data": "3000:1::234"
  75. },
  76. {
  77. "name": "nis-servers",
  78. "data": "3000:1::234"
  79. }],
  80. "client-classes": [ "special_snowflake", "office" ]
  81. },
  82. // This is a bit more advanced reservation. The client with the specified
  83. // DUID will get a reserved address, a reserved prefix and a hostname.
  84. // This reservation is for an address that it not within the dynamic pool.
  85. // Finally, this reservation features vendor specific options for CableLabs,
  86. // which happen to use enterprise-id 4491. Those particular values will
  87. // be returned only to the client that has a DUID matching this reservation.
  88. {
  89. "duid": "01:02:03:04:05:06:07:08:09:0A",
  90. "ip-addresses": [ "2001:db8:1:cafe::1" ],
  91. "prefixes": [ "2001:db8:2:abcd::/64" ],
  92. "hostname": "foo.example.com",
  93. "option-data": [ {
  94. "name": "vendor-opts",
  95. "data": "4491"
  96. },
  97. {
  98. "name": "tftp-servers",
  99. "space": "vendor-4491",
  100. "data": "3000:1::234"
  101. } ]
  102. },
  103. // This reservation is using flexible identifier. Instead of relying
  104. // on specific field, sysadmin can define an expression similar to what
  105. // is used for client classification,
  106. // e.g. substring(relay[0].option[17],0,6). Then, based on the value of
  107. // that expression for incoming packet, the reservation is matched.
  108. // Expression can be specified either as hex or plain text using single
  109. // quotes.
  110. // Note: flexible identifier requires flex_id hook library to be
  111. //loaded to work.
  112. {
  113. "flex-id": "'somevalue'",
  114. "ip-addresses": [ "2001:db8:1:cafe::2" ]
  115. }
  116. ]
  117. }
  118. ]
  119. },
  120. // The following configures logging. It assumes that messages with at
  121. // least informational level (info, warn, error and fatal) should be
  122. // logged to stdout.
  123. "Logging": {
  124. "loggers": [
  125. {
  126. "name": "kea-dhcp6",
  127. "output_options": [
  128. {
  129. "output": "stdout"
  130. }
  131. ],
  132. "debuglevel": 0,
  133. "severity": "INFO"
  134. }
  135. ]
  136. }
  137. }