summaryrefslogtreecommitdiffstats
path: root/doc/examples/kea6/multiple-options.json
blob: b6d8be857cdbfdb64e891b1a566e9200ae6f16b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// This is an example configuration file for DHCPv6 server in Kea.
// It demonstrates simple configuration of the options for a subnet.

{ "Dhcp6":

{
// Kea is told to listen on eth0 interface only.
  "interfaces-config": {
    "interfaces": [ "eth0" ]
  },

// We need to specify the database used to store leases. As of
// June 2022, three database backends are supported: MySQL,
// PostgreSQL and the in-memory database, Memfile.
// We'll use memfile  because it doesn't require any prior set up.
  "lease-database": {
    "type": "memfile"
  },

// Addresses will be assigned with preferred and valid lifetimes
// being 3000 and 4000, respectively. Client is told to start
// renewing after 1000 seconds. If the server does not respond
// after 2000 seconds since the lease was granted, client is supposed
// to start REBIND procedure (emergency renewal that allows switching
// to a different server).
  "preferred-lifetime": 3000,
  "valid-lifetime": 4000,
  "renew-timer": 1000,
  "rebind-timer": 2000,

// Defining a subnet. There are some DHCP options returned to the
// clients connected to this subnet. The first option is identified
// by the name. The second option is identified by the code.
// There are two address pools defined within this subnet. Pool
// specific value for option 12 is defined for the pool:
// 2001:db8:1::1 - 2001:db8:1::100. Clients obtaining an address
// from this pool will be assigned option 12 with a value of
// 3001:cafe::21. Clients belonging to this subnet but obtaining
// addresses from the other pool, or the clients obtaining
// stateless configuration will be assigned subnet specific value
// of option 12, i.e. 2001:db8:1:0:ff00::1.
// For DHCPv6 subnets can have prefix delegation pools too so
// a pd-pools with an option-data is defined too.
  "subnet6": [
    {
        // This is how option values are defined for this particular subnet.
        "option-data": [
            // When specifying options, you typically need to specify
            // one of (name or code) and data. The full option specification
            // covers name, code, space, csv-format and data.
            // space defaults to "dhcp6" which is usually correct, unless you
            // use encapsulate options. csv-format defaults to "true", so
            // this is also correct, unless you want to specify the whole
            // option value as long hex string. For example, to specify
            // domain-name-servers you could do this:
            // {
            //     "name": "dns-servers",
            //     "code": 23,
            //     "csv-format": true,
            //     "space": "dhcp6",
            //     "data": "2001:db8:2::45, 2001:db8:2::100"
            // }
            // but it's a lot of writing, so it's easier to do this instead:
            {
                "name": "dns-servers",
                "data": "2001:db8:2::45, 2001:db8:2::100"
            },

            // Typically people prefer to refer to options by their
            // names, so they don't need to remember the code
            // names. However, some people like to use numerical
            // values. For example, DHCPv6 can optionally use server
            // unicast communication, if extra option is present. Option
            // "unicast" uses option code 12, so you can reference to it
            // either by "name": "unicast" or "code": 12.
            {
                "code": 12,
                "data": "2001:db8:1:0:ff00::1"
            },

            // Options can also be specified using hexadecimal format.
            // This should be avoided if possible, because Kea ability to
            // validate correctness is limited when using hex values.
            {
                "name": "sntp-servers",
                "csv-format": false,
                "data": "20010db8000000000000000000000001"
            },

            // String options that have a comma in their values need to have
            // it escaped (i.e. each comma is preceded by two backslashes).
            // That's because commas are reserved for separating fields in
            // compound options. At the same time, we need to be conformant
            // with JSON spec, that does not allow "\,". Therefore the
            // slightly uncommon double backslashes notation is needed.

            // Legal JSON escapes are \ followed by "\/bfnrt character
            // or \u followed by 4 hexa-decimal numbers (currently Kea
            // supports only \u0000 to \u00ff code points).
            // CSV processing translates '\\' into '\' and '\,' into ','
            // only so for instance '\x' is translated into '\x'. But
            // as it works on a JSON string value each of these '\'
            // characters must be doubled on JSON input.
            {
                "name": "new-posix-timezone",
                "data": "EST5EDT4\\,M3.2.0/02:00\\,M11.1.0/02:00"
            },

            // Options that take integer values can either be specified in
            // dec or hex format. Hex format could be either plain (e.g. abcd)
            // or prefixed with 0x (e.g. 0xabcd).
            {
                "name": "preference",
                "data": "0xf0"
            },

            // A few options are encoded in (length, string) tuples
            // which can be defined using only strings as the CSV
            // processing computes lengths.
            {
                "name": "bootfile-param",
                "data": "root=/dev/sda2, quiet, splash"
            },

            // At a few exceptions options are added to response only when
            // the client requests them. The always-send flag should be used
            // to enforce a particular option.
            {
                "name": "pana-agent",
                "data": "2001:db8:2::123",
                "always-send": true
            }
      ],
      "pools": [
        {
            "pool": "2001:db8:1::1 - 2001:db8:1::100",
            "option-data": [
              {
                  "code": 12,
                  "data": "3001:cafe::21"
              }
            ]
        },
        {
            "pool": "2001:db8:1::500 - 2001:db8:1::1000"
        }
      ],
      "pd-pools": [
        {
             "prefix": "2001:2b8:2::",
             "prefix-len": 56,
             "delegated-len": 64,
             "option-data": [
               {
                   "code": 12,
                   "data": "3001:cafe::12"
               }
             ]
         }
      ],
      "subnet": "2001:db8:1::/64",
      "interface": "eth0"
    }
  ],

// The following configures logging. It assumes that messages with at
// least informational level (info, warn, error and fatal) should be
// logged to stdout.
    "loggers": [
        {
            "name": "kea-dhcp6",
            "output_options": [
                {
                    "output": "stdout"
                }
            ],
            "debuglevel": 0,
            "severity": "INFO"
        }
    ]
}

}