multiple-options.json 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 3 DHCP options returned to the
  25. // clients connected to this subnet. The first two options are
  26. // identified by the name. The third option is identified by the
  27. // option code.
  28. "subnet4": [
  29. {
  30. "pools": [ { "pool": "192.0.2.10 - 192.0.2.200" } ],
  31. "subnet": "192.0.2.0/24",
  32. "interface": "ethX",
  33. // This is how option values are defined for this particular subnet.
  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. // Options that take integer values can either be specified in
  81. // dec or hex format. Hex format could be either plain (e.g. abcd)
  82. // or prefixed with 0x (e.g. 0xabcd).
  83. {
  84. "name": "default-ip-ttl",
  85. "data": "0xf0"
  86. }
  87. ]
  88. }
  89. ]
  90. },
  91. // The following configures logging. It assumes that messages with at least
  92. // informational level (info, warn, error and fatal) should be logged to stdout.
  93. "Logging": {
  94. "loggers": [
  95. {
  96. "name": "kea-dhcp4",
  97. "output_options": [
  98. {
  99. "output": "stdout"
  100. }
  101. ],
  102. "severity": "INFO"
  103. }
  104. ]
  105. }
  106. }