This file is indexed.

/usr/share/doc/kea-doc/html/kea-guide.html is in kea-doc 1.0.0-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   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
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
6947
6948
6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7089
7090
7091
7092
7093
7094
7095
7096
7097
7098
7099
7100
7101
7102
7103
7104
7105
7106
7107
7108
7109
7110
7111
7112
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122
7123
7124
7125
7126
7127
7128
7129
7130
7131
7132
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7168
7169
7170
7171
7172
7173
7174
7175
7176
7177
7178
7179
7180
7181
7182
7183
7184
7185
7186
7187
7188
7189
7190
7191
7192
7193
7194
7195
7196
7197
7198
7199
7200
7201
7202
7203
7204
7205
7206
7207
7208
7209
7210
7211
7212
7213
7214
7215
7216
7217
7218
7219
7220
7221
7222
7223
7224
7225
7226
7227
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7390
7391
7392
7393
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7577
7578
7579
7580
7581
7582
7583
7584
7585
7586
7587
7588
7589
7590
7591
7592
7593
7594
7595
7596
7597
7598
7599
7600
7601
7602
7603
7604
7605
7606
7607
7608
7609
7610
7611
7612
7613
7614
7615
7616
7617
7618
7619
7620
7621
7622
7623
7624
7625
7626
7627
7628
7629
7630
7631
7632
7633
7634
7635
7636
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
7648
7649
7650
7651
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7687
7688
7689
7690
7691
7692
7693
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7750
7751
7752
7753
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
7771
7772
7773
7774
7775
7776
7777
7778
7779
7780
7781
7782
7783
7784
7785
7786
7787
7788
7789
7790
7791
7792
7793
7794
7795
7796
7797
7798
7799
7800
7801
7802
7803
7804
7805
7806
7807
7808
7809
7810
7811
7812
7813
7814
7815
7816
7817
7818
7819
7820
7821
7822
7823
7824
7825
7826
7827
7828
7829
7830
7831
7832
7833
7834
7835
7836
7837
7838
7839
7840
7841
7842
7843
7844
7845
7846
7847
7848
7849
7850
7851
7852
7853
7854
7855
7856
7857
7858
7859
7860
7861
7862
7863
7864
7865
7866
7867
7868
7869
7870
7871
7872
7873
7874
7875
7876
7877
7878
7879
7880
7881
7882
7883
7884
7885
7886
7887
7888
7889
7890
7891
7892
7893
7894
7895
7896
7897
7898
7899
7900
7901
7902
7903
7904
7905
7906
7907
7908
7909
7910
7911
7912
7913
7914
7915
7916
7917
7918
7919
7920
7921
7922
7923
7924
7925
7926
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7962
7963
7964
7965
7966
7967
7968
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Kea Administrator Reference Manual</title><link rel="stylesheet" type="text/css" href="kea-guide.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><meta name="description" content="Kea is an open source implementation of the Dynamic Host Configuration Protocol (DHCP) servers, developed and maintained by Internet Systems Consortium (ISC). This is the reference guide for Kea version 1.0.0. The most up-to-date version of this document (in PDF, HTML, and plain text formats), along with other documents for Kea, can be found at ."></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book"><div class="titlepage"><div><div><h1 class="title"><a name="idm6279648"></a>
    Kea Administrator Reference Manual
    <span class="inlinemediaobject"><img src="kea-logo-100x70.png" align="left"></span>
    </h1></div><div><p class="releaseinfo">This is the reference guide for Kea version
        1.0.0.</p></div><div><p class="copyright">Copyright © 2010-2015 Internet Systems Consortium, Inc.</p></div><div><div class="abstract"><p class="title"><b>Abstract</b></p><p>
        Kea is an open source implementation of the Dynamic Host Configuration
        Protocol (DHCP) servers, developed and maintained by Internet Systems
        Consortium (ISC).
      </p><p>
        This is the reference guide for Kea version 1.0.0.
        The most up-to-date version of this document (in PDF, HTML,
        and plain text formats), along with other documents for
        Kea, can be found at <a class="ulink" href="http://kea.isc.org/docs" target="_top">http://kea.isc.org/docs</a>.
        </p></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="chapter"><a href="#intro">1. Introduction</a></span></dt><dd><dl><dt><span class="section"><a href="#idp50568016">1.1. Supported Platforms</a></span></dt><dt><span class="section"><a href="#required-software">1.2. Required Software at Run-time</a></span></dt><dt><span class="section"><a href="#kea_software">1.3. Kea Software</a></span></dt></dl></dd><dt><span class="chapter"><a href="#quickstart">2. Quick start</a></span></dt><dd><dl><dt><span class="section"><a href="#quick-start">2.1. Quick start guide for DHCPv4 and DHCPv6 services</a></span></dt><dt><span class="section"><a href="#quick-start-direct-run">2.2. Running Kea servers directly</a></span></dt></dl></dd><dt><span class="chapter"><a href="#installation">3. Installation</a></span></dt><dd><dl><dt><span class="section"><a href="#packages">3.1. Packages</a></span></dt><dt><span class="section"><a href="#install-hierarchy">3.2. Install Hierarchy</a></span></dt><dt><span class="section"><a href="#build-requirements">3.3. Building Requirements</a></span></dt><dt><span class="section"><a href="#install">3.4. Installation from Source</a></span></dt><dd><dl><dt><span class="section"><a href="#idp54877744">3.4.1. Download Tar File</a></span></dt><dt><span class="section"><a href="#idp54879728">3.4.2. Retrieve from Git</a></span></dt><dt><span class="section"><a href="#configure">3.4.3. Configure before the build</a></span></dt><dt><span class="section"><a href="#idp51819024">3.4.4. Build</a></span></dt><dt><span class="section"><a href="#idp51821792">3.4.5. Install</a></span></dt></dl></dd><dt><span class="section"><a href="#dhcp-config-backend">3.5. Selecting the Configuration Backend</a></span></dt><dt><span class="section"><a href="#dhcp-install-configure">3.6. DHCP Database Installation and Configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#idp51839952">3.6.1. Building with MySQL Support</a></span></dt><dt><span class="section"><a href="#idp51846720">3.6.2. Building with PostgreSQL support</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#admin">4. Kea Database Administration</a></span></dt><dd><dl><dt><span class="section"><a href="#kea-database-version">4.1. Databases and Database Version Numbers</a></span></dt><dt><span class="section"><a href="#kea-admin">4.2. The kea-admin Tool</a></span></dt><dt><span class="section"><a href="#idp54116336">4.3. Supported Databases</a></span></dt><dd><dl><dt><span class="section"><a href="#idp54117072">4.3.1. memfile</a></span></dt><dt><span class="section"><a href="#idp53820304">4.3.2. MySQL</a></span></dt><dt><span class="section"><a href="#idp51946336">4.3.3. PostgreSQL</a></span></dt><dt><span class="section"><a href="#idp51986896">4.3.4. Limitations related to the use of the SQL databases</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#kea-config">5. Kea configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#json-backend">5.1. JSON configuration backend</a></span></dt><dd><dl><dt><span class="section"><a href="#json-format">5.1.1. JSON syntax</a></span></dt><dt><span class="section"><a href="#idp53045488">5.1.2. Simplified Notation</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#keactrl">6. Managing Kea with keactrl</a></span></dt><dd><dl><dt><span class="section"><a href="#keactrl-overview">6.1. Overview</a></span></dt><dt><span class="section"><a href="#keactrl-usage">6.2. Command Line Options</a></span></dt><dt><span class="section"><a href="#keactrl-config-file">6.3. The keactrl Configuration File</a></span></dt><dt><span class="section"><a href="#keactrl-commands">6.4. Commands</a></span></dt><dt><span class="section"><a href="#keactrl-overriding-servers">6.5. Overriding the Server Selection</a></span></dt></dl></dd><dt><span class="chapter"><a href="#dhcp4">7. The DHCPv4 Server</a></span></dt><dd><dl><dt><span class="section"><a href="#dhcp4-start-stop">7.1. Starting and Stopping the DHCPv4 Server</a></span></dt><dt><span class="section"><a href="#dhcp4-configuration">7.2. DHCPv4 Server Configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#idp54262112">7.2.1. Introduction</a></span></dt><dt><span class="section"><a href="#idp54498048">7.2.2. Lease Storage</a></span></dt><dt><span class="section"><a href="#idp54960688">7.2.3. Hosts Storage</a></span></dt><dt><span class="section"><a href="#dhcp4-interface-configuration">7.2.4. Interface configuration</a></span></dt><dt><span class="section"><a href="#dhcpinform-unicast-issues">7.2.5. Issues with unicast responses to DHCPINFORM</a></span></dt><dt><span class="section"><a href="#ipv4-subnet-id">7.2.6. IPv4 Subnet Identifier</a></span></dt><dt><span class="section"><a href="#dhcp4-address-config">7.2.7. Configuration of IPv4 Address Pools</a></span></dt><dt><span class="section"><a href="#dhcp4-std-options">7.2.8. Standard DHCPv4 options</a></span></dt><dt><span class="section"><a href="#dhcp4-custom-options">7.2.9. Custom DHCPv4 options</a></span></dt><dt><span class="section"><a href="#dhcp4-vendor-opts">7.2.10. DHCPv4 Vendor Specific Options</a></span></dt><dt><span class="section"><a href="#dhcp4-option-spaces">7.2.11. Nested DHCPv4 Options (Custom Option Spaces)</a></span></dt><dt><span class="section"><a href="#dhcp4-option-data-defaults">7.2.12. Unspecified parameters for DHCPv4 option configuration</a></span></dt><dt><span class="section"><a href="#dhcp4-stateless-configuration">7.2.13. Stateless Configuration of DHCPv4 clients</a></span></dt><dt><span class="section"><a href="#dhcp4-client-classifier">7.2.14. Client Classification in DHCPv4</a></span></dt><dt><span class="section"><a href="#dhcp4-ddns-config">7.2.15. Configuring DHCPv4 for DDNS</a></span></dt><dt><span class="section"><a href="#dhcp4-next-server">7.2.16. Next Server (siaddr)</a></span></dt><dt><span class="section"><a href="#dhcp4-echo-client-id">7.2.17. Echoing Client-ID (RFC 6842)</a></span></dt><dt><span class="section"><a href="#dhcp4-match-client-id">7.2.18. Using Client Identifier and Hardware Address</a></span></dt></dl></dd><dt><span class="section"><a href="#host-reservation-v4">7.3. Host reservation in DHCPv4</a></span></dt><dd><dl><dt><span class="section"><a href="#reservation4-types">7.3.1. Address reservation types</a></span></dt><dt><span class="section"><a href="#reservation4-conflict">7.3.2. Conflicts in DHCPv4 reservations</a></span></dt><dt><span class="section"><a href="#reservation4-hostname">7.3.3. Reserving a hostname</a></span></dt><dt><span class="section"><a href="#reservation4-options">7.3.4. Reserving specific options</a></span></dt><dt><span class="section"><a href="#reservation4-mode">7.3.5. Fine Tuning IPv4 Host Reservation</a></span></dt></dl></dd><dt><span class="section"><a href="#dhcp4-serverid">7.4. Server Identifier in DHCPv4</a></span></dt><dt><span class="section"><a href="#dhcp4-subnet-selection">7.5. How the DHCPv4 Server Selects a Subnet for the Client</a></span></dt><dd><dl><dt><span class="section"><a href="#dhcp4-relay-override">7.5.1. Using a Specific Relay Agent for a Subnet</a></span></dt><dt><span class="section"><a href="#dhcp4-srv-example-client-class-relay">7.5.2. Segregating IPv4 Clients in a Cable Network</a></span></dt></dl></dd><dt><span class="section"><a href="#dhcp4-decline">7.6. Duplicate Addresses (DHCPDECLINE support)</a></span></dt><dt><span class="section"><a href="#dhcp4-stats">7.7. Statistics in DHCPv4 server</a></span></dt><dt><span class="section"><a href="#dhcp4-ctrl-channel">7.8. Management API for the DHCPv4 server</a></span></dt><dt><span class="section"><a href="#dhcp4-std">7.9. Supported DHCP Standards</a></span></dt><dt><span class="section"><a href="#dhcp4-limit">7.10. DHCPv4 Server Limitations</a></span></dt></dl></dd><dt><span class="chapter"><a href="#dhcp6">8. The DHCPv6 Server</a></span></dt><dd><dl><dt><span class="section"><a href="#dhcp6-start-stop">8.1. Starting and Stopping the DHCPv6 Server</a></span></dt><dt><span class="section"><a href="#dhcp6-configuration">8.2. DHCPv6 Server Configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#idp50920624">8.2.1. Introduction</a></span></dt><dt><span class="section"><a href="#idp55550160">8.2.2. Lease Storage</a></span></dt><dt><span class="section"><a href="#dhcp6-interface-selection">8.2.3. Interface selection</a></span></dt><dt><span class="section"><a href="#ipv6-subnet-id">8.2.4. IPv6 Subnet Identifier</a></span></dt><dt><span class="section"><a href="#dhcp6-unicast">8.2.5. Unicast traffic support</a></span></dt><dt><span class="section"><a href="#dhcp6-address-config">8.2.6. Subnet and Address Pool</a></span></dt><dt><span class="section"><a href="#idp55239488">8.2.7. Subnet and Prefix Delegation Pools</a></span></dt><dt><span class="section"><a href="#dhcp6-std-options">8.2.8. Standard DHCPv6 options</a></span></dt><dt><span class="section"><a href="#dhcp6-custom-options">8.2.9. Custom DHCPv6 options</a></span></dt><dt><span class="section"><a href="#dhcp6-vendor-opts">8.2.10. DHCPv6 vendor specific options</a></span></dt><dt><span class="section"><a href="#dhcp6-option-spaces">8.2.11. Nested DHCPv6 options (custom option spaces)</a></span></dt><dt><span class="section"><a href="#dhcp6-option-data-defaults">8.2.12. Unspecified parameters for DHCPv6 option configuration</a></span></dt><dt><span class="section"><a href="#dhcp6-config-subnets">8.2.13. IPv6 Subnet Selection</a></span></dt><dt><span class="section"><a href="#dhcp6-rapid-commit">8.2.14. Rapid Commit</a></span></dt><dt><span class="section"><a href="#dhcp6-relays">8.2.15. DHCPv6 Relays</a></span></dt><dt><span class="section"><a href="#dhcp6-rsoo">8.2.16. Relay-Supplied Options</a></span></dt><dt><span class="section"><a href="#dhcp6-client-classifier">8.2.17. Client Classification in DHCPv6</a></span></dt><dt><span class="section"><a href="#dhcp6-ddns-config">8.2.18. Configuring DHCPv6 for DDNS</a></span></dt></dl></dd><dt><span class="section"><a href="#host-reservation-v6">8.3. Host reservation in DHCPv6</a></span></dt><dd><dl><dt><span class="section"><a href="#reservation6-types">8.3.1. Address/prefix reservation types</a></span></dt><dt><span class="section"><a href="#reservation6-conflict">8.3.2. Conflicts in DHCPv6 reservations</a></span></dt><dt><span class="section"><a href="#reservation6-hostname">8.3.3. Reserving a hostname</a></span></dt><dt><span class="section"><a href="#reservation6-options">8.3.4. Reserving specific options</a></span></dt><dt><span class="section"><a href="#reservation6-mode">8.3.5. Fine Tuning IPv6 Host Reservation</a></span></dt></dl></dd><dt><span class="section"><a href="#dhcp6-serverid">8.4. Server Identifier in DHCPv6</a></span></dt><dt><span class="section"><a href="#stateless-dhcp6">8.5. Stateless DHCPv6 (Information-Request Message)</a></span></dt><dt><span class="section"><a href="#dhcp6-rfc7550">8.6. Support for RFC 7550</a></span></dt><dt><span class="section"><a href="#dhcp6-relay-override">8.7. Using specific relay agent for a subnet</a></span></dt><dt><span class="section"><a href="#dhcp6-client-class-relay">8.8. Segregating IPv6 clients in a cable network</a></span></dt><dt><span class="section"><a href="#mac-in-dhcpv6">8.9. MAC/Hardware addresses in DHCPv6</a></span></dt><dt><span class="section"><a href="#dhcp6-decline">8.10. Duplicate Addresses (DECLINE support)</a></span></dt><dt><span class="section"><a href="#dhcp6-stats">8.11. Statistics in DHCPv6 server</a></span></dt><dt><span class="section"><a href="#dhcp6-ctrl-channel">8.12. Management API for the DHCPv6 server</a></span></dt><dt><span class="section"><a href="#dhcp6-std">8.13. Supported DHCPv6 Standards</a></span></dt><dt><span class="section"><a href="#dhcp6-limit">8.14. DHCPv6 Server Limitations</a></span></dt></dl></dd><dt><span class="chapter"><a href="#lease-expiration">9. Lease Expiration in DHCPv4 and DHCPv6</a></span></dt><dd><dl><dt><span class="section"><a href="#lease-reclamation">9.1. Lease Reclamation</a></span></dt><dt><span class="section"><a href="#lease-reclaim-config">9.2. Configuring Leases Reclamation</a></span></dt><dt><span class="section"><a href="#lease-affinity">9.3. Configuring Lease Affinity</a></span></dt><dt><span class="section"><a href="#lease-reclamation-defaults">9.4. Default Configuration Values for Leases Reclamation</a></span></dt><dt><span class="section"><a href="#leases-reclamation-using-command">9.5. Reclaiming Expired Leases with Command</a></span></dt></dl></dd><dt><span class="chapter"><a href="#dhcp-ddns-server">10. The DHCP-DDNS Server</a></span></dt><dd><dl><dt><span class="section"><a href="#dhcp-ddns-server-start-stop">10.1. Starting and Stopping the DHCP-DDNS Server</a></span></dt><dt><span class="section"><a href="#d2-configuration">10.2. Configuring the DHCP-DDNS Server</a></span></dt><dd><dl><dt><span class="section"><a href="#d2-server-parameter-config">10.2.1. Global Server Parameters</a></span></dt><dt><span class="section"><a href="#d2-tsig-key-list-config">10.2.2. TSIG Key List</a></span></dt><dt><span class="section"><a href="#d2-forward-ddns-config">10.2.3. Forward DDNS</a></span></dt><dt><span class="section"><a href="#d2-reverse-ddns-config">10.2.4. Reverse DDNS</a></span></dt><dt><span class="section"><a href="#d2-exmaple-config">10.2.5. Example DHCP-DDNS Server Configuration</a></span></dt></dl></dd><dt><span class="section"><a href="#idp55495520">10.3. DHCP-DDNS Server Limitations</a></span></dt></dl></dd><dt><span class="chapter"><a href="#kea-lfc">11. The LFC process</a></span></dt><dd><dl><dt><span class="section"><a href="#kea-lfc-overview">11.1. Overview</a></span></dt><dt><span class="section"><a href="#kea-lfc-usage">11.2. Command Line Options</a></span></dt></dl></dd><dt><span class="chapter"><a href="#classify">12. Client Classification</a></span></dt><dd><dl><dt><span class="section"><a href="#idp49591728">12.1. Client Classification Overview</a></span></dt><dt><span class="section"><a href="#classification-using-vendor">12.2. Using Vendor Class Information In Classification</a></span></dt><dt><span class="section"><a href="#classification-using-expressions">12.3. Using Expressions In Classification</a></span></dt><dd><dl><dt><span class="section"><a href="#idp55587760">12.3.1. Substring</a></span></dt></dl></dd><dt><span class="section"><a href="#classification-configuring">12.4. Configuring Classes</a></span></dt><dt><span class="section"><a href="#classification-subnets">12.5. Configuring Subnets With Class Information</a></span></dt><dt><span class="section"><a href="#idp55504128">12.6. Using Classes</a></span></dt><dt><span class="section"><a href="#idp55506384">12.7. Classes and Hooks</a></span></dt></dl></dd><dt><span class="chapter"><a href="#hooks-libraries">13. Hooks Libraries</a></span></dt><dd><dl><dt><span class="section"><a href="#hooks-libraries-introduction">13.1. Introduction</a></span></dt><dt><span class="section"><a href="#idp52289920">13.2. Configuring Hooks Libraries</a></span></dt></dl></dd><dt><span class="chapter"><a href="#stats">14. Statistics</a></span></dt><dd><dl><dt><span class="section"><a href="#idp54285232">14.1. Statistics Overview</a></span></dt><dt><span class="section"><a href="#stats-lifecycle">14.2. Statistics Lifecycle</a></span></dt><dt><span class="section"><a href="#command-stats">14.3. Commands for Manipulating Statistics</a></span></dt><dd><dl><dt><span class="section"><a href="#command-statistic-get">14.3.1. statistic-get command</a></span></dt><dt><span class="section"><a href="#command-statistic-reset">14.3.2. statistic-reset command</a></span></dt><dt><span class="section"><a href="#command-statistic-remove">14.3.3. statistic-remove command</a></span></dt><dt><span class="section"><a href="#command-statistic-get-all">14.3.4. statistic-get-all command</a></span></dt><dt><span class="section"><a href="#command-statistic-reset-all">14.3.5. statistic-reset-all command</a></span></dt><dt><span class="section"><a href="#command-statistic-remove-all">14.3.6. statistic-remove-all command</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#ctrl-channel">15. Management API</a></span></dt><dd><dl><dt><span class="section"><a href="#ctrl-channel-syntax">15.1. Data syntax</a></span></dt><dt><span class="section"><a href="#ctrl-channel-client">15.2. Using control channel</a></span></dt><dt><span class="section"><a href="#commands-common">15.3. Commands supported by both DHCPv4 and DHCPv6 servers</a></span></dt><dd><dl><dt><span class="section"><a href="#command-leases-reclaim">15.3.1. leases-reclaim command</a></span></dt><dt><span class="section"><a href="#command-list-commands">15.3.2. list-commands command</a></span></dt><dt><span class="section"><a href="#command-shutdown">15.3.3. shutdown command</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#libdhcp">16. libdhcp++ library</a></span></dt><dd><dl><dt><span class="section"><a href="#iface-detect">16.1. Interface detection and Socket handling</a></span></dt></dl></dd><dt><span class="chapter"><a href="#logging">17. Logging</a></span></dt><dd><dl><dt><span class="section"><a href="#idp54587936">17.1. Logging Configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#idp50497936">17.1.1. Loggers</a></span></dt><dt><span class="section"><a href="#idp54763552">17.1.2. Output Options</a></span></dt><dt><span class="section"><a href="#idp54783056">17.1.3. Example Logger Configurations</a></span></dt></dl></dd><dt><span class="section"><a href="#logging-message-format">17.2. Logging Message Format</a></span></dt><dt><span class="section"><a href="#idp52337216">17.3. Logging During Kea Startup</a></span></dt></dl></dd><dt><span class="chapter"><a href="#faq">18. Frequently Asked Questions</a></span></dt><dd><dl><dt><span class="section"><a href="#faq-generic">18.1. Generic Frequently Asked Questions</a></span></dt><dd><dl><dt><span class="section"><a href="#q1-generic">18.1.1. Where did the Kea name came from?</a></span></dt><dt><span class="section"><a href="#q2-generic">18.1.2. Feature X is not supported yet. When/if will it be available?</a></span></dt></dl></dd><dt><span class="section"><a href="#faq-dhcp4">18.2. Frequently Asked Questions about DHCPv4</a></span></dt><dd><dl><dt><span class="section"><a href="#idp51413776">18.2.1. I set up a firewall, but the Kea server still receives the traffic. Why?</a></span></dt></dl></dd><dt><span class="section"><a href="#faq-dhcp6">18.3. Frequently Asked Questions about DHCPv6</a></span></dt><dd><dl><dt><span class="section"><a href="#idp54575072">18.3.1. Kea DHCPv6 doesn't seem to get incoming traffic. I checked with tcpdump (or other traffic
      capture software) that the incoming traffic is reaching the box. What's wrong?</a></span></dt></dl></dd></dl></dd><dt><span class="chapter"><a href="#acknowledgments">19. Acknowledgments</a></span></dt></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>7.1. <a href="#dhcp4-std-options-list">List of standard DHCPv4 options</a></dt><dt>7.2. <a href="#dhcp4-std-options-list-part2">List of standard DHCPv4 options (continued)</a></dt><dt>7.3. <a href="#dhcp-types">List of standard DHCP option types</a></dt><dt>7.4. <a href="#fqdn-flag-table">Default FQDN Flag Behavior</a></dt><dt>7.5. <a href="#dhcp4-statistics">DHCPv4 Statistics</a></dt><dt>8.1. <a href="#dhcp6-std-options-list">List of standard DHCPv6 options</a></dt><dt>8.2. <a href="#dhcp6-exp-options-list">List of experimental DHCPv6 options</a></dt><dt>8.3. <a href="#dhcp6-fqdn-flag-table">Default FQDN Flag Behavior</a></dt><dt>8.4. <a href="#dhcp6-statistics">DHCPv6 Statistics</a></dt><dt>10.1. <a href="#idp55451472">Our example network</a></dt><dt>10.2. <a href="#idp55465872">Forward DDNS Domains Needed</a></dt><dt>10.3. <a href="#idp55480416">Reverse DDNS Domains Needed</a></dt><dt>12.1. <a href="#classification-values-list">List of Classification Values</a></dt><dt>12.2. <a href="#classification-expressions-list">List of Classification Expressions</a></dt></dl></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="intro"></a>Chapter 1. Introduction</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#idp50568016">1.1. Supported Platforms</a></span></dt><dt><span class="section"><a href="#required-software">1.2. Required Software at Run-time</a></span></dt><dt><span class="section"><a href="#kea_software">1.3. Kea Software</a></span></dt></dl></div><p>
      Kea is the next generation of DHCP software developed by ISC.
      It supports both DHCPv4 and DHCPv6 protocols along with their
      extensions, e.g. prefix delegation and dynamic updates to DNS.
    </p><p>
      Kea was initially developed as a part of the BIND 10 framework.
      In early 2014, ISC made the decision to discontinue active
      development of BIND 10 and continue development of Kea as
      standalone DHCP software.
    </p><p>
      This guide covers Kea version 1.0.0.
    </p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp50568016"></a>1.1. Supported Platforms</h2></div></div></div><p>
        Kea is officially supported on Red Hat Enterprise Linux,
	CentOS, Fedora and FreeBSD systems. It is also likely to work on many
	other platforms: builds have been tested on (in no particular order)
        Debian GNU/Linux 6 and unstable, Ubuntu 9.10, NetBSD 5,
        Solaris 10 and 11, FreeBSD 7 and 8, CentOS Linux 5.3,
        MacOS 10.6 and 10.7, and OpenBSD 5.1. Non supported systems
	(especially non-Linux) are likely to have issues with directly
	connected DHCPv4 clients.
      </p><p>There are currently no plans to port Kea to Windows platforms.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="required-software"></a>1.2. Required Software at Run-time</h2></div></div></div><p>
        Running Kea uses various extra software which may
        not be provided in the default installation of some operating systems,
        nor in the standard package collections. You may
        need to install this required software separately.
        (For the build requirements, also see
        <a class="xref" href="#build-requirements" title="3.3. Building Requirements">Section 3.3, “Building Requirements”</a>.)
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
        Kea supports two crypto libraries: Botan and OpenSSL. Only one of them
        is required to be installed during compilation. Kea uses the Botan
        crypto library for C++ (<a class="ulink" href="http://botan.randombit.net/" target="_top">http://botan.randombit.net/</a>),
        version 1.8 or later. As an alternative to Botan, Kea can use the
        OpenSSL crypto library (<a class="ulink" href="http://www.openssl.org/" target="_top">http://www.openssl.org/</a>).
        It requires a version with SHA-2 support.
            </li><li class="listitem">
        Kea uses the log4cplus C++ logging library
        (<a class="ulink" href="http://log4cplus.sourceforge.net/" target="_top">http://log4cplus.sourceforge.net/</a>).
        It requires at least log4cplus version 1.0.3.
            </li><li class="listitem">
	In order to store lease information in a MySQL database, Kea requires MySQL
    headers and libraries.  This is an optional dependency in that Kea can be
    built without MySQL support.
            </li><li class="listitem">
	In order to store lease information in a PostgreSQL database, Kea requires PostgreSQL
    headers and libraries.  This is an optional dependency in that Kea can be
    built without PostgreSQL support.
            </li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kea_software"></a>1.3. Kea Software</h2></div></div></div><p>
        Kea is modular.  Part of this modularity is
        accomplished using multiple cooperating processes which, together,
        provide the server functionality.
        The following software is included with Kea:
      </p><p>

        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
              <span class="command"><strong>keactrl</strong></span> —
              Tool to start, stop, reconfigure, and report status
              for the Kea servers.
            </li><li class="listitem">
              <span class="command"><strong>kea-dhcp4</strong></span> —
              DHCPv4 server process.
              This process responds to DHCPv4 queries from clients.
            </li><li class="listitem">
              <span class="command"><strong>kea-dhcp6</strong></span> —
              DHCPv6 server process.
              This process responds to DHCPv6 queries from clients.
            </li><li class="listitem">
              <span class="command"><strong>kea-dhcp-ddns</strong></span> —
              DHCP-DDNS process.
              This process acts as an intermediary between the DHCP servers
              and DNS server. It receives name update requests from the DHCP
              servers and sends DNS Update messages to the DNS servers.
            </li><li class="listitem">
              <span class="command"><strong>kea-admin</strong></span> —
              A tool useful for database backend maintenance (creating new
              database, checking versions, upgrading etc.)
            </li><li class="listitem">
              <span class="command"><strong>kea-lfc</strong></span> —
              This process removes redundant information from the files used
              to provide persistent storage for the memfile data base backend.
              The service is written to run as a stand alone process.  While it
              can be started externally it should be started by the Kea DHCP
              servers.
            </li><li class="listitem">
              <span class="command"><strong>perfdhcp</strong></span> —
              DHCP benchmarking tool which simulates multiple clients to
              test both DHCPv4 and DHCPv6 servers performance.
            </li></ul></div><p>
      </p></div><p>
      The tools and modules are covered in full detail in this guide.

      In addition, manual pages are also provided in the default installation.
    </p><p>
      Kea also provides C++ libraries and programmer interfaces for
      DHCP.  These include detailed developer documentation and
      code examples.

    </p></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="quickstart"></a>Chapter 2. Quick start</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#quick-start">2.1. Quick start guide for DHCPv4 and DHCPv6 services</a></span></dt><dt><span class="section"><a href="#quick-start-direct-run">2.2. Running Kea servers directly</a></span></dt></dl></div><p>
        This quickly covers the standard steps for installing and deploying Kea.
        For further details, full customizations, and troubleshooting, see the
        respective chapters in the Kea guide.
    </p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="quick-start"></a>2.1. Quick start guide for DHCPv4 and DHCPv6 services</h2></div></div></div><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
            Install required run-time and build dependencies. See <a class="xref" href="#build-requirements" title="3.3. Building Requirements">Section 3.3, “Building Requirements”</a> for details.
          </li><li class="listitem"><p>
            Download Kea source tarball from <a class="ulink" href="https://www.isc.org/downloads/" target="_top">ISC.org downloads page</a> or <a class="ulink" href="http://ftp.isc.org/isc/kea/" target="_top">ISC ftp server</a>.
          </p></li><li class="listitem"><p>
            Extract the tarball. For example:
            </p><pre class="screen">$ <strong class="userinput"><code>tar xvzf kea-1.0.0.tar.gz</code></strong></pre><p>
          </p></li><li class="listitem"><p>Go into the source directory and run the configure script:
            </p><pre class="screen">$ <strong class="userinput"><code>cd kea-1.0.0</code></strong>
$ <strong class="userinput"><code>./configure [your extra parameters]</code></strong></pre><p>
          </p></li><li class="listitem"><p>Build it:
            </p><pre class="screen">$ <strong class="userinput"><code>make</code></strong></pre><p>
          </p></li><li class="listitem"><p>Install it (by default the installation prefix is <code class="filename">/usr/local/</code>,
          so you likely need root privileges for that step):
            </p><pre class="screen"># <strong class="userinput"><code>make install</code></strong></pre><p>
          </p></li><li class="listitem"><p>Edit the configuration file which by default is installed in
          <code class="filename">[kea-install-dir]/etc/kea/kea.conf</code> and contains
          configuration for all Kea services. Configuration choices for DHCPv4
          and DHCPv6 services are described in <a class="xref" href="#dhcp4-configuration" title="7.2. DHCPv4 Server Configuration">Section 7.2, “DHCPv4 Server Configuration”</a> and <a class="xref" href="#dhcp6-configuration" title="8.2. DHCPv6 Server Configuration">Section 8.2, “DHCPv6 Server Configuration”</a>, respectively.</p></li><li class="listitem"><p>In order to start the DHCPv4 server in background, run the
          following command (as root):
          </p><pre class="screen"># <strong class="userinput"><code>keactrl start -s dhcp4</code></strong></pre><p>
          Or run the following command to start DHCPv6 server instead:
          </p><pre class="screen"># <strong class="userinput"><code>keactrl start -s dhcp6</code></strong></pre><p>
          Note that it is also possible to start both servers simultaneously:
          </p><pre class="screen">$ <strong class="userinput"><code>keactrl start</code></strong></pre><p>
          </p></li><li class="listitem"><p>Verify that Kea server(s) are running:
          </p><pre class="screen"># <strong class="userinput"><code>keactrl status</code></strong></pre><p>
          If the server status is "inactive" may indicate a configuration
          error. Please check a log file (by default located in
          <code class="filename">[kea-install-dir]/var/kea/kea.log</code>) for the
          details of the error.
          </p></li><li class="listitem"><p>
            If the server has been started successfully, test that it is
            responding to DHCP queries and that the client
            receives a configuration from the server; for example, use
            the <a class="ulink" href="http://www.isc.org/downloads/DHCP/" target="_top">ISC DHCP client</a>.
          </p></li><li class="listitem"><p>
            Stop running server(s):
            </p><pre class="screen"># <strong class="userinput"><code>keactrl stop</code></strong></pre><p>
          </p></li></ol></div><p>
        For more system specific installation procedures, you may want to visit
        <a class="ulink" href="http://kea.isc.org/wiki/SystemSpecificNotes" target="_top">System specific notes</a>,
        available on <a class="ulink" href="http://kea.isc.org/" target="_top">Kea homepage</a>.
      </p><p>The details of <span class="command"><strong>keactrl</strong></span> script usage can be found
      in <a class="xref" href="#keactrl" title="Chapter 6. Managing Kea with keactrl">Chapter 6, <i>Managing Kea with keactrl</i></a>.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="quick-start-direct-run"></a>2.2. Running Kea servers directly</h2></div></div></div><p>Kea servers can be started directly (without a need to use
      <span class="command"><strong>keactrl</strong></span>). To start DHCPv4 server run the following
      command:
      </p><pre class="screen"># <strong class="userinput"><code>kea-dhcp4 -c /path/to/your/kea4/config/file.json</code></strong></pre><p>
      And, to start the DHCPv6 server run the following command:
      </p><pre class="screen"># <strong class="userinput"><code>kea-dhcp6 -c /path/to/your/kea6/config/file.json</code></strong></pre><p>
    </p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="installation"></a>Chapter 3. Installation</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#packages">3.1. Packages</a></span></dt><dt><span class="section"><a href="#install-hierarchy">3.2. Install Hierarchy</a></span></dt><dt><span class="section"><a href="#build-requirements">3.3. Building Requirements</a></span></dt><dt><span class="section"><a href="#install">3.4. Installation from Source</a></span></dt><dd><dl><dt><span class="section"><a href="#idp54877744">3.4.1. Download Tar File</a></span></dt><dt><span class="section"><a href="#idp54879728">3.4.2. Retrieve from Git</a></span></dt><dt><span class="section"><a href="#configure">3.4.3. Configure before the build</a></span></dt><dt><span class="section"><a href="#idp51819024">3.4.4. Build</a></span></dt><dt><span class="section"><a href="#idp51821792">3.4.5. Install</a></span></dt></dl></dd><dt><span class="section"><a href="#dhcp-config-backend">3.5. Selecting the Configuration Backend</a></span></dt><dt><span class="section"><a href="#dhcp-install-configure">3.6. DHCP Database Installation and Configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#idp51839952">3.6.1. Building with MySQL Support</a></span></dt><dt><span class="section"><a href="#idp51846720">3.6.2. Building with PostgreSQL support</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="packages"></a>3.1. Packages</h2></div></div></div><p>
        Some operating systems or software package vendors may provide
        ready-to-use, pre-built software packages for Kea.  Installing a
        pre-built package means you do not need to install build-only
        prerequisites and do not need to <span class="emphasis"><em>make</em></span> the software.
      </p><p>
        FreeBSD ports, NetBSD pkgsrc, and Debian <span class="emphasis"><em>testing</em></span>
        package collections provide all the prerequisite packages.
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="install-hierarchy"></a>3.2. Install Hierarchy</h2></div></div></div><p>
        The following is the directory layout of the complete Kea installation
        (all directories paths are relative to the installation directory):
        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
            <code class="filename">etc/kea/</code> —
            configuration files.
          </li><li class="listitem">
              <code class="filename">include/</code> —
              C++ development header files.
            </li><li class="listitem">
              <code class="filename">lib/</code> —
              libraries.
            </li><li class="listitem">
              <code class="filename">sbin/</code> —
              server software and commands used by the system administrator.
            </li><li class="listitem">
              <code class="filename">share/kea/</code> —
              configuration specifications and examples.
            </li><li class="listitem">
              <code class="filename">share/doc/kea/</code> —
              this guide, other supplementary documentation, and examples.
            </li><li class="listitem">
              <code class="filename">share/man/</code> —
              manual pages (online documentation).
            </li><li class="listitem">
              <code class="filename">var/kea/</code> —
              server identification, lease databases, and log files.
            </li></ul></div><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="build-requirements"></a>3.3. Building Requirements</h2></div></div></div><p>
          In addition to the run-time requirements (listed in <a class="xref" href="#required-software" title="1.2. Required Software at Run-time">Section 1.2, “Required Software at Run-time”</a>), building Kea from source code requires
          various development include headers and program development tools.
        </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
            Some operating systems have split their distribution packages into
            a run-time and a development package.  You will need to install
            the development package versions, which include header files and
            libraries, to build Kea from the source code.
          </p></div><p>
          Building from source code requires the following software installed
          on the system:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>Boost build-time headers
          (<a class="ulink" href="http://www.boost.org/" target="_top">http://www.boost.org/</a>).
          At least Boost version 1.35 is required.
  
  
          When header-only Boost error code is not available or wanted, the
          Boost system library is required too.
        </p></li><li class="listitem"><p>
          Botan (at least version 1.8) or OpenSSL.</p></li><li class="listitem"><p>
            log4cplus (at least version 1.0.3)
          development include headers.
        </p></li><li class="listitem"><p>
          A C++ compiler and
          standard development headers.
          Kea builds have been tested with GCC g++ 3.4.3, 4.1.2,
          4.1.3, 4.2.1, 4.3.2, and 4.4.1; Clang++ 2.8; and Sun C++ 5.10.
	  
        </p></li><li class="listitem"><p>
          The development tools "make".
        </p></li></ul></div><p>
          Visit the user-contributed wiki at <a class="ulink" href="http://kea.isc.org/wiki/SystemSpecificNotes" target="_top">http://kea.isc.org/wiki/SystemSpecificNotes</a>
          for system-specific installation tips.
        </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="install"></a>3.4. Installation from Source</h2></div></div></div><p>
        Kea is open source software written in C++.
        It is freely available in source code form from ISC as a
        downloadable tar file or via Kea Git code revision control
        service. (It may also be available in pre-compiled ready-to-use
        packages from operating system vendors.)
      </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp54877744"></a>3.4.1. Download Tar File</h3></div></div></div><p>
          The Kea release tarballs may be downloaded from:
          <a class="ulink" href="http://ftp.isc.org/isc/kea/" target="_top">http://ftp.isc.org/isc/kea/</a> (using FTP or HTTP).
        </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp54879728"></a>3.4.2. Retrieve from Git</h3></div></div></div><p>
          Downloading this "bleeding edge" code is recommended only for
          developers or advanced users.  Using development code in a production
          environment is not recommended.
        </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
            When building from source code retrieved via Git, additional
            software will be required:  automake (v1.11 or later),
            libtoolize, and autoconf (2.59 or later).
            These may need to be installed.
          </p></div><p>
          The latest development code (together with temporary experiments
          and un-reviewed code) is available via the Kea code revision
          control system. This is powered by Git and all the Kea
          development is public.
          The leading development is done in the <span class="quote"><span class="quote">master</span></span>
          branch.
        </p><p>
          The code can be checked out from
          <code class="filename">git://git.kea.isc.org/kea</code>:

        </p><pre class="screen">$ <strong class="userinput"><code>git clone git://git.kea.isc.org/kea</code></strong></pre><p>
        </p><p>
          The code checked out from the git repository doesn't include the
          generated configure script, Makefile.in files, nor their
          related build files.
          They can be created by running <span class="command"><strong>autoreconf</strong></span>
          with the <code class="option">--install</code> switch.
          This will run <span class="command"><strong>autoconf</strong></span>,
          <span class="command"><strong>aclocal</strong></span>,
          <span class="command"><strong>libtoolize</strong></span>,
          <span class="command"><strong>autoheader</strong></span>,
          <span class="command"><strong>automake</strong></span>,
          and related commands.
        </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="configure"></a>3.4.3. Configure before the build</h3></div></div></div><p>
          Kea uses the GNU Build System to discover build environment
          details.
          To generate the makefiles using the defaults, simply run:
          </p><pre class="screen">$ <strong class="userinput"><code>./configure</code></strong></pre><p>
        </p><p>
          Run <span class="command"><strong>./configure</strong></span> with the <code class="option">--help</code>
          switch to view the different options. Some commonly-used options are:

          </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">--prefix</span></dt><dd>Define the installation location (the
                default is <code class="filename">/usr/local</code>).
              </dd><dt><span class="term">--with-boost-include</span></dt><dd>Define the path to find the Boost headers.
              </dd><dt><span class="term">--with-boost-libs</span></dt><dd>Specify Boost libraries to link with (this option
                exists only to provide a way to enforce such a list:
                usually this should not be used).
              </dd><dt><span class="term">--with-boost-lib-dir</span></dt><dd>Specify the path to Boost libraries to link with
                (usually there should be no reason to specify this option).
              </dd><dt><span class="term">--with-botan-config</span></dt><dd>Specify the path to the botan-config
                script to build with Botan for the crypto code.
              </dd><dt><span class="term">--with-gtest</span></dt><dd>Enable the building of the C++ Unit Tests using the
                Google Test framework. Optionally this can define the
                path to the gtest header files and library. (If the framework
                is not already installed on your system, it can be downloaded
                from <a class="ulink" href="https://code.google.com/p/googletest" target="_top">https://code.google.com/p/googletest</a>.)
              </dd><dt><span class="term">--with-log4cplus</span></dt><dd>Define the path to find the Log4cplus headers
                and libraries.
              </dd><dt><span class="term">--with-openssl</span></dt><dd>Replace Botan by OpenSSL for the crypto library.
                The default is to try to find a working Botan then
                OpenSSL only if Botan is not found.
              </dd><dt><span class="term">--without-werror</span></dt><dd>Disable the default use of the
		<code class="option">-Werror</code> compiler flag so that
		compiler warnings do not result in build failures.
              </dd></dl></div><p>
          </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
              For additional instructions concerning the building and installation of
              Kea for various databases, see <a class="xref" href="#dhcp-install-configure" title="3.6. DHCP Database Installation and Configuration">Section 3.6, “DHCP Database Installation and Configuration”</a>.
              For additional instructions concerning the configuration backends, see
              <a class="xref" href="#dhcp-config-backend" title="3.5. Selecting the Configuration Backend">Section 3.5, “Selecting the Configuration Backend”</a>.
            </p></div><p>
        </p><p>
          For example, the following command configures Kea to find the
          Boost headers in /usr/pkg/include, specifies that PostgreSQL
          support should be enabled, and sets the installation location
          to /opt/kea:

          </p><pre class="screen">$ <strong class="userinput"><code>./configure \
      --with-boost-include=/usr/pkg/include \
      --with-dhcp-pgsql=/usr/local/bin/pg_config \
      --prefix=/opt/kea</code></strong></pre><p>
        </p><p>
          If you have some problems with building Kea using the header-only
          Boost error code or you'd like to use the Boost system library
          (e.g., located in /usr/pkg/lib):

          </p><pre class="screen">$ <strong class="userinput"><code>./configure \
      --with-boost-libs=-lboost_system \
      --with-boost-lib-dir=/usr/pkg/lib</code></strong></pre><p>
        </p><p>
          If the configure fails, it may be due to missing or old
          dependencies.
        </p><p>
          <strong class="userinput"><code>./configure</code></strong> when it succeeds displays a report
          with the building parameters. This report is saved into 
          <code class="filename">config.report</code> and embedded into executable
          binaries, e.g., <strong class="userinput"><code>kea-dhcp4</code></strong>.
        </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp51819024"></a>3.4.4. Build</h3></div></div></div><p>
    After the configure step is complete, build the executables
    from the C++ code and prepare the Python scripts by running the command:

          </p><pre class="screen">$ <strong class="userinput"><code>make</code></strong></pre><p>
        </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp51821792"></a>3.4.5. Install</h3></div></div></div><p>
          To install the Kea executables, support files,
          and documentation, issue the command:
          </p><pre class="screen">$ <strong class="userinput"><code>make install</code></strong></pre><p>
        </p><p>
          Do not use any form of parallel or job server options
          (such as GNU make's <span class="command"><strong>-j</strong></span> option) when
          performing this step: doing so may cause errors.
        </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The install step may require superuser privileges.</p></div><p>
	  If required, run <span class="command"><strong>ldconfig</strong></span> as root with
	  <code class="filename">/usr/local/lib</code> (or with ${prefix}/lib if
	  configured with --prefix) in
	  <code class="filename">/etc/ld.so.conf</code> (or the relevant linker
	  cache configuration file for your OS):
	  </p><pre class="screen">$ <strong class="userinput"><code>ldconfig</code></strong></pre><p>
        </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
	    If you do not run <span class="command"><strong>ldconfig</strong></span> where it is
	    required, you may see errors like the following:
            </p><pre class="screen">
	      program: error while loading shared libraries: libkea-something.so.1:
	      cannot open shared object file: No such file or directory
	    </pre><p>
	  </p></div></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp-config-backend"></a>3.5. Selecting the Configuration Backend</h2></div></div></div><p>Kea 0.9 has introduced configuration backends that are
      switchable during the compilation phase. Only one backend, JSON,
      is currently supported.
      </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">JSON</span></dt><dd>JSON is the new default configuration backend
	    that causes Kea to read JSON configuration files from
	    disk. It does not require any framework and thus is
	    considered more lightweight. It will allow dynamic
	    on-line reconfiguration, but will lack remote capabilities
	    (i.e. no RESTful API).</dd></dl></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp-install-configure"></a>3.6. DHCP Database Installation and Configuration</h2></div></div></div><p>
        Kea stores its leases in a lease database.  The software has been written in
        a way that makes it possible to choose which database product should be used to
        store the lease information.  At present, Kea supports three database backends: MySQL,
        PostgreSQL and Memfile. To limit external dependencies, both MySQL and PostgreSQL
        support are disabled by default and only Memfile
        is available. Support for the optional external database backend must be explicitly included when
        Kea is built.  This section covers the building of Kea with MySQL and/or PostgreSQL
        and the creation of the lease database.
      </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp51839952"></a>3.6.1. Building with MySQL Support</h3></div></div></div><p>
          Install MySQL according to the instructions for your system.  The client development
          libraries must be installed.
        </p><p>
          Build and install Kea as described in <a class="xref" href="#installation" title="Chapter 3. Installation">Chapter 3, <i>Installation</i></a>, with
          the following modification. To enable the MySQL database code, at the
          "configure" step (see <a class="xref" href="#configure" title="3.4.3. Configure before the build">Section 3.4.3, “Configure before the build”</a>), do:
          </p><pre class="screen"><strong class="userinput"><code>./configure [other-options] --with-dhcp-mysql</code></strong></pre><p>
	  Or specify the location of the MySQL configuration program
	  "mysql_config" if MySQL was not installed in the default location:
          </p><pre class="screen"><strong class="userinput"><code>./configure [other-options] --with-dhcp-mysql=<em class="replaceable"><code>path-to-mysql_config</code></em></code></strong></pre><p>
        </p><p>
          See <a class="xref" href="#mysql-database-create" title="4.3.2.1. First Time Creation of Kea Database">Section 4.3.2.1, “First Time Creation of Kea Database”</a> for details regarding
          MySQL database configuration.
        </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp51846720"></a>3.6.2. Building with PostgreSQL support</h3></div></div></div><p>
          Install PostgreSQL according to the instructions for your system.  The client development
          libraries must be installed. Client development libraries are often packaged as "libpq".
        </p><p>
          Build and install Kea as described in <a class="xref" href="#installation" title="Chapter 3. Installation">Chapter 3, <i>Installation</i></a>, with
          the following modification. To enable the PostgreSQL database code, at the
          "configure" step (see <a class="xref" href="#configure" title="3.4.3. Configure before the build">Section 3.4.3, “Configure before the build”</a>), do:
          </p><pre class="screen"><strong class="userinput"><code>./configure [other-options] --with-dhcp-pgsql</code></strong></pre><p>
	  Or specify the location of the PostgreSQL configuration
	  program "pg_config" if PostgreSQL was not installed in
	  the default location:
          </p><pre class="screen"><strong class="userinput"><code>./configure [other-options] --with-dhcp-pgsql=<em class="replaceable"><code>path-to-pg_config</code></em></code></strong></pre><p>
        </p><p>
          See <a class="xref" href="#pgsql-database-create" title="4.3.3.1. Manually Create the PostgreSQL Database and the Kea User">Section 4.3.3.1, “Manually Create the PostgreSQL Database and the Kea User”</a> for details regarding
          PostgreSQL database configuration.
        </p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="admin"></a>Chapter 4. Kea Database Administration</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#kea-database-version">4.1. Databases and Database Version Numbers</a></span></dt><dt><span class="section"><a href="#kea-admin">4.2. The kea-admin Tool</a></span></dt><dt><span class="section"><a href="#idp54116336">4.3. Supported Databases</a></span></dt><dd><dl><dt><span class="section"><a href="#idp54117072">4.3.1. memfile</a></span></dt><dt><span class="section"><a href="#idp53820304">4.3.2. MySQL</a></span></dt><dt><span class="section"><a href="#idp51946336">4.3.3. PostgreSQL</a></span></dt><dt><span class="section"><a href="#idp51986896">4.3.4. Limitations related to the use of the SQL databases</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kea-database-version"></a>4.1. Databases and Database Version Numbers</h2></div></div></div><p>
      Kea stores leases in one of several supported databases.
      As future versions of Kea are released, the structure of those
      databases will change. For example, Kea currently only stores
      lease information: in the future, additional data - such as host
      reservation details - will also be stored.
    </p><p>
      A given version of Kea expects a particular structure in
      the database.  It ensures this by checking the version of the
      database it is using.  Separate version numbers are maintained for
      backend databases, independent of the version of Kea itself. It
      is possible that the backend database version will stay the same
      through several Kea revisions. Likewise, it is possible that the
      version of backend database may go up several revisions during a
      Kea upgrade.  Versions for each database are independent, so an
      increment in the MySQL database version does not imply an increment
      in that of PostgreSQL.
    </p><p>
      Backend versions are specified in
      a <em class="replaceable"><code>major.minor</code></em> format. The minor
      number is increased when there are backward compatible changes
      introduced.  For example, the addition of a new index. It is
      desirable, but not mandatory to apply such a change; you
      can run on older database version if you want to. (Although, in
      the example given, running without the new index may be at the
      expense of a performance penalty.) On the other hand, the major
      number is increased when an incompatible change is introduced,
      for example an extra column is added to a table. If you try to
      run Kea software on a database that is too old (as signified by
      mismatched backend major version number), Kea will refuse to run:
      administrative action will be required to upgrade the database.
    </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kea-admin"></a>4.2. The kea-admin Tool</h2></div></div></div><p>
      To manage the databases, Kea provides the
      <span class="command"><strong>kea-admin</strong></span> tool. It is able to initialize
      a new database, check its version number, perform a
      database upgrade, and dump lease data to a text file.
    </p><p>
      <span class="command"><strong>kea-admin</strong></span> takes two mandatory
      parameters: <span class="command"><strong>command</strong></span> and
      <span class="command"><strong>backend</strong></span>. Additional, non-mandatory options
      may be specified. Currently supported commands are:

      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
            <span class="command"><strong>lease-init</strong></span> —
            Initializes a new lease database. Useful during first
            Kea installation. The database is initialized to the
            latest version supported by the version of the software.
          </li><li class="listitem">
            <span class="command"><strong>lease-version</strong></span> —
            Reports the lease database version number. This is
            not necessarily equal to the Kea version number as
            each backend has its own versioning scheme.
          </li><li class="listitem">
            <span class="command"><strong>lease-upgrade</strong></span> —
            Conducts a lease database upgrade. This is useful when
            upgrading Kea.
          </li><li class="listitem">
            <span class="command"><strong>lease-dump</strong></span> —
            Dumps the contents of the lease database (for MySQL or PostgreSQL
            backends) to CSV text file. The first line of the file contains
            the column names.  This is meant to be used as a diagnostic
            tool that provides a portable, human-readable form of lease data.
          </li></ul></div><p>

      <span class="command"><strong>backend</strong></span> specifies the backend type. Currently
      supported types are:

      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
            <span class="command"><strong>memfile</strong></span> — Lease information is
            stored on disk in a text file.
          </li><li class="listitem">
            <span class="command"><strong>mysql</strong></span> —
            Lease information is stored in a MySQL relational
            database.
          </li><li class="listitem">
            <span class="command"><strong>pgsql</strong></span> —
            Lease information is stored in a PostgreSQL relational
            database.
          </li></ul></div><p>

      Additional parameters may be needed, depending on your setup
      and specific operation: username, password and database name or
      the directory where specific files are located. See appropriate
      manual page for details (<span class="command"><strong>man 8 kea-admin</strong></span>).
    </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp54116336"></a>4.3. Supported Databases</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp54117072"></a>4.3.1. memfile</h3></div></div></div><p>
        There are no special initialization steps necessary
        for the memfile backend.  During the first run, both
        <span class="command"><strong>kea-dhcp4</strong></span> and <span class="command"><strong>kea-dhcp6</strong></span>
        will create an empty lease file if one is not
        present. Necessary disk write permission is required.
      </p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="memfile-upgrade"></a>4.3.1.1. Upgrading Memfile Lease Files from an Earlier Version of Kea</h4></div></div></div><p>
        There are no special steps required to upgrade memfile lease files
        from an earlier version of Kea to a new version of Kea.

        During startup the servers will check the schema version of the lease
        files against their own.  If there is a mismatch, the servers will
        automatically launch the LFC process to convert the files to the
        server's schema version.  While this mechanism is primarily meant to
        ease the process of upgrading to newer versions of Kea, it can also
        be used for downgrading should the need arise.  When upgrading, any
        values not present in the original lease files will be assigned
        appropriate default values.  When downgrading, any data present in
        the files but not in the server's schema will be dropped.

        If you wish to convert the files manually, prior to starting the
        servers you may do so by running the LFC process yourself.
        See <a class="xref" href="#kea-lfc" title="Chapter 11. The LFC process">Chapter 11, <i>The LFC process</i></a> for more information.
        </p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp53820304"></a>4.3.2. MySQL</h3></div></div></div><p>
        The MySQL database must be properly set up if you want Kea to
        store information in MySQL. This section can be safely ignored
        if you chose to store the data in other backends.
      </p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="mysql-database-create"></a>4.3.2.1. First Time Creation of Kea Database</h4></div></div></div><p>
          If you are setting the MySQL database for the first time,
          you need to create the database area within MySQL and set up
          the MySQL user ID under which Kea will access the database.
          This needs to be done manually: <span class="command"><strong>kea-admin</strong></span>
          is not able to do this for you.
        </p><p>
          To create the database:

          </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
                Log into MySQL as "root":
</p><pre class="screen">
$ <strong class="userinput"><code>mysql -u root -p</code></strong>
Enter password:
mysql&gt;
</pre><p>
              </p></li><li class="listitem"><p>
                Create the MySQL database:
</p><pre class="screen">
mysql&gt; <strong class="userinput"><code>CREATE DATABASE <em class="replaceable"><code>database-name</code></em>;</code></strong>
</pre><p>
                (<em class="replaceable"><code>database-name</code></em> is the name
                you have chosen for the database.)
              </p></li><li class="listitem"><p>
                Create the user under which Kea will access the database
                (and give it a password), then grant it access to the
                database tables:
</p><pre class="screen">
mysql&gt; <strong class="userinput"><code>CREATE USER '<em class="replaceable"><code>user-name</code></em>'@'localhost' IDENTIFIED BY '<em class="replaceable"><code>password</code></em>';</code></strong>
mysql&gt; <strong class="userinput"><code>GRANT ALL ON <em class="replaceable"><code>database-name</code></em>.* TO '<em class="replaceable"><code>user-name</code></em>'@'localhost';</code></strong>
</pre><p>
                (<em class="replaceable"><code>user-name</code></em> and
                <em class="replaceable"><code>password</code></em> are the user ID
                and password you are using to allow Keas access to the
                MySQL instance. All apostrophes in the command lines
                above are required.)
              </p></li><li class="listitem"><p>
                At this point, you may elect to create the database
                tables. (Alternatively, you can exit MySQL and create
                the tables using the <span class="command"><strong>kea-admin</strong></span> tool,
                as explained below.)  To do this:
</p><pre class="screen">
mysql&gt; <strong class="userinput"><code>CONNECT <em class="replaceable"><code>database-name</code></em>;</code></strong>
mysql&gt; <strong class="userinput"><code>SOURCE <em class="replaceable"><code>path-to-kea</code></em>/share/kea/scripts/mysql/dhcpdb_create.mysql</code></strong>
</pre><p>
                (<em class="replaceable"><code>path-to-kea</code></em> is the
                location where you installed Kea.)
              </p></li><li class="listitem"><p>
                Exit MySQL:
</p><pre class="screen">
mysql&gt; <strong class="userinput"><code>quit</code></strong>
Bye
$
</pre><p>
              </p></li></ol></div><p>
        </p><p>
          If you elected not to create the tables in step 4, you can do
          so now by running the <span class="command"><strong>kea-admin</strong></span> tool:
</p><pre class="screen">
$ <strong class="userinput"><code>kea-admin lease-init mysql -u <em class="replaceable"><code>database-user</code></em> -p <em class="replaceable"><code>database-password</code></em> -n <em class="replaceable"><code>database-name</code></em></code></strong>
</pre><p>
          (Do not do this if you did create the tables in step 4.)
          <span class="command"><strong>kea-admin</strong></span> implements rudimentary checks:
          it will refuse to initialize a database that contains any
          existing tables. If you want to start from scratch, you
          must remove all data manually. (This process is a manual
          operation on purpose to avoid possibly irretrievable mistakes
          by <span class="command"><strong>kea-admin</strong></span>.)
        </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="mysql-upgrade"></a>4.3.2.2. Upgrading a MySQL Database from an Earlier Version of Kea</h4></div></div></div><p>
          Sometimes a new Kea version may use newer database schema, so
          there will be a need to upgrade the existing database. This can
          be done using the <span class="command"><strong>kea-admin lease-upgrade</strong></span>
          command.
        </p><p>
          To check the current version of the database, use the following command:
</p><pre class="screen">
$ <strong class="userinput"><code>kea-admin lease-version mysql -u <em class="replaceable"><code>database-user</code></em> -p <em class="replaceable"><code>database-password</code></em> -n <em class="replaceable"><code>database-name</code></em></code></strong>
</pre><p>
          (See <a class="xref" href="#kea-database-version" title="4.1. Databases and Database Version Numbers">Section 4.1, “Databases and Database Version Numbers”</a> for a discussion
          about versioning.)  If the version does not match the minimum
          required for the new version of Kea (as described in the
          release notes), the database needs to be upgraded.
        </p><p>
          Before upgrading, please make sure that the database is
          backed up.  The upgrade process does not discard any data but,
          depending on the nature of the changes, it may be impossible
          to subsequently downgrade to an earlier version.  To perform
          an upgrade, issue the following command:
</p><pre class="screen">
$ <strong class="userinput"><code>kea-admin lease-upgrade mysql -u <em class="replaceable"><code>database-user</code></em> -p <em class="replaceable"><code>database-password</code></em> -n <em class="replaceable"><code>database-name</code></em></code></strong>
</pre><p>
        </p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp51946336"></a>4.3.3. PostgreSQL</h3></div></div></div><p>
        A PostgreSQL database must be set up if you want Kea to store
        lease and other information in PostgreSQL. This step can be
        safely ignored if you are using other database backends.
      </p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="pgsql-database-create"></a>4.3.3.1. Manually Create the PostgreSQL Database and the Kea User</h4></div></div></div><p>
          The first task is to create both the lease database and the
          user under which the servers will access it. A number of steps
          are required:

          </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
                Log into PostgreSQL as "root":
</p><pre class="screen">
$ <strong class="userinput"><code>sudo -u postgres psql postgres</code></strong>
Enter password:
postgres=#
</pre><p>
              </p></li><li class="listitem"><p>
                Create the database:
</p><pre class="screen">
postgres=#<strong class="userinput"><code> CREATE DATABASE <em class="replaceable"><code>database-name</code></em>;</code></strong>
CREATE DATABASE
postgres=#
</pre><p>
                (<em class="replaceable"><code>database-name</code></em> is the name
                you have chosen for the database.)
              </p></li><li class="listitem"><p>
                Create the user under which Kea will access the database
                (and give it a password), then grant it access to the
                database:
</p><pre class="screen">
postgres=#<strong class="userinput"><code> CREATE USER <em class="replaceable"><code>user-name</code></em> WITH PASSWORD '<em class="replaceable"><code>password</code></em>';</code></strong>
CREATE ROLE
postgres=#
postgres=#<strong class="userinput"><code> GRANT ALL PRIVILEGES ON DATABASE <em class="replaceable"><code>database-name</code></em> TO <em class="replaceable"><code>user-name</code></em>;</code></strong>
GRANT
postgres=#
</pre><p>
              </p></li><li class="listitem"><p>
                Exit PostgreSQL:
</p><pre class="screen">
postgres=# <strong class="userinput"><code>\q</code></strong>
Bye
$
</pre><p>
              </p></li><li class="listitem"><p>
                At this point you are ready to create the database tables.
                This can be done using the <span class="command"><strong>kea-admin</strong></span> tool
                as explained in the next section (recommended), or manually.
                To create the tables manually enter the following command.
                Note that PostgreSQL will prompt you to enter the new user's
                password you specified in Step 3. When the command completes
                you will be returned to the shell prompt. You should see output
                similar to following:
</p><pre class="screen">
$ <strong class="userinput"><code>psql -d <em class="replaceable"><code>database-name</code></em> -U <em class="replaceable"><code>user-name</code></em> -f <em class="replaceable"><code>path-to-kea</code></em>/share/kea/scripts/pgsql/dhcpdb_create.pgsql</code></strong>
Password for user <em class="replaceable"><code>user-name</code></em>:
CREATE TABLE
CREATE INDEX
CREATE INDEX
CREATE TABLE
CREATE INDEX
CREATE TABLE
START TRANSACTION
INSERT 0 1
INSERT 0 1
INSERT 0 1
COMMIT
CREATE TABLE
START TRANSACTION
INSERT 0 1
COMMIT
$
</pre><p>
                (<em class="replaceable"><code>path-to-kea</code></em> is the location
                where you installed Kea.)
              </p><p>
                If instead you encounter an error like:
</p><pre class="screen">
psql: FATAL:  no pg_hba.conf entry for host "[local]", user "<em class="replaceable"><code>user-name</code></em>", database "<em class="replaceable"><code>database-name</code></em>", SSL off
</pre><p>
                ... you will need to alter the PostgreSQL configuration.
                Kea uses password authentication when connecting to
                the database and must have the appropriate entries
                added to PostgreSQL's pg_hba.conf file.  This file is
                normally located in the primary data directory for your
                PostgreSQL server. The precise path may vary but the
                default location for PostgreSQL 9.3 on Centos 6.5 is:
                <code class="filename">/var/lib/pgsql/9.3/data/pg_hba.conf</code>.
              </p><p>
                Assuming Kea is running on the same host as PostgreSQL,
                adding lines similar to following should be sufficient to
                provide password-authenticated access to Kea's database:
</p><pre class="screen">
local   <em class="replaceable"><code>database-name</code></em>    <em class="replaceable"><code>user-name</code></em>                                 password
host    <em class="replaceable"><code>database-name</code></em>    <em class="replaceable"><code>user-name</code></em>          127.0.0.1/32           password
host    <em class="replaceable"><code>database-name</code></em>    <em class="replaceable"><code>user-name</code></em>          ::1/128                password
</pre><p>
              </p><p>
                These edits are primarily intended as a starting point
                not a definitive reference on PostgreSQL administration or
                database security.  Please consult your PostgreSQL user
                manual before making these changes as they may expose
                other databases that you run.  It may be necessary to
                restart PostgreSQL in order for these changes to take effect.
              </p></li></ol></div><p>
        </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="idp51977440"></a>4.3.3.2. Initialize the PostgreSQL Database Using kea-admin</h4></div></div></div><p>
          If you elected not to create the tables manually, you can do
          so now by running the <span class="command"><strong>kea-admin</strong></span> tool:
</p><pre class="screen">
$ <strong class="userinput"><code>kea-admin lease-init pgsql -u <em class="replaceable"><code>database-user</code></em> -p <em class="replaceable"><code>database-password</code></em> -n <em class="replaceable"><code>database-name</code></em></code></strong>
</pre><p>
          Do not do this if you already created the tables in manually.
          <span class="command"><strong>kea-admin</strong></span> implements rudimentary checks:
          it will refuse to initialize a database that contains any
          existing tables. If you want to start from scratch, you
          must remove all data manually. (This process is a manual
          operation on purpose to avoid possibly irretrievable mistakes
          by <span class="command"><strong>kea-admin</strong></span>.)
        </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="pgsql-upgrade"></a>4.3.3.3. Upgrading a PostgreSQL Database from an Earlier Version of Kea</h4></div></div></div><p>
          Currently, PostgreSQL only supports Kea schema version 1.0 so no upgrades
          are available.  As upgrades become available, <span class="command"><strong>kea-admin</strong></span>
          will support them.
        </p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp51986896"></a>4.3.4. Limitations related to the use of the SQL databases</h3></div></div></div><p>
        The lease expiration time is stored in the SQL database for each lease
        as a timestamp value. Kea developers observed that MySQL database doesn't
        accept timestamps beyond 2147483647 seconds (maximum signed 32-bit number)
        from the beginning of the epoch. At the same time, some versions of PostgreSQL
        do accept greater values but the value is altered when it is read back.
        For this reason the lease database backends put the restriction for the
        maximum timestamp to be stored in the database, which is equal to the
        maximum signed 32-bit number. This effectively means that the current
        Kea version can't store the leases which expiration time is later than
        2147483647 seconds since the beginning of the epoch (around year 2038).
      </p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="kea-config"></a>Chapter 5. Kea configuration</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#json-backend">5.1. JSON configuration backend</a></span></dt><dd><dl><dt><span class="section"><a href="#json-format">5.1.1. JSON syntax</a></span></dt><dt><span class="section"><a href="#idp53045488">5.1.2. Simplified Notation</a></span></dt></dl></dd></dl></div><p>Kea is designed to allow different methods by which it can be
    configured, each method being implemented by a component known as a
    configuration backend.  At present, only one such backend is
    available, that allowing configuration by means of a JSON file.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="json-backend"></a>5.1. JSON configuration backend</h2></div></div></div><p>JSON is the default configuration backend.
    It assumes that the servers are started from the command line
    (either directly or using a script, e.g. <code class="filename">keactrl</code>).
    The JSON backend uses certain signals to influence Kea. The
    configuration file is specified upon startup using the -c parameter.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="json-format"></a>5.1.1. JSON syntax</h3></div></div></div><p>Configuration files for DHCPv4, DHCPv6 and DDNS modules are defined
      in an extended JSON format. Basic JSON is defined in <a class="ulink" href="http://tools.ietf.org/html/rfc4627" target="_top">RFC 4627</a>.  Kea components
      use a slightly modified JSON, in that they allow shell-style
      comments in the file: lines with the hash (#) character in the first column
      are comment lines and are ignored.</p><p>The configuration file consists of a single object (often colloquially
      called a map) started with a curly bracket. It comprises the "Dhcp4", "Dhcp6",
      "DhcpDdns" and/or "Logging" objects. It is possible to define additional
      elements, but they will be ignored. For example, it is possible to define
      Dhcp4, Dhcp6 and Logging elements in a single configuration file that can
      be used to start both the DHCPv4 and DHCPv6 components. When starting,
      the DHCPv4 component will use Dhcp4 object to configure itself and the
      Logging object to configure logging parameters; it will ignore the Dhcp6
      object.</p><p>For example, a very simple configuration for both DHCPv4 and DHCPv6
      could look like this:
</p><pre class="screen">
# The whole configuration starts here.
{

# DHCPv4 specific configuration starts here.
"Dhcp4": {
    "interfaces-config": {
        "interfaces": [ "eth0" ],
        "dhcp-socket-type": "raw"
    },
    "valid-lifetime": 4000,
    "renew-timer": 1000,
    "rebind-timer": 2000,
    "subnet4": [{
       "pools": [ { "pool": "192.0.2.1-192.0.2.200" } ],
       "subnet": "192.0.2.0/24"
    }],
    ...
},
# DHCPv4 specific configuration ends here.

# DHCPv6 specific configuration starts here.
"Dhcp6": {
    "interfaces-config": {
        "interfaces": [ "eth1" ]
    },
    "preferred-lifetime": 3000,
    "valid-lifetime": 4000,
    "renew-timer": 1000,
    "rebind-timer": 2000,
    "subnet6": [{
       "pools": [ { "pool": "2001:db8::/80" } ],
       "subnet": "2001:db8::/64"
    }],
    ...
},
# DHCPv6 specific configuration ends here.

# Logger parameters (that could be shared among several components) start here.
# This section is used by both the DHCPv4 and DHCPv6 servers.
"Logging": {
   "loggers": [{
        "name": "*",
        "severity": "DEBUG"
    }],
    ...
}
# Logger parameters end here.

# The whole configuration structure ends here.
}
</pre><p>
	</p><p>More examples are available in the installed
        <code class="filename">share/doc/kea/examples</code> directory.</p><p>To avoid repetition of mostly similar structures, examples in the
        rest of this guide will showcase only the subset of parameters appropriate for a given
        context. For example, when discussing the IPv6 subnets configuration in
        DHCPv6, only subnet6 parameters will be mentioned. It is implied that
        the remaining elements (the global map that holds Dhcp6, Logging and possibly
        DhcpDdns) are present, but they are omitted for clarity. Usually, locations
        where extra parameters may appear are denoted with an ellipsis.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp53045488"></a>5.1.2. Simplified Notation</h3></div></div></div><p>It is sometimes convenient to refer to a specific element in the
        configuration hierarchy. Each hierarchy level is separated by a slash.
        If there is an array, a specific instance within that array is referenced by
        a number in square brackets (with numbering starting at zero). For example, in the above configuration the
        valid-lifetime in the Dhcp6 component can be referred to as
        Dhcp6/valid-lifetime and the pool in the first subnet defined in the DHCPv6
        configuration as Dhcp6/subnet6[0]/pool.</p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="keactrl"></a>Chapter 6. Managing Kea with keactrl</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#keactrl-overview">6.1. Overview</a></span></dt><dt><span class="section"><a href="#keactrl-usage">6.2. Command Line Options</a></span></dt><dt><span class="section"><a href="#keactrl-config-file">6.3. The keactrl Configuration File</a></span></dt><dt><span class="section"><a href="#keactrl-commands">6.4. Commands</a></span></dt><dt><span class="section"><a href="#keactrl-overriding-servers">6.5. Overriding the Server Selection</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="keactrl-overview"></a>6.1. Overview</h2></div></div></div><p>keactrl is a shell script which controls the startup, shutdown
      and reconfiguration of the Kea servers (<span class="command"><strong>kea-dhcp4</strong></span>,
      <span class="command"><strong>kea-dhcp6</strong></span> and <span class="command"><strong>kea-dhcp-ddns</strong></span>). It
      also provides the means for checking the current status of the servers
      and determining the configuration files in use.
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="keactrl-usage"></a>6.2. Command Line Options</h2></div></div></div><p><span class="command"><strong>keactrl</strong></span> is run as follows:
</p><pre class="screen">
keactrl &lt;command&gt; [-c keactrl-config-file] [-s server[,server,..]]
</pre><p>
      </p><p>
        <span class="command"><strong>&lt;command&gt;</strong></span> is the one of the commands
        described in <a class="xref" href="#keactrl-commands" title="6.4. Commands">Section 6.4, “Commands”</a>.
      </p><p>
        The optional <span class="command"><strong>-c keactrl-config-file</strong></span> switch
        allows specification of an alternate <span class="command"><strong>keactrl</strong></span>
        configuration file. (<span class="command"><strong>--ctrl-config</strong></span> is a synonym for
        <span class="command"><strong>-c</strong></span>.) In the absence of <span class="command"><strong>-c</strong></span>,
        <span class="command"><strong>keactrl</strong></span> will use the default configuration
        file <code class="filename">[kea-install-dir]/etc/kea/keactrl.conf</code>.
      </p><p>
        The optional <span class="command"><strong>-s server[,server ...]</strong></span> switch selects
        the servers to which the command is issued.
        (<span class="command"><strong>--server</strong></span> is a synonym for <span class="command"><strong>-s</strong></span>.)
        If absent, the command is sent to all servers enabled in the keactrl
        configuration file.
        If multiple servers are specified, they
        should be separated by commas with no intervening spaces.
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="keactrl-config-file"></a>6.3. The keactrl Configuration File</h2></div></div></div><p>
        Depending on requirements, not all of the available servers need
        be run.  The keactrl configuration file sets which servers are
        enabled and which are disabled.  The default configuration
        file is <code class="filename">[kea-install-dir]/etc/kea/keactrl.conf</code>,
        but this can be overridden on a per-command basis using the
        <span class="command"><strong>-c</strong></span> switch.
      </p><p>
        The contents of <code class="filename">keactrl.conf</code> are:
</p><pre class="screen">
# This is a configuration file for keactrl script which controls
# the startup, shutdown, reconfiguration and gathering the status
# of the Kea servers.

# prefix holds the location where the Kea is installed.
prefix=/usr/local

# Location of Kea configuration file.
kea_config_file=${prefix}/etc/kea/kea.conf

# Location of Kea binaries.
exec_prefix=${prefix}
dhcp4_srv=${exec_prefix}/sbin/kea/kea-dhcp4
dhcp6_srv=${exec_prefix}/sbin/kea/kea-dhcp6
dhcp_ddns_srv=${exec_prefix}/sbin/kea/kea-dhcp-ddns

# Start DHCPv4 server?
dhcp4=yes

# Start DHCPv6 server?
dhcp6=yes

# Start DHCP DDNS server?
dhcp_ddns=yes

# Be verbose?
kea_verbose=no
</pre><p>
      </p><p>
        The <em class="parameter"><code>dhcp4</code></em>, <em class="parameter"><code>dhcp6</code></em> and
        <em class="parameter"><code>dhcp_ddns</code></em> parameters set to "yes" configure
        <span class="command"><strong>keactrl</strong></span> to manage (start, reconfigure) all servers,
        i.e. <span class="command"><strong>kea-dhcp4</strong></span>, <span class="command"><strong>kea-dhcp6</strong></span> and
        <span class="command"><strong>kea-dhcp-ddns</strong></span>. When any of these parameters is set to
        "no" the <span class="command"><strong>keactrl</strong></span> will ignore
        the corresponding server when starting or reconfiguring Kea.
      </p><p>
        By default, Kea servers managed by <span class="command"><strong>keactrl</strong></span> are
        located in <code class="filename">[kea-install-dir]/sbin</code>. This
        should work for most installations. If the default
        location needs to be altered for any reason, the paths
        specified with the <em class="parameter"><code>dhcp4_srv</code></em>,
        <em class="parameter"><code>dhcp6_srv</code></em> and <em class="parameter"><code>dhcp_ddns_srv</code></em>
        parameters should be modified.
      </p><p>
        The <em class="parameter"><code>kea_verbose</code></em> parameter specifies the verbosity
        of the servers being started. When <em class="parameter"><code>kea_verbose</code></em>
        is set to "yes" the logging level of the server is set to DEBUG.
        Otherwise, the default logging level is used.
      </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
          The verbosity for the server is set  when it is started. Once
          started, the verbosity can be only changed by stopping the server and
          starting it again with the new value of the
          <em class="parameter"><code>kea_verbose</code></em> parameter.
        </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="keactrl-commands"></a>6.4. Commands</h2></div></div></div><p>The following commands are supported by <span class="command"><strong>keactrl</strong></span>
      to perform specific operations on the Kea servers:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
          <span class="command"><strong>start</strong></span> - starts selected servers.
        </li><li class="listitem">
          <span class="command"><strong>stop</strong></span> - stops all running servers.
        </li><li class="listitem">
          <span class="command"><strong>reload</strong></span> - triggers reconfiguration of the
          selected servers by sending the SIGHUP signal to them.
        </li><li class="listitem">
          <span class="command"><strong>status</strong></span> - returns the status of the servers (active
          or inactive) and the names of the configuration files in use.
        </li></ul></div><p>
      </p><p>Typical output from <span class="command"><strong>keactrl</strong></span> when starting
      the servers looks similar to the following:
</p><pre class="screen">
<strong class="userinput"><code>$ keactrl start</code></strong>
INFO/keactrl: Starting kea-dhcp4 -c /usr/local/etc/kea/kea.conf -d
INFO/keactrl: Starting kea-dhcp6 -c /usr/local/etc/kea/kea.conf -d
INFO/keactrl: Starting kea-dhcp-ddns -c /usr/local/etc/kea/kea.conf -d
</pre><p>
      </p><p>Kea's servers create PID files upon startup. These files are used
      by keactrl to determine whether or not a given server is running.  If
      one or more servers are running when the start command is issued, the
      output will look similar to the following:
</p><pre class="screen">
<strong class="userinput"><code>$ keactrl start</code></strong>
INFO/keactrl: kea-dhcp4 appears to be running, see: PID 10918, PID file: /usr/local/var/kea/kea.kea-dhcp4.pid.
INFO/keactrl: kea-dhcp6 appears to be running, see: PID 10924, PID file: /usr/local/var/kea/kea.kea-dhcp6.pid.
INFO/keactrl: kea-dhcp-ddns appears to be running, see: PID 10930, PID file: /usr/local/var/kea/kea.kea-dhcp-ddns.pid.
</pre><p>
      During normal shutdowns these PID files are deleted. They may, however,
      be left over as remnants following a system crash.  It is possible,
      though highly unlikely, that upon system restart the PIDs they contain
      actually refer to processes unrelated to Kea.  This condition will cause
      keactrl to decide that the servers are running, when in fact they are
      not.  In such a case the PID files as listed in the keactrl output
      must be manually deleted.
      </p><p>The following command stops all servers:
</p><pre class="screen">
<strong class="userinput"><code>$ keactrl stop</code></strong>
INFO/keactrl: Stopping kea-dhcp4...
INFO/keactrl: Stopping kea-dhcp6...
INFO/keactrl: Stopping kea-dhcp-ddns...
</pre><p>
      Note that the <span class="command"><strong>stop</strong></span> will attempt to stop all servers
      regardless of whether they are "enabled" in the <code class="filename">keactrl.conf</code>.
      If any of the servers are not running, an informational message
      is displayed as in the <span class="command"><strong>stop</strong></span> command output below.
</p><pre class="screen">
<strong class="userinput"><code>$ keactrl stop</code></strong>
INFO/keactrl: kea-dhcp4 isn't running.
INFO/keactrl: kea-dhcp6 isn't running.
INFO/keactrl: kea-dhcp-ddns isn't running.
</pre><p>
      </p><p>
        As already mentioned, the reconfiguration of each Kea server is
        triggered by the SIGHUP signal. The <span class="command"><strong>reload</strong></span>
        command sends the SIGHUP signal to the servers that are enabled in
        the <span class="command"><strong>keactrl</strong></span> configuration file and are
        currently running. When a server receives the SIGHUP signal it
        re-reads its configuration file and, if the new configuration is
        valid, uses the new configuration. A reload is executed as follows:
</p><pre class="screen">
<strong class="userinput"><code>$ keactrl reload</code></strong>
INFO/keactrl: Reloading kea-dhcp4...
INFO/keactrl: Reloading kea-dhcp6...
INFO/keactrl: Reloading kea-dhcp-ddns...
</pre><p>
      If any of the servers are not running, an informational message
      is displayed as in the <span class="command"><strong>reload</strong></span> command output below.
</p><pre class="screen">
<strong class="userinput"><code>$ keactrl stop</code></strong>
INFO/keactrl: kea-dhcp4 isn't running.
INFO/keactrl: kea-dhcp6 isn't running.
INFO/keactrl: kea-dhcp-ddns isn't running.
</pre><p>
      </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
          Currently <span class="command"><strong>keactrl</strong></span> does not report configuration
          failures when the server is started or reconfigured. To check if
          the server's configuration succeeded the Kea log must be examined
          for errors. By default, this is written to the syslog file.
        </p></div><p>
        Sometimes it is useful to check which servers are running. The
        <span class="command"><strong>status</strong></span> reports this, typical output looking like:
</p><pre class="screen">
<strong class="userinput"><code>$ keactrl status</code></strong>
DHCPv4 server: active
DHCPv6 server: inactive
DHCP DDNS: active
Kea configuration file: /usr/local/etc/kea/kea.conf
keactrl configuration file: /usr/local/etc/kea/keactrl.conf
</pre><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="keactrl-overriding-servers"></a>6.5. Overriding the Server Selection</h2></div></div></div><p>
        The optional <span class="command"><strong>-s</strong></span> switch allows
        the selection of the servers to which <span class="command"><strong>keactrl</strong></span>
        command is issued.  For example, the following
        instructs <span class="command"><strong>keactrl</strong></span> to stop the
        <span class="command"><strong>kea-dhcp4</strong></span> and <span class="command"><strong>kea-dhcp6</strong></span> servers
        and leave the <span class="command"><strong>kea-dhcp-ddns</strong></span> server running:
</p><pre class="screen">
<strong class="userinput"><code>$ keactrl stop -s dhcp4,dhcp6</code></strong>
</pre><p>
      </p><p>
        Similarly, the following
        will only start the <span class="command"><strong>kea-dhcp4</strong></span> and
        <span class="command"><strong>kea-dhcp-ddns</strong></span> servers and not
        <span class="command"><strong>kea-dhcp6</strong></span>.
</p><pre class="screen">
<strong class="userinput"><code>$ keactrl start -s dhcp4,dhcp_ddns</code></strong>
</pre><p>
      </p><p>
        Note that the behavior of the <span class="command"><strong>-s</strong></span> switch
        with the <span class="command"><strong>start</strong></span> and <span class="command"><strong>reload</strong></span> commands
        is different to its behavior with the <span class="command"><strong>stop</strong></span> command.
        On <span class="command"><strong>start</strong></span> and <span class="command"><strong>reload</strong></span>,
        <span class="command"><strong>keactrl</strong></span> will check if the servers given as
        parameters to the <span class="command"><strong>-s</strong></span> switch are
        enabled in the <span class="command"><strong>keactrl</strong></span> configuration file:
        if not, the server will be ignored.  For <span class="command"><strong>stop</strong></span> however,
        this check is not made: the command is applied to all listed servers,
        regardless of whether they have been enabled in the file.
      </p><p>
        The following keywords can be used with the <span class="command"><strong>-s</strong></span>
        command line option:
        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
            <span class="command"><strong>dhcp4</strong></span> for <span class="command"><strong>kea-dhcp4.</strong></span>
          </li><li class="listitem">
            <span class="command"><strong>dhcp6</strong></span> for <span class="command"><strong>kea-dhcp6.</strong></span>
          </li><li class="listitem">
            <span class="command"><strong>dhcp_ddns</strong></span> for <span class="command"><strong>kea-dhcp-ddns.</strong></span>
          </li><li class="listitem">
            <span class="command"><strong>all</strong></span> for all servers (default).
          </li></ul></div><p>
      </p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="dhcp4"></a>Chapter 7. The DHCPv4 Server</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#dhcp4-start-stop">7.1. Starting and Stopping the DHCPv4 Server</a></span></dt><dt><span class="section"><a href="#dhcp4-configuration">7.2. DHCPv4 Server Configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#idp54262112">7.2.1. Introduction</a></span></dt><dt><span class="section"><a href="#idp54498048">7.2.2. Lease Storage</a></span></dt><dt><span class="section"><a href="#idp54960688">7.2.3. Hosts Storage</a></span></dt><dt><span class="section"><a href="#dhcp4-interface-configuration">7.2.4. Interface configuration</a></span></dt><dt><span class="section"><a href="#dhcpinform-unicast-issues">7.2.5. Issues with unicast responses to DHCPINFORM</a></span></dt><dt><span class="section"><a href="#ipv4-subnet-id">7.2.6. IPv4 Subnet Identifier</a></span></dt><dt><span class="section"><a href="#dhcp4-address-config">7.2.7. Configuration of IPv4 Address Pools</a></span></dt><dt><span class="section"><a href="#dhcp4-std-options">7.2.8. Standard DHCPv4 options</a></span></dt><dt><span class="section"><a href="#dhcp4-custom-options">7.2.9. Custom DHCPv4 options</a></span></dt><dt><span class="section"><a href="#dhcp4-vendor-opts">7.2.10. DHCPv4 Vendor Specific Options</a></span></dt><dt><span class="section"><a href="#dhcp4-option-spaces">7.2.11. Nested DHCPv4 Options (Custom Option Spaces)</a></span></dt><dt><span class="section"><a href="#dhcp4-option-data-defaults">7.2.12. Unspecified parameters for DHCPv4 option configuration</a></span></dt><dt><span class="section"><a href="#dhcp4-stateless-configuration">7.2.13. Stateless Configuration of DHCPv4 clients</a></span></dt><dt><span class="section"><a href="#dhcp4-client-classifier">7.2.14. Client Classification in DHCPv4</a></span></dt><dt><span class="section"><a href="#dhcp4-ddns-config">7.2.15. Configuring DHCPv4 for DDNS</a></span></dt><dt><span class="section"><a href="#dhcp4-next-server">7.2.16. Next Server (siaddr)</a></span></dt><dt><span class="section"><a href="#dhcp4-echo-client-id">7.2.17. Echoing Client-ID (RFC 6842)</a></span></dt><dt><span class="section"><a href="#dhcp4-match-client-id">7.2.18. Using Client Identifier and Hardware Address</a></span></dt></dl></dd><dt><span class="section"><a href="#host-reservation-v4">7.3. Host reservation in DHCPv4</a></span></dt><dd><dl><dt><span class="section"><a href="#reservation4-types">7.3.1. Address reservation types</a></span></dt><dt><span class="section"><a href="#reservation4-conflict">7.3.2. Conflicts in DHCPv4 reservations</a></span></dt><dt><span class="section"><a href="#reservation4-hostname">7.3.3. Reserving a hostname</a></span></dt><dt><span class="section"><a href="#reservation4-options">7.3.4. Reserving specific options</a></span></dt><dt><span class="section"><a href="#reservation4-mode">7.3.5. Fine Tuning IPv4 Host Reservation</a></span></dt></dl></dd><dt><span class="section"><a href="#dhcp4-serverid">7.4. Server Identifier in DHCPv4</a></span></dt><dt><span class="section"><a href="#dhcp4-subnet-selection">7.5. How the DHCPv4 Server Selects a Subnet for the Client</a></span></dt><dd><dl><dt><span class="section"><a href="#dhcp4-relay-override">7.5.1. Using a Specific Relay Agent for a Subnet</a></span></dt><dt><span class="section"><a href="#dhcp4-srv-example-client-class-relay">7.5.2. Segregating IPv4 Clients in a Cable Network</a></span></dt></dl></dd><dt><span class="section"><a href="#dhcp4-decline">7.6. Duplicate Addresses (DHCPDECLINE support)</a></span></dt><dt><span class="section"><a href="#dhcp4-stats">7.7. Statistics in DHCPv4 server</a></span></dt><dt><span class="section"><a href="#dhcp4-ctrl-channel">7.8. Management API for the DHCPv4 server</a></span></dt><dt><span class="section"><a href="#dhcp4-std">7.9. Supported DHCP Standards</a></span></dt><dt><span class="section"><a href="#dhcp4-limit">7.10. DHCPv4 Server Limitations</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp4-start-stop"></a>7.1. Starting and Stopping the DHCPv4 Server</h2></div></div></div><p>
      It is recommended that the Kea DHCPv4 server be started and stopped
      using <span class="command"><strong>keactrl</strong></span> (described in <a class="xref" href="#keactrl" title="Chapter 6. Managing Kea with keactrl">Chapter 6, <i>Managing Kea with keactrl</i></a>).
      However, it is also possible to run the server directly: it accepts
      the following command-line switches:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
            <span class="command"><strong>-c <em class="replaceable"><code>file</code></em></strong></span> -
            specifies the configuration file. This is the only mandatory
            switch.</li><li class="listitem">
            <span class="command"><strong>-d</strong></span> - specifies whether the server
            logging should be switched to debug/verbose mode. In verbose mode,
            the logging severity and debuglevel specified in the configuration
            file are ignored and "debug" severity and the maximum debuglevel
            (99) are assumed. The flag is convenient, for temporarily
            switching the server into maximum verbosity, e.g. when
            debugging.</li><li class="listitem">
            <span class="command"><strong>-p <em class="replaceable"><code>port</code></em></strong></span> -
            specifies UDP port the server will listen on. This is only
            useful during testing, as the DHCPv4 server listening on
            ports other than default DHCPv4 ports will not be able to
            handle regular DHCPv4 queries.</li><li class="listitem">
              <span class="command"><strong>-v</strong></span> - prints out Kea version and exits.
            </li><li class="listitem">
              <span class="command"><strong>-V</strong></span> - prints out Kea extended version with
              additional parameters and exits.
            </li><li class="listitem">
              <span class="command"><strong>-W</strong></span> - prints out Kea configuration report
              and exits.
            </li></ul></div><p>
            The <span class="command"><strong>-V</strong></span> command returns the versions of the
            external libraries dynamically linked.
      </p><p>
            The <span class="command"><strong>-W</strong></span> command describes the environment used
            to build Kea.  This command displays a copy of the
            <code class="filename">config.report</code> file produced by
            <strong class="userinput"><code>./configure</code></strong> that is embedded in the
            executable binary.
      </p><p>
            The <code class="filename">config.report</code> may also be accessed more
            directly.  The following command may be used to extract this
            information.  The binary <strong class="userinput"><code>path</code></strong> may be found
            in the install directory or in the <code class="filename">.libs</code>
            subdirectory in the source tree. For example
            <code class="filename">kea/src/bin/dhcp4/.libs/kea-dhcp4</code>.

</p><pre class="screen">
strings <strong class="userinput"><code>path</code></strong>/kea-dhcp4 | sed -n 's/;;;; //p'
</pre><p>
      </p><p>
	    When running in a console, the server can be shut down by
	    pressing ctrl-c. It detects the key combination and shuts
	    down gracefully.
      </p><p>
        On start-up, the server will detect available network interfaces
        and will attempt to open UDP sockets on all interfaces
        mentioned in the configuration file.
      </p><p>
        Since the DHCPv4 server opens privileged ports, it requires root
        access. Make sure you run this daemon as root.
      </p><p>
        During startup the server will attempt to create a PID file of the
        form: [localstatedir]/[conf name].kea-dhcp4.pid
        where:
        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="command"><strong>localstatedir</strong></span>: The value as passed into the
            build configure script. It defaults to "/usr/local/var".  Note
            that this value may be overridden at run time by setting the environment
            variable KEA_PIDFILE_DIR.  This is intended primarily for testing purposes.
            </li><li class="listitem"><span class="command"><strong>conf name</strong></span>: The configuration file name
            used to start the server, minus all preceding path and file extension.
            For example, given a pathname of "/usr/local/etc/kea/myconf.txt", the
            portion used would be "myconf".
            </li></ul></div><p>
        If the file already exists and contains the PID of a live process,
        the server will issue a DHCP4_ALREADY_RUNNING log message and exit. It
        is possible, though unlikely, that the file is a remnant of a system crash
        and the process to which the PID belongs is unrelated to Kea.  In such a 
        case it would be necessary to manually delete the PID file.
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp4-configuration"></a>7.2. DHCPv4 Server Configuration</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp54262112"></a>7.2.1. Introduction</h3></div></div></div><p>
        This section explains how to configure the DHCPv4 server using the
        Kea configuration backend. (Kea configuration using any other
        backends is outside of scope of this document.) Before DHCPv4
        is started, its configuration file has to be created. The
        basic configuration is as follows:
</p><pre class="screen">
{
# DHCPv4 configuration starts in this line
"Dhcp4": {

# First we set up global values
    "valid-lifetime": 4000,
    "renew-timer": 1000,
    "rebind-timer": 2000,

# Next we setup the interfaces to be used by the server.
    "interfaces-config": {
        "interfaces": [ "eth0" ]
    },

# And we specify the type of lease database
    "lease-database": {
        "type": "memfile",
        "persist": true,
        "name": "/var/kea/dhcp4.leases"
    },

# Finally, we list the subnets from which we will be leasing addresses.
    "subnet4": [
        {
            "subnet": "192.0.2.0/24",
            "pools": [
                { "pool": "192.0.2.1 - 192.0.2.200" }
            ]
        }
    ]

# DHCPv4 configuration ends with this line
}

} </pre><p>
</p><p>The following paragraphs provide a brief overview of the parameters in
the above example and
their format. Subsequent sections of this chapter go into much greater detail
for these and other parameters.</p><p>The lines starting with a hash (#) are comments and are ignored by
the server; they do not impact its
operation in any way.</p><p>The configuration starts in the first line with the initial
opening curly bracket (or brace). Each configuration consists of
one or more objects. In this specific example, we have only one
object called Dhcp4. This is a simplified configuration, as usually
there will be additional objects, like <span class="command"><strong>Logging</strong></span> or
<span class="command"><strong>DhcpDns</strong></span>, but we omit them now for clarity. The Dhcp4
configuration starts with the <span class="command"><strong>"Dhcp4": {</strong></span> line
and ends with the corresponding closing brace (in the above example,
the brace after the last comment).  Everything defined between those
lines is considered to be the Dhcp4 configuration.</p><p>In the general case, the order in which those parameters appear does not
matter. There are two caveats here though. The first one is to remember that
the configuration file must be well formed JSON. That means that the parameters
for any given scope must be separated by a comma and there must not be a comma
after the last parameter. When reordering a configuration file, keep in mind that
moving a parameter to or from the last position in a given scope may also require
moving the comma. The second caveat is that it is uncommon — although
legal JSON — to
repeat the same parameter multiple times. If that happens, the last occurrence of a
given parameter in a given scope is used while all previous instances are
ignored. This is unlikely to cause any confusion as there are no real life
reasons to keep multiple copies of the same parameter in your configuration
file.</p><p>Moving onto the DHCPv4 configuration elements, the very first few elements
define some global parameters. <span class="command"><strong>valid-lifetime</strong></span> defines for how long the addresses (leases) given out by the
server are valid. If nothing changes, a client that got an address is allowed to
use it for 4000 seconds. (Note that integer numbers are specified as is,
without any quotes around them.) <span class="command"><strong>renew-timer</strong></span> and
<span class="command"><strong>rebind-timer</strong></span> are values that
define T1 and T2 timers that govern when the client will begin the renewal and
rebind procedures. Note that <span class="command"><strong>renew-timer</strong></span> and
<span class="command"><strong>rebind-timer</strong></span> are optional. If they are not specified the
client will select values for T1 and T2 timers according to the
<a class="ulink" href="http://tools.ietf.org/html/rfc2131" target="_top">RFC 2131</a>.</p><p>The <span class="command"><strong>interfaces-config</strong></span> map specifies the server
configuration concerning the network interfaces, on which the server should
listen to the DHCP messages. The <span class="command"><strong>interfaces</strong></span> parameter
specifies a list of network interfaces on which the server should listen.
Lists are opened and closed with square brackets, with elements separated
by commas. Had we wanted to listen on two interfaces, the
<span class="command"><strong>interfaces-config</strong></span> would look like this:
</p><pre class="screen">
"interfaces-config": {
    "interfaces": [ "eth0", "eth1" ]
},
</pre><p>
</p><p>The next couple of lines define the lease database, the place where the server
stores its lease information. This particular example tells the server to use
<span class="command"><strong>memfile</strong></span>, which is the simplest (and fastest) database
backend. It uses an in-memory database and stores leases on disk in a CSV
file. This is a very simple configuration. Usually, lease database configuration
is more extensive and contains additional parameters.  Note that
<span class="command"><strong>lease-database</strong></span>
is an object and opens up a new scope, using an opening brace.
Its parameters (just one in this example -- <span class="command"><strong>type</strong></span>)
follow. Had there been more than one, they would be separated by commas. This
scope is closed with a closing brace. As more parameters follow, a trailing
comma is present.</p><p>Finally, we need to define a list of IPv4 subnets. This is the
most important DHCPv4 configuration structure as the server uses that
information to process clients' requests. It defines all subnets from
which the server is expected to receive DHCP requests. The subnets are
specified with the <span class="command"><strong>subnet4</strong></span> parameter.  It is a list,
so it starts and ends with square brackets.  Each subnet definition in
the list has several attributes associated with it, so it is a structure
and is opened and closed with braces. At a minimum, a subnet definition
has to have at least two parameters: <span class="command"><strong>subnet</strong></span> (that
defines the whole subnet) and <span class="command"><strong>pools</strong></span> (which is a list of
dynamically allocated pools that are governed by the DHCP server).</p><p>The example contains a single subnet. Had more than one been defined,
additional elements
in the <span class="command"><strong>subnet4</strong></span> parameter would be specified and
separated by commas. For example, to define three subnets, the following
syntax would be used:
</p><pre class="screen">
"subnet4": [
    {
        "pools": [ { "pool":  "192.0.2.1 - 192.0.2.200" } ],
        "subnet": "192.0.2.0/24"
    },
    {
        "pools": [ { "pool": "192.0.3.100 - 192.0.3.200" } ],
        "subnet": "192.0.3.0/24"
    },
    {
        "pools": [ { "pool": "192.0.4.1 - 192.0.4.254" } ],
        "subnet": "192.0.4.0/24"
    }
]
</pre><p>
</p><p>After all parameters are specified, we have two contexts open:
global and Dhcp4, hence we need two closing curly brackets to close them.
In a real life configuration file there most likely would be additional
components defined such as Logging or DhcpDdns, so the closing brace would
be followed by a comma and another object definition.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp54498048"></a>7.2.2. Lease Storage</h3></div></div></div><p>All leases issued by the server are stored in the lease database.
  Currently there are three database backends available:
  memfile (which is the default backend), MySQL and PostgreSQL.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="idp54499408"></a>7.2.2.1. Memfile, Basic Storage for Leases</h4></div></div></div><p>The server is able to store lease data in different repositories. Larger
  deployments may elect to store leases in a database. <a class="xref" href="#database-configuration4" title="7.2.2.2. Lease Database Configuration">Section 7.2.2.2, “Lease Database Configuration”</a> describes this option. In typical
  smaller deployments though, the server will use a CSV file rather than a database to
  store lease information. As well as requiring less administration, an
  advantage of using a file for storage is that it
  eliminates a dependency on third-party database software.</p><p>The configuration of the file backend (Memfile) is controlled through
  the Dhcp4/lease-database parameters. The <span class="command"><strong>type</strong></span> parameter
  is mandatory and it specifies which storage for leases the server should use.
  The value of <strong class="userinput"><code>"memfile"</code></strong> indicates that the file should
  be used as the storage. The following list presents the remaining, not mandatory
  parameters, which can be used to configure the Memfile backend.

  </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="command"><strong>persist</strong></span>: controls whether the new leases and
      updates to existing leases are written to the file. It is strongly
      recommended that the value of this parameter is set to
      <strong class="userinput"><code>true</code></strong> at all times, during the server's normal
      operation. Not writing leases to disk will mean that if a server is restarted
      (e.g. after a power failure), it will not know what addresses have been
      assigned.  As a result, it may hand out addresses to new clients that are
      already in use. The value of <strong class="userinput"><code>false</code></strong> is mostly useful
      for performance testing purposes. The default value of the
      <span class="command"><strong>persist</strong></span> parameter is <strong class="userinput"><code>true</code></strong>,
      which enables writing lease updates
      to the lease file.
      </li><li class="listitem"><span class="command"><strong>name</strong></span>: specifies an absolute location of the lease
      file in which new leases and lease updates will be recorded. The default value
      for this parameter is <strong class="userinput"><code>"[kea-install-dir]/var/kea/kea-leases4.csv"
      </code></strong>.</li><li class="listitem"><span class="command"><strong>lfc-interval</strong></span>: specifies the interval in seconds, at
      which the server (Memfile backend) will perform a lease file cleanup (LFC),
      which removes the redundant (historical) information from the lease file
      and effectively reduces the lease file size. The cleanup process is described
      in more detailed fashion further in this section. The default value of the
      <span class="command"><strong>lfc-interval</strong></span> is <strong class="userinput"><code>0</code></strong>, which disables
      the LFC.</li></ul></div><p>
  </p><p>The example configuration of the Memfile backend is presented below:

</p><pre class="screen">
"Dhcp4": {
    "lease-database": {
        <strong class="userinput"><code>"type": "memfile"</code></strong>,
        <strong class="userinput"><code>"persist": true</code></strong>,
        <strong class="userinput"><code>"name": "/tmp/kea-leases4.csv",</code></strong>
        <strong class="userinput"><code>"lfc-interval": 1800</code></strong>
    }
}
</pre><p>

    This configuration selects the <code class="filename">/tmp/kea-leases4.csv</code> as
    the storage for lease information and enables persistence (writing lease updates
    to this file). It also configures the backend perform the periodic cleanup
    of the lease files, executed every 30 minutes.
  </p><p>It is important to know how the lease file contents are organized
  to understand why the periodic lease file cleanup is needed. Every time when
  the server updates a lease or creates a new lease for the client, the new
  lease information must be recorded in the lease file. For performance reasons,
  the server does not supersede the existing client's lease, as it would require
  the lookup of the specific lease entry, but simply appends the new lease
  information at the end of the lease file. The previous lease entries for the
  client are not removed. When the server loads leases from the lease file, e.g.
  at the server startup, it assumes that the latest lease entry for the client
  is the valid one. The previous entries are discarded. This means that the
  server can re-construct the accurate information about the leases even though
  there may be many lease entries for each client. However, storing many entries
  for each client results in bloated lease file and impairs the performance of
  the server's startup and reconfiguration, as it needs to process larger number
  of lease entries.
  </p><p>The lease file cleanup removes all previous entries for each client and
  leaves only the latest ones. The interval at which the cleanup is performed
  is configurable, and it should be selected according to the frequency of lease
  renewals initiated by the clients. The more frequent renewals are, the lesser
  value of the <span class="command"><strong>lfc-interval</strong></span> should be. Note however, that the
  LFC takes time and thus it is possible (although unlikely) that new cleanup
  is started while the previous cleanup instance is still running, if the
  <span class="command"><strong>lfc-interval</strong></span> is too short. The server would recover from
  this by skipping the new cleanup when it detects that the previous cleanup
  is still in progress. But, this implies that the actual cleanups will be
  triggered more rarely than configured. Moreover, triggering a new cleanup
  adds an overhead to the server, which will not be able to respond to new
  requests for a short period of time when the new cleanup process is spawned.
  Therefore, it is recommended that the <span class="command"><strong>lfc-interval</strong></span> value
  is selected in a way that would allow for completing the cleanup before the
  new cleanup is triggered.
  </p><p>The LFC is performed by a separate process (in background) to avoid
  performance impact on the server process. In order to avoid the conflicts
  between the two processes both using the same lease files, the LFC process
  operates on the copy of the original lease file, rather than on the lease
  file used by the server to record lease updates. There are also other files
  being created as a side effect of the lease file cleanup. The detailed
  description of the LFC is located on the Kea wiki:
  <a class="ulink" href="http://kea.isc.org/wiki/LFCDesign" target="_top">http://kea.isc.org/wiki/LFCDesign</a>.
  </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="database-configuration4"></a>7.2.2.2. Lease Database Configuration</h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Lease database access information must be configured for the DHCPv4 server,
    even if it has already been configured for the DHCPv6 server. The servers
    store their information independently, so each server can use a separate
    database or both servers can use the same database.</p></div><p>Lease database configuration is controlled through the Dhcp4/lease-database
  parameters. The type of the database must be set to "memfile", "mysql" or "postgresql",
  e.g.
</p><pre class="screen">
"Dhcp4": { "lease-database": { <strong class="userinput"><code>"type": "mysql"</code></strong>, ... }, ... }
</pre><p>
  Next, the name of the database to hold the leases must be set: this is the
  name used when the lease database was created (see <a class="xref" href="#mysql-database-create" title="4.3.2.1. First Time Creation of Kea Database">Section 4.3.2.1, “First Time Creation of Kea Database”</a>
  or <a class="xref" href="#pgsql-database-create" title="4.3.3.1. Manually Create the PostgreSQL Database and the Kea User">Section 4.3.3.1, “Manually Create the PostgreSQL Database and the Kea User”</a>).
</p><pre class="screen">
"Dhcp4": { "lease-database": { <strong class="userinput"><code>"name": "<em class="replaceable"><code>database-name</code></em>" </code></strong>, ... }, ... }
</pre><p>
  If the database is located on a different system to the DHCPv4 server, the
  database host name must also be specified (although it should be noted that this
  configuration may have a severe impact on server performance):
</p><pre class="screen">
"Dhcp4": { "lease-database": { <strong class="userinput"><code>"host": <em class="replaceable"><code>remote-host-name</code></em></code></strong>, ... }, ... }
</pre><p>
  The usual state of affairs will be to have the database on the same machine as
  the DHCPv4 server.  In this case, set the value to the empty string:
</p><pre class="screen">
"Dhcp4": { "lease-database": { <strong class="userinput"><code>"host" : ""</code></strong>, ... }, ... }
</pre><p>
  </p><p>Finally, the credentials of the account under which the server will
  access the database should be set:
</p><pre class="screen">
"Dhcp4": { "lease-database": { <strong class="userinput"><code>"user": "<em class="replaceable"><code>user-name</code></em>"</code></strong>,
                               <strong class="userinput"><code>"password": "<em class="replaceable"><code>password</code></em>"</code></strong>,
                              ... },
           ... }
</pre><p>
  If there is no password to the account, set the password to the empty string
  "". (This is also the default.)</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp54960688"></a>7.2.3. Hosts Storage</h3></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This feature did not undergo the regular system level
      testing conducted by ISC. As such, please treat it as
      experimental.</p></div><p>Kea is also able to store information about host reservations in the
    database. Hosts database configuration uses the same syntax as lease
    database. In fact, Kea server opens independent connections for each
    purpose, be it lease or hosts information. This gives the solution most
    flexibility. Kea can be used to keep leases and host reservations
    separately, but can also point to the same database. Currently the only
    supported hosts database type is MySQL.</p><p>Please note that usage of hosts storage is optional. User can define
    all host reservations in the configuration file. That is the recommended way
    if the number of reservations is small. However, with the number of
    reservations growing it's more convenient to use host storage. Please note
    that both storages (configuration file and MySQL) can be used together. If
    hosts are defined in both places, the definitions from configuration file
    are checked first and external storage is checked later, if
    necessary.</p><p>All hosts leases issued by the server are stored in the hosts
    database. Currently there is only one available backend: MySQL. Other host
    backends will become available in future Kea versions.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="hosts-database-configuration4"></a>7.2.3.1. IPv4 Hosts Database Configuration</h4></div></div></div><p>Hosts database configuration is controlled through the Dhcp4/hosts-database
  parameters. If enabled, the type of the database must be set to "mysql". Other
  hosts backends may be added in later Kea versions.
</p><pre class="screen">
"Dhcp4": { "hosts-database": { <strong class="userinput"><code>"type": "mysql"</code></strong>, ... }, ... }
</pre><p>
  Next, the name of the database to hold the leases must be set: this is the
  name used when the lease database was created (see <a class="xref" href="#mysql-database-create" title="4.3.2.1. First Time Creation of Kea Database">Section 4.3.2.1, “First Time Creation of Kea Database”</a>).
</p><pre class="screen">
"Dhcp4": { "hosts-database": { <strong class="userinput"><code>"name": "<em class="replaceable"><code>database-name</code></em>" </code></strong>, ... }, ... }
</pre><p>
  If the database is located on a different system to the DHCPv4 server, the
  database host name must also be specified (although it should be noted that this
  configuration may have a severe impact on server performance):
</p><pre class="screen">
"Dhcp4": { "hosts-database": { <strong class="userinput"><code>"host": <em class="replaceable"><code>remote-host-name</code></em></code></strong>, ... }, ... }
</pre><p>
  The usual state of affairs will be to have the database on the same machine as
  the DHCPv4 server.  In this case, set the value to the empty string:
</p><pre class="screen">
"Dhcp4": { "hosts-database": { <strong class="userinput"><code>"host" : ""</code></strong>, ... }, ... }
</pre><p>
  </p><p>Finally, the credentials of the account under which the server will
  access the database should be set:
</p><pre class="screen">
"Dhcp4": { "hosts-database": { <strong class="userinput"><code>"user": "<em class="replaceable"><code>user-name</code></em>"</code></strong>,
                               <strong class="userinput"><code>"password": "<em class="replaceable"><code>password</code></em>"</code></strong>,
                              ... },
           ... }
</pre><p>
  If there is no password to the account, set the password to the empty string
  "". (This is also the default.)</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-interface-configuration"></a>7.2.4. Interface configuration</h3></div></div></div><p>The DHCPv4 server has to be configured to listen on specific network
  interfaces.  The simplest network interface configuration tells the server to
  listen on all available interfaces:
  </p><pre class="screen">
"Dhcp4": {
    "interfaces-config": {
        "interfaces": [ <strong class="userinput"><code>"*"</code></strong> ]
    }
    ...
},
  </pre><p>
  The asterisk plays the role of a wildcard and means "listen on all interfaces".
  However, it is usually a good idea to explicitly specify interface names:
  </p><pre class="screen">
"Dhcp4": {
    "interfaces-config": {
        "interfaces": [ <strong class="userinput"><code>"eth1", "eth3"</code></strong> ]
    },
    ...
}
  </pre><p>
  </p><p>It is possible to use wildcard interface name (asterisk) concurrently
  with explicit interface names:
  </p><pre class="screen">
"Dhcp4": {
    "interfaces-config": {
        "interfaces": [ <strong class="userinput"><code>"eth1", "eth3", "*"</code></strong> ]
    },
    ...
}
  </pre><p>
It is anticipated that this form of usage will only be used when it is desired to
temporarily override a list of interface names and listen on all interfaces.
  </p><p>Some deployments of the DHCP servers require that the servers listen
  on the interfaces with multiple IPv4 addresses configured. In these situations,
  the address to use can be selected by appending an IPv4 address to the interface
  name in the following manner:
  </p><pre class="screen">
"Dhcp4": {
    "interfaces-config": {
        "interfaces": [ <strong class="userinput"><code>"eth1/10.0.0.1", "eth3/192.0.2.3"</code></strong> ]
    },
    ...
}
  </pre><p>
  </p><p>If it is desired that the server listens on multiple IPv4 addresses assigned
  to the same interface, multiple addresses can be specified for this interface
  as in the example below:
  </p><pre class="screen">
"Dhcp4": {
    "interfaces-config": {
        "interfaces": [ <strong class="userinput"><code>"eth1/10.0.0.1", "eth1/10.0.0.2"</code></strong> ]
    },
    ...
}
  </pre><p>
  </p><p>Alternatively, if the server should listen on all addresses for the particular
  interface, an interface name without any address should be specified.</p><p>Kea supports responding to directly connected clients which don't have
  an address configured on the interface yet. This requires that the server
  injects the hardware address of the destination into the data link layer
  of the packet being sent to the client. The DHCPv4 server utilizes the
  raw sockets to achieve this, and builds the entire IP/UDP stack for the
  outgoing packets. The down side of raw socket use, however, is that incoming
  and outgoing packets bypass the firewalls (e.g. iptables). It is also
  troublesome to handle traffic on multiple IPv4 addresses assigned to the
  same interface, as raw sockets are bound to the interface and advanced
  packet filtering techniques (e.g. using the BPF) have to be used to
  receive unicast traffic on the desired addresses assigned to the interface,
  rather than capturing whole traffic reaching the interface to which the raw
  socket is bound. Therefore, in the deployments where the server doesn't
  have to provision the directly connected clients and only receives the
  unicast packets from the relay agents, it is desired to configure the
  DHCP server to utilize the IP/UDP datagram sockets, instead of raw sockets.
  The following configuration demonstrates how this can be achieved:

  </p><pre class="screen">
"Dhcp4": {
    "interfaces-config": {
        "interfaces": [ <strong class="userinput"><code>"eth1", "eth3"</code></strong> ],
        "dhcp-socket-type": "udp"
    },
    ...
}
  </pre><p>
  The <span class="command"><strong>dhcp-socket-type</strong></span> specifies that the IP/UDP sockets will
  be opened on all interfaces on which the server listens, i.e. "eth1" and
  "eth3" in our case. If the <span class="command"><strong>dhcp-socket-type</strong></span> is set to
  <strong class="userinput"><code>raw</code></strong>, it configures the server to use raw sockets
  instead. If the <span class="command"><strong>dhcp-socket-type</strong></span> value is not specified, the
  default value <strong class="userinput"><code>raw</code></strong> is used.
  </p><p>Using UDP sockets automatically disables the reception of broadcast
  packets from directly connected clients. This effectively means that the
  UDP sockets can be used for relayed traffic only. When using the raw sockets,
  both the traffic from the directly connected clients and the relayed traffic
  will be handled. Caution should be taken when configuring the server to open
  multiple raw sockets on the interface with several IPv4 addresses assigned.
  If the directly connected client sends the message to the broadcast address
  all sockets on this link will receive this message and multiple responses
  will be sent to the client. Hence, the configuration with multiple IPv4
  addresses assigned to the interface should not be used when the directly
  connected clients are operating on that link. To use a single address on
  such interface, the "interface-name/address" notation should be used.
  </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Specifying the value <strong class="userinput"><code>raw</code></strong> as the socket type,
    doesn't guarantee that the raw sockets will be used! The use of raw sockets
    to handle the traffic from the directly connected clients is currently
    supported on Linux and BSD systems only. If the raw sockets are not
    supported on the particular OS, the server will issue a warning and
    fall back to use the IP/UDP sockets.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcpinform-unicast-issues"></a>7.2.5. Issues with unicast responses to DHCPINFORM</h3></div></div></div><p>The use of UDP sockets has certain benefits in deployments
  where the server receives only relayed traffic. These benefits are
  mentioned in the <a class="xref" href="#dhcp4-interface-configuration" title="7.2.4. Interface configuration">Section 7.2.4, “Interface configuration”</a>. From
  the administrator's perspective it is often desired to be able to
  configure the system's firewall to filter out the unwanted traffic, and
  the use of UDP sockets facilitates it. However, the administrator must
  also be aware of the implications related to filtering certain types
  of traffic as it may impair the DHCP server's operation.
  </p><p>In this section we are focusing on the case when the server
  receives the DHCPINFORM message from the client via a relay. According
  to the <a class="ulink" href="http://tools.ietf.org/html/rfc2131" target="_top">RFC 2131</a>,
  the server should unicast the DHCPACK response to the address carried in
  the 'ciaddr' field. When the UDP socket is in use, the DHCP server
  relies on the low level functions of an operating system to build the
  data link, IP and UDP layers of the outgoing message. Typically, the
  OS will first use ARP to obtain the client's link layer address to be
  inserted into the frame's header, if the address is not cached from
  a previous transaction that the client had with the server.
  When the ARP exchange is successful, the DHCP message can be unicast
  to the client, using the  obtained address.
  </p><p>Some system administrators block ARP messages in their network,
  which causes issues for the server when it responds to the
  DHCPINFORM messages, because the server is unable to send the
  DHCPACK if the preceding ARP communication fails. Since the OS is
  entirely responsible for the ARP communication and then sending
  the DHCP packet over the wire, the DHCP server has no means to
  determine that the ARP exchange failed and the DHCP response message
  was dropped. Thus, the server does not log any error messages when
  the outgoing DHCP response is dropped. At the same time, all hooks
  pertaining to the packet sending operation will be called, even
  though the message never reaches its destination.
  </p><p>Note that the issue described in this section is not observed
  when the raw sockets are in use, because, in this case, the DHCP server
  builds all the layers of the outgoing message on its own and does not
  use ARP. Instead, it inserts the value carried in the 'chaddr' field
  of the DHCPINFORM message into the link layer.
  </p><p>Server administrators willing to support DHCPINFORM
  messages via relays should not block ARP traffic in their
  networks or should use raw sockets instead of UDP sockets.
  </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="ipv4-subnet-id"></a>7.2.6. IPv4 Subnet Identifier</h3></div></div></div><p>
    The subnet identifier is a unique number associated with a particular subnet.
    In principle, it is used to associate clients' leases with their respective subnets.
    When a subnet identifier is not specified for a subnet being configured, it will
    be automatically assigned by the configuration mechanism. The identifiers
    are assigned from 1 and are monotonically increased for each subsequent
    subnet: 1, 2, 3 ....
  </p><p>
    If there are multiple subnets configured with auto-generated identifiers and
    one of them is removed, the subnet identifiers may be renumbered. For example:
    if there are four subnets and the third is removed the last subnet will be assigned
    the identifier that the third subnet had before removal. As a result, the leases
    stored in the lease database for subnet 3 are now associated with
    subnet 4, something that may have unexpected consequences. It is planned
    to implement a mechanism to preserve auto-generated subnet ids in a
    future version of Kea.  However, the only remedy for this issue
    at present is to
    manually specify a unique identifier for each subnet.
  </p><p>
	The following configuration will assign the specified subnet
	identifier to the newly configured subnet:

        </p><pre class="screen">
"Dhcp4": {
    "subnet4": [
        {
            "subnet": "192.0.2.0/24",
            <strong class="userinput"><code>"id": 1024</code></strong>,
            ...
        }
    ]
}
</pre><p>
    This identifier will not change for this subnet unless the "id" parameter is
    removed or set to 0. The value of 0 forces auto-generation of the subnet
    identifier.
  </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-address-config"></a>7.2.7. Configuration of IPv4 Address Pools</h3></div></div></div><p>
    The essential role of DHCPv4 server is address assignment. The server has to
    be configured with at least one subnet and one pool of dynamic addresses to
    be managed. For example, assume that the server is connected to a network
    segment that uses the 192.0.2.0/24 prefix. The Administrator of that network
    has decided that addresses from range 192.0.2.10 to 192.0.2.20 are going to
    be managed by the Dhcp4 server. Such a configuration can be achieved in the
    following way:
    </p><pre class="screen">
"Dhcp4": {
    <strong class="userinput"><code>"subnet4": [
        {
            "subnet": "192.0.2.0/24",
            "pools": [
                { "pool": "192.0.2.10 - 192.0.2.20" }
            ],
            ...
        }
    ]</code></strong>
}</pre><p>

    Note that subnet is defined as a simple string, but the <span class="command"><strong>pools</strong></span> parameter is
    actually a list of pools: for this reason, the pools definition is enclosed
    in square brackets, even though only one range of addresses is
    specified in this example.</p><p>Each pool is a structure that contains the parameters
    that describe a single pool. Currently there is only one parameter,
    <span class="command"><strong>pool</strong></span>, which gives the range of addresses
    in the pool. Additional parameters will be added in future
    releases of Kea.</p><p>It is possible to define more than one pool in a subnet: continuing
    the previous example, further assume that 192.0.2.64/26 should be also be
    managed by the server. It could be written as 192.0.2.64 to
    192.0.2.127. Alternatively, it can be expressed more simply as
    192.0.2.64/26. Both formats are supported by Dhcp4 and can be mixed in the
    pool list.  For example, one could define the following pools:
</p><pre class="screen">
"Dhcp4": {
    "subnet4": [
        {
            "subnet": "192.0.2.0/24",
            <strong class="userinput"><code>"pools": [
                { "pool": "192.0.2.10-192.0.2.20" },
                { "pool": "192.0.2.64/26" }
            ]</code></strong>,
            ...
        }
    ],
    ...
}
</pre><p>
    The number of pools is not limited, but for performance reasons it is recommended to
    use as few as possible. White space in pool definitions is ignored, so
    spaces before and after the hyphen are optional. They can be used to improve readability.
  </p><p>
    The server may be configured to serve more than one subnet:
</p><pre class="screen">
"Dhcp4": {
    "subnet4": [
        {
            "subnet": "192.0.2.0/24",
            "pools": [ { "pool": "192.0.2.1 - 192.0.2.200" } ],
            ...
        },
        {
            "subnet": "192.0.3.0/24",
            "pools": [ { "pool": "192.0.3.100 - 192.0.3.200" } ],
            ...
        },
        {
            "subnet": "192.0.4.0/24",
            "pools": [ { "pool": "192.0.4.1 - 192.0.4.254" } ],
            ...
        }
    ]
}
</pre><p>
  </p><p>
    When configuring a DHCPv4 server using prefix/length notation, please pay
    attention to the boundary values. When specifying that the server can use
    a given pool, it will also be able to allocate the first (typically network
    address) and the last (typically broadcast address) address from that pool.
    In the aforementioned example of pool 192.0.3.0/24, both 192.0.3.0 and
    192.0.3.255 addresses may be assigned as well. This may be invalid in some
    network configurations. If you want to avoid this, please use the "min-max" notation.
  </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-std-options"></a>7.2.8. Standard DHCPv4 options</h3></div></div></div><p>
        One of the major features of the DHCPv4 server is to provide configuration
        options to clients. Most of the options are sent by the server, only if the
        client explicitly requests them using the Parameter Request List option.
        Those that do not require being requested using the Parameter Request List
        option are commonly used options, e.g. "Domain Server", and options which
        require special behavior, e.g. "Client FQDN" is returned to the client
        if the client has included this option in its message to the server.
      </p><p>
        The <a class="xref" href="#dhcp4-std-options-list" title="Table 7.1. List of standard DHCPv4 options">Table 7.1, “List of standard DHCPv4 options”</a> comprises the list of the
        standard DHCPv4 options, whose values can be configured using the
        configuration structures described in this section. This table excludes
        the options which require special processing and thus cannot be configured
        with some fixed values. The last column of this table specifies which
        options can be sent by the server even when they are not requested in
        the Parameter Request list option, and which are sent only when
        explicitly requested. These options are marked with the values
        'true' and 'false' respectively.
      </p><p>
        The following example shows how to configure the addresses of DNS
        servers, which is one of the most frequently used options. Options
        specified in this way are considered global and apply to all
        configured subnets.

        </p><pre class="screen">
"Dhcp4": {
    "option-data": [
        {
           <strong class="userinput"><code>"name": "domain-name-servers",
           "code": 6,
           "space": "dhcp4",
           "csv-format": true,
           "data": "192.0.2.1, 192.0.2.2"</code></strong>
        },
        ...
    ]
}
</pre><p>
      </p><p>
      The <span class="command"><strong>name</strong></span> parameter specifies the
      option name. For a list of currently supported names, see
      <a class="xref" href="#dhcp4-std-options-list" title="Table 7.1. List of standard DHCPv4 options">Table 7.1, “List of standard DHCPv4 options”</a> below.
      The <span class="command"><strong>code</strong></span> parameter specifies the option code, which must match one of the
      values from that list. The next line specifies the option space, which must always
      be set to "dhcp4" as these are standard DHCPv4 options. For
      other option spaces, including custom option spaces, see <a class="xref" href="#dhcp4-option-spaces" title="7.2.11. Nested DHCPv4 Options (Custom Option Spaces)">Section 7.2.11, “Nested DHCPv4 Options (Custom Option Spaces)”</a>. The next line specifies the format in
      which the data will be entered: use of CSV (comma
      separated values) is recommended. The sixth line gives the actual value to
      be sent to clients. Data is specified as normal text, with
      values separated by commas if more than one value is
      allowed.
    </p><p>
      Options can also be configured as hexadecimal values. If
      <span class="command"><strong>csv-format</strong></span> is
      set to false, option data must be specified as a hexadecimal string. The
      following commands configure the domain-name-servers option for all
      subnets with the following addresses: 192.0.3.1 and 192.0.3.2.
      Note that <span class="command"><strong>csv-format</strong></span> is set to false.
      </p><pre class="screen">
"Dhcp4": {
    "option-data": [
        {
            <strong class="userinput"><code>"name": "domain-name-servers",
            "code": 6,
            "space": "dhcp4",
            "csv-format": false,
            "data": "C0 00 03 01 C0 00 03 02"</code></strong>
        },
        ...
    ],
    ...
}</pre><p>
      </p><p>
        Most of the parameters in the "option-data" structure are optional and
        can be omitted in some circumstances as discussed in the
        <a class="xref" href="#dhcp4-option-data-defaults" title="7.2.12. Unspecified parameters for DHCPv4 option configuration">Section 7.2.12, “Unspecified parameters for DHCPv4 option configuration”</a>.
      </p><p>
        It is possible to specify or override options on a per-subnet basis.  If
        clients connected to most of your subnets are expected to get the
        same values of a given option, you should use global options: you
        can then override specific values for a small number of subnets.
        On the other hand, if you use different values in each subnet,
        it does not make sense to specify global option values
        (Dhcp4/option-data), rather you should set only subnet-specific values
        (Dhcp4/subnet[X]/option-data[Y]).
      </p><p>
        The following commands override the global
        DNS servers option for a particular subnet, setting a single DNS
        server with address 192.0.2.3.
</p><pre class="screen">
"Dhcp4": {
    "subnet4": [
        {
            <strong class="userinput"><code>"option-data": [
                {
                    "name": "domain-name-servers",
                    "code": 6,
                    "space": "dhcp4",
                    "csv-format": true,
                    "data": "192.0.2.3"
                },
                ...
            ]</code></strong>,
            ...
        },
        ...
    ],
    ...
}
</pre><p>
      </p><p>
        The currently supported standard DHCPv4 options are
        listed in <a class="xref" href="#dhcp4-std-options-list" title="Table 7.1. List of standard DHCPv4 options">Table 7.1, “List of standard DHCPv4 options”</a>
        and <a class="xref" href="#dhcp4-std-options-list-part2" title="Table 7.2. List of standard DHCPv4 options (continued)">Table 7.2, “List of standard DHCPv4 options (continued)”</a>.
        The "Name" and "Code"
        are the values that should be used as a name in the option-data
        structures. "Type" designates the format of the data: the meanings of
        the various types is given in <a class="xref" href="#dhcp-types" title="Table 7.3. List of standard DHCP option types">Table 7.3, “List of standard DHCP option types”</a>.
      </p><p>
        Some options are designated as arrays, which means that more than one
        value is allowed in such an option. For example the option time-servers
        allows the specification of more than one IPv4 address, so allowing
        clients to obtain the addresses of multiple NTP servers.
      </p><p>
        The <a class="xref" href="#dhcp4-custom-options" title="7.2.9. Custom DHCPv4 options">Section 7.2.9, “Custom DHCPv4 options”</a> describes the configuration
        syntax to create custom option definitions (formats). It is generally not
        allowed to create custom definitions for standard options, even if the
        definition being created matches the actual option format defined in the
        RFCs. There is an exception from this rule for standard options for which
        Kea does not provide a definition yet. In order to use such options,
        a server administrator must create a definition as described in
        <a class="xref" href="#dhcp4-custom-options" title="7.2.9. Custom DHCPv4 options">Section 7.2.9, “Custom DHCPv4 options”</a> in the 'dhcp4' option space. This
        definition should match the option format described in the relevant
        RFC but the configuration mechanism will allow any option format as it has
        no means to validate the format at the moment.
      </p><p>
        </p><div class="table"><a name="dhcp4-std-options-list"></a><p class="title"><b>Table 7.1. List of standard DHCPv4 options</b></p><div class="table-contents"><table summary="List of standard DHCPv4 options" border="1"><colgroup><col class="name"><col align="center" class="code"><col align="center" class="type"><col align="center" class="array"><col align="center" class="always-returned"></colgroup><thead><tr><th>Name</th><th align="center">Code</th><th align="center">Type</th><th align="center">Array?</th><th align="center">Returned if not requested?</th></tr></thead><tbody><tr><td>time-offset</td><td align="center">2</td><td align="center">int32</td><td align="center">false</td><td align="center">false</td></tr><tr><td>routers</td><td align="center">3</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">true</td></tr><tr><td>time-servers</td><td align="center">4</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>name-servers</td><td align="center">5</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>domain-name-servers</td><td align="center">6</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">true</td></tr><tr><td>log-servers</td><td align="center">7</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>cookie-servers</td><td align="center">8</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>lpr-servers</td><td align="center">9</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>impress-servers</td><td align="center">10</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>resource-location-servers</td><td align="center">11</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>boot-size</td><td align="center">13</td><td align="center">uint16</td><td align="center">false</td><td align="center">false</td></tr><tr><td>merit-dump</td><td align="center">14</td><td align="center">string</td><td align="center">false</td><td align="center">false</td></tr><tr><td>domain-name</td><td align="center">15</td><td align="center">fqdn</td><td align="center">false</td><td align="center">true</td></tr><tr><td>swap-server</td><td align="center">16</td><td align="center">ipv4-address</td><td align="center">false</td><td align="center">false</td></tr><tr><td>root-path</td><td align="center">17</td><td align="center">string</td><td align="center">false</td><td align="center">false</td></tr><tr><td>extensions-path</td><td align="center">18</td><td align="center">string</td><td align="center">false</td><td align="center">false</td></tr><tr><td>ip-forwarding</td><td align="center">19</td><td align="center">boolean</td><td align="center">false</td><td align="center">false</td></tr><tr><td>non-local-source-routing</td><td align="center">20</td><td align="center">boolean</td><td align="center">false</td><td align="center">false</td></tr><tr><td>policy-filter</td><td align="center">21</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>max-dgram-reassembly</td><td align="center">22</td><td align="center">uint16</td><td align="center">false</td><td align="center">false</td></tr><tr><td>default-ip-ttl</td><td align="center">23</td><td align="center">uint8</td><td align="center">false</td><td align="center">false</td></tr><tr><td>path-mtu-aging-timeout</td><td align="center">24</td><td align="center">uint32</td><td align="center">false</td><td align="center">false</td></tr><tr><td>path-mtu-plateau-table</td><td align="center">25</td><td align="center">uint16</td><td align="center">true</td><td align="center">false</td></tr><tr><td>interface-mtu</td><td align="center">26</td><td align="center">uint16</td><td align="center">false</td><td align="center">false</td></tr><tr><td>all-subnets-local</td><td align="center">27</td><td align="center">boolean</td><td align="center">false</td><td align="center">false</td></tr><tr><td>broadcast-address</td><td align="center">28</td><td align="center">ipv4-address</td><td align="center">false</td><td align="center">false</td></tr><tr><td>perform-mask-discovery</td><td align="center">29</td><td align="center">boolean</td><td align="center">false</td><td align="center">false</td></tr><tr><td>mask-supplier</td><td align="center">30</td><td align="center">boolean</td><td align="center">false</td><td align="center">false</td></tr><tr><td>router-discovery</td><td align="center">31</td><td align="center">boolean</td><td align="center">false</td><td align="center">false</td></tr><tr><td>router-solicitation-address</td><td align="center">32</td><td align="center">ipv4-address</td><td align="center">false</td><td align="center">false</td></tr><tr><td>static-routes</td><td align="center">33</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>trailer-encapsulation</td><td align="center">34</td><td align="center">boolean</td><td align="center">false</td><td align="center">false</td></tr><tr><td>arp-cache-timeout</td><td align="center">35</td><td align="center">uint32</td><td align="center">false</td><td align="center">false</td></tr><tr><td>ieee802-3-encapsulation</td><td align="center">36</td><td align="center">boolean</td><td align="center">false</td><td align="center">false</td></tr><tr><td>default-tcp-ttl</td><td align="center">37</td><td align="center">uint8</td><td align="center">false</td><td align="center">false</td></tr><tr><td>tcp-keepalive-interval</td><td align="center">38</td><td align="center">uint32</td><td align="center">false</td><td align="center">false</td></tr><tr><td>tcp-keepalive-garbage</td><td align="center">39</td><td align="center">boolean</td><td align="center">false</td><td align="center">false</td></tr></tbody></table></div></div><p><br class="table-break">
      </p><p>
        </p><div class="table"><a name="dhcp4-std-options-list-part2"></a><p class="title"><b>Table 7.2. List of standard DHCPv4 options (continued)</b></p><div class="table-contents"><table summary="List of standard DHCPv4 options (continued)" border="1"><colgroup><col class="name"><col align="center" class="code"><col align="center" class="type"><col align="center" class="array"><col align="center" class="always-returned"></colgroup><thead><tr><th>Name</th><th align="center">Code</th><th align="center">Type</th><th align="center">Array?</th><th align="center">Returned if not requested?</th></tr></thead><tbody><tr><td>nis-domain</td><td align="center">40</td><td align="center">string</td><td align="center">false</td><td align="center">false</td></tr><tr><td>nis-servers</td><td align="center">41</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>ntp-servers</td><td align="center">42</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>vendor-encapsulated-options</td><td align="center">43</td><td align="center">empty</td><td align="center">false</td><td align="center">false</td></tr><tr><td>netbios-name-servers</td><td align="center">44</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>netbios-dd-server</td><td align="center">45</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>netbios-node-type</td><td align="center">46</td><td align="center">uint8</td><td align="center">false</td><td align="center">false</td></tr><tr><td>netbios-scope</td><td align="center">47</td><td align="center">string</td><td align="center">false</td><td align="center">false</td></tr><tr><td>font-servers</td><td align="center">48</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>x-display-manager</td><td align="center">49</td><td align="center">ipv4-address</td><td align="center">true</td><td align="center">false</td></tr><tr><td>dhcp-option-overload</td><td align="center">52</td><td align="center">uint8</td><td align="center">false</td><td align="center">false</td></tr><tr><td>dhcp-message</td><td align="center">56</td><td align="center">string</td><td align="center">false</td><td align="center">false</td></tr><tr><td>dhcp-max-message-size</td><td align="center">57</td><td align="center">uint16</td><td align="center">false</td><td align="center">false</td></tr><tr><td>vendor-class-identifier</td><td align="center">60</td><td align="center">binary</td><td align="center">false</td><td align="center">false</td></tr><tr><td>nwip-domain-name</td><td align="center">62</td><td align="center">string</td><td align="center">false</td><td align="center">false</td></tr><tr><td>nwip-suboptions</td><td align="center">63</td><td align="center">binary</td><td align="center">false</td><td align="center">false</td></tr><tr><td>tftp-server-name</td><td align="center">66</td><td align="center">string</td><td align="center">false</td><td align="center">false</td></tr><tr><td>boot-file-name</td><td align="center">67</td><td align="center">string</td><td align="center">false</td><td align="center">false</td></tr><tr><td>user-class</td><td align="center">77</td><td align="center">binary</td><td align="center">false</td><td align="center">false</td></tr><tr><td>client-system</td><td align="center">93</td><td align="center">uint16</td><td align="center">true</td><td align="center">false</td></tr><tr><td>client-ndi</td><td align="center">94</td><td align="center">record (uint8, uint8, uint8)</td><td align="center">false</td><td align="center">false</td></tr><tr><td>uuid-guid</td><td align="center">97</td><td align="center">record (uint8, binary)</td><td align="center">false</td><td align="center">false</td></tr><tr><td>subnet-selection</td><td align="center">118</td><td align="center">ipv4-address</td><td align="center">false</td><td align="center">false</td></tr><tr><td>domain-search</td><td align="center">119</td><td align="center">binary</td><td align="center">false</td><td align="center">false</td></tr><tr><td>vivco-suboptions</td><td align="center">124</td><td align="center">binary</td><td align="center">false</td><td align="center">false</td></tr><tr><td>vivso-suboptions</td><td align="center">125</td><td align="center">binary</td><td align="center">false</td><td align="center">false</td></tr></tbody></table></div></div><p><br class="table-break">

      </p><p>
        </p><div class="table"><a name="dhcp-types"></a><p class="title"><b>Table 7.3. List of standard DHCP option types</b></p><div class="table-contents"><table summary="List of standard DHCP option types" border="1"><colgroup><col class="name"><col class="meaning"></colgroup><thead><tr><th>Name</th><th>Meaning</th></tr></thead><tbody><tr><td>binary</td><td>An arbitrary string of bytes, specified as a set of hexadecimal digits.</td></tr><tr><td>boolean</td><td>Boolean value with allowed values true or false</td></tr><tr><td>empty</td><td>No value, data is carried in suboptions</td></tr><tr><td>fqdn</td><td>Fully qualified domain name (e.g. www.example.com)</td></tr><tr><td>ipv4-address</td><td>IPv4 address in the usual dotted-decimal notation (e.g. 192.0.2.1)</td></tr><tr><td>ipv6-address</td><td>IPv6 address in the usual colon notation (e.g. 2001:db8::1)</td></tr><tr><td>record</td><td>Structured data that may comprise any types (except "record" and "empty")</td></tr><tr><td>string</td><td>Any text</td></tr><tr><td>uint8</td><td>8 bit unsigned integer with allowed values 0 to 255</td></tr><tr><td>uint16</td><td>16 bit unsigned integer with allowed values 0 to 65535</td></tr><tr><td>uint32</td><td>32 bit unsigned integer with allowed values 0 to 4294967295</td></tr></tbody></table></div></div><p><br class="table-break">
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-custom-options"></a>7.2.9. Custom DHCPv4 options</h3></div></div></div><p>Kea supports custom (non-standard) DHCPv4 options. Assume
      that we want to define a new DHCPv4 option called "foo" which
      will have code 222 and will convey a single unsigned 32 bit
      integer value. We can define such an option by using the
      following entry in the configuration file:
</p><pre class="screen">
"Dhcp4": {
    "option-def": [
        {
            <strong class="userinput"><code>"name": "foo",
            "code": 222,
            "type": "uint32",
            "array": false,
            "record-types": "",
            "space": "dhcp4",
            "encapsulate": ""</code></strong>
        }, ...
    ],
    ...
}
</pre><p>
      The <span class="command"><strong>false</strong></span> value of the <span class="command"><strong>array</strong></span>
      parameter determines that the option does NOT comprise an array of
      "uint32" values but rather a single value.  Two other parameters have been
      left blank: <span class="command"><strong>record-types</strong></span> and
      <span class="command"><strong>encapsulate</strong></span>.  The former specifies the comma separated
      list of option data fields if the option comprises a record of data
      fields. This should be non-empty if the <span class="command"><strong>type</strong></span> is set to
      "record". Otherwise it must be left blank. The latter parameter specifies
      the name of the option space being encapsulated by the particular
      option. If the particular option does not encapsulate any option space it
      should be left blank.  Note that the above set of comments define the
      format of the new option and do not set its values.
      </p><p>The <span class="command"><strong>name</strong></span>, <span class="command"><strong>code</strong></span> and
      <span class="command"><strong>type</strong></span> parameters are required, all others are
      optional. The <span class="command"><strong>array</strong></span> default value is
      <span class="command"><strong>false</strong></span>. The <span class="command"><strong>record-types</strong></span>
      and <span class="command"><strong>encapsulate</strong></span> default values are blank
      (i.e. ""). The default <span class="command"><strong>space</strong></span> is "dhcp4".
      </p><p>Once the new option format is defined, its value is set
      in the same way as for a standard option. For example the following
      commands set a global value that applies to all subnets.
</p><pre class="screen">
"Dhcp4": {
    "option-data": [
        {
            <strong class="userinput"><code>"name": "foo",
            "code": 222,
            "space": "dhcp4",
            "csv-format": true,
            "data": "12345"</code></strong>
        }, ...
    ],
    ...
}
</pre><p>
      </p><p>New options can take more complex forms than simple use of
      primitives (uint8, string, ipv4-address etc): it is possible to
      define an option comprising a number of existing primitives.
      Assume we want to define a new option that will consist of
      an IPv4 address, followed by an unsigned 16 bit integer, followed by
      a boolean value, followed by a text string. Such an option could
      be defined in the following way:
</p><pre class="screen">
"Dhcp4": {
    "option-def": [
        {
            <strong class="userinput"><code>"name": "bar",
            "code": 223,
            "space": "dhcp4",
            "type": "record",
            "array": false,
            "record-types": "ipv4-address, uint16, boolean, string",
            "encapsulate": ""</code></strong>
        }, ...
    ],
    ...
}
</pre><p>
      The <span class="command"><strong>type</strong></span> is set to "record" to indicate that the option contains
      multiple values of different types.  These types are given as a comma-separated
      list in the <span class="command"><strong>record-types</strong></span> field and should be those listed in <a class="xref" href="#dhcp-types" title="Table 7.3. List of standard DHCP option types">Table 7.3, “List of standard DHCP option types”</a>.
      </p><p>
      The values of the option are set as follows:
</p><pre class="screen">
"Dhcp4": {
    "option-data": [
        {
            <strong class="userinput"><code>"name": "bar",
            "space": "dhcp4",
            "code": 223,
            "csv-format": true,
            "data": "192.0.2.100, 123, true, Hello World"</code></strong>
        }
    ],
    ...
}</pre><p>
      <span class="command"><strong>csv-format</strong></span> is set to <span class="command"><strong>true</strong></span> to indicate
      that the <span class="command"><strong>data</strong></span> field comprises a command-separated list
      of values.  The values in the <span class="command"><strong>data</strong></span> must correspond to
      the types set in the <span class="command"><strong>record-types</strong></span> field of the option
      definition.
     </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>In the general case, boolean values are specified as <span class="command"><strong>true</strong></span> or
       <span class="command"><strong>false</strong></span>, without quotes. Some specific boolean parameters may
       accept also <span class="command"><strong>"true"</strong></span>, <span class="command"><strong>"false"</strong></span>,
       <span class="command"><strong>0</strong></span>, <span class="command"><strong>1</strong></span>, <span class="command"><strong>"0"</strong></span> and
       <span class="command"><strong>"1"</strong></span>. Future Kea versions will accept all those values
       for all boolean parameters.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-vendor-opts"></a>7.2.10. DHCPv4 Vendor Specific Options</h3></div></div></div><p>
      Currently there are two option spaces defined for the DHCPv4 daemon:
      "dhcp4" (for the top level DHCPv4 options) and
      "vendor-encapsulated-options-space", which is empty by default but
      options can be defined in it. Those options will be carried in the
      Vendor Specific Information option (code 43). The following examples
      show how to define an option "foo", with code 1, that consists of an
      IPv4 address, an unsigned 16 bit integer and a string. The "foo"
      option is conveyed in a Vendor Specific Information option.
      </p><p>
      The first step is to define the format of the option:
</p><pre class="screen">
"Dhcp4": {
    "option-def": [
        {
            <strong class="userinput"><code>"name": "foo",
            "code": 1,
            "space": "vendor-encapsulated-options-space",
            "type": "record",
            "array": false,
            "record-types": "ipv4-address, uint16, string",
            "encapsulate": ""</code></strong>
        }
    ],
    ...
}</pre><p>
     (Note that the option space is set to "vendor-encapsulated-options-space".)
     Once the option format is defined, the next step is to define actual values
     for that option:
</p><pre class="screen">
"Dhcp4": {
    "option-data": [
        {
            <strong class="userinput"><code>"name": "foo",
            "space": "vendor-encapsulated-options-space",
            "code": 1,
            "csv-format": true,
            "data": "192.0.2.3, 123, Hello World"</code></strong>
        }
    ],
    ...
}</pre><p>
    We also include the Vendor Specific Information option, the option
    that conveys our sub-option "foo". This is required, else the option
    will not be included in messages sent to the client.
</p><pre class="screen">
"Dhcp4": {
    "option-data": [
        {
            <strong class="userinput"><code>"name": "vendor-encapsulated-options"</code></strong>
        }
    ],
    ...
}</pre><p>
    Alternatively, the option can be specified using its code.

</p><pre class="screen">
"Dhcp4": {
    "option-data": [
        {
            <strong class="userinput"><code>"code": 43</code></strong>
        }
    ],
    ...
}</pre><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-option-spaces"></a>7.2.11. Nested DHCPv4 Options (Custom Option Spaces)</h3></div></div></div><p>It is sometimes useful to define completely new option
      space. This is the case when user creates new option in the
      standard option space ("dhcp4") and wants this option
      to convey sub-options. Since they are in a separate space,
      sub-option codes will have a separate numbering scheme and may
      overlap with the codes of standard options.
      </p><p>Note that creation of a new option space when defining
      sub-options for a standard option is not required, because it is
      created by default if the standard option is meant to convey any
      sub-options (see <a class="xref" href="#dhcp4-vendor-opts" title="7.2.10. DHCPv4 Vendor Specific Options">Section 7.2.10, “DHCPv4 Vendor Specific Options”</a>).
      </p><p>
      Assume that we want to have a DHCPv4 option called "container" with
      code 222 that conveys two sub-options with codes 1 and 2.
      First we need to define the new sub-options:
</p><pre class="screen">
"Dhcp4": {
    "option-def": [
        {
            <strong class="userinput"><code>"name": "subopt1",
            "code": 1,
            "space": "isc",
            "type": "ipv4-address",
            "record-types": "",
            "array": false,
            "encapsulate ""
        },
        {
            "name": "subopt2",
            "code": 2,
            "space": "isc",
            "type": "string",
            "record-types": "",
            "array": false,
            "encapsulate": ""</code></strong>
        }
    ],
    ...
}</pre><p>
    Note that we have defined the options to belong to a new option space
    (in this case, "isc").
    </p><p>
    The next step is to define a regular DHCPv4 option with our desired
    code and specify that it should include options from the new option space:
</p><pre class="screen">
"Dhcp4": {
    "option-def": [
        ...,
        {
            <strong class="userinput"><code>"name": "container",
            "code": 222,
            "space": "dhcp4",
            "type": "empty",
            "array": false,
            "record-types": "",
            "encapsulate": "isc"</code></strong>
        }
    ],
    ...
}</pre><p>
    The name of the option space in which the sub-options are defined
    is set in the "encapsulate" field. The "type" field is set to "empty"
    to indicate that this option does not carry any data other than
    sub-options.
    </p><p>
    Finally, we can set values for the new options:
</p><pre class="screen">
"Dhcp4": {
    "option-data": [
        {
            <strong class="userinput"><code>"name": "subopt1",
            "code": 1,
            "space": "isc",
            "data": "192.0.2.3"</code></strong>
        },
        }
            <strong class="userinput"><code>"name": "subopt2",
            "code": 2,
            "space": "isc",
            "data": "Hello world"</code></strong>
        },
        {
            <strong class="userinput"><code>"name": "container",
            "code": 222,
            "space": "dhcp4"</code></strong>
        }
    ],
    ...
}
</pre><p>
    </p><p>Note that it is possible to create an option which carries some data
    in addition to the sub-options defined in the encapsulated option space.  For example,
    if the "container" option from the previous example was required to carry an uint16
    value as well as the sub-options, the "type" value would have to be set to "uint16" in
    the option definition. (Such an option would then have the following
    data structure: DHCP header, uint16 value, sub-options.) The value specified
    with the "data" parameter — which should be a valid integer enclosed in quotes,
    e.g. "123" — would then be assigned to the uint16 field in the "container" option.
    </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-option-data-defaults"></a>7.2.12. Unspecified parameters for DHCPv4 option configuration</h3></div></div></div><p>In many cases it is not required to specify all parameters for
      an option configuration and the default values may be used. However, it is
      important to understand the implications of not specifying some of them
      as it may result in configuration errors. The list below explains
      the behavior of the server when a particular parameter is not explicitly
      specified:

      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="command"><strong>name</strong></span> - the server requires an option name or
          option code to identify an option. If this parameter is unspecified, the
          option code must be specified.
          </li><li class="listitem"><span class="command"><strong>code</strong></span> - the server requires an option name or
          option code to identify an option. This parameter may be left unspecified if
          the <span class="command"><strong>name</strong></span> parameter is specified. However, this also
          requires that the particular option has its definition (it is either a
          standard option or an administrator created a definition for the option
          using an 'option-def' structure), as the option definition associates an
          option with a particular name. It is possible to configure an option
          for which there is no definition (unspecified option format).
          Configuration of such options requires the use of option code.
          </li><li class="listitem"><span class="command"><strong>space</strong></span> - if the option space is unspecified it
          will default to 'dhcp4' which is an option space holding DHCPv4 standard
          options.
          </li><li class="listitem"><span class="command"><strong>data</strong></span> - if the option data is unspecified it
          defaults to an empty value. The empty value is mostly used for the
          options which have no payload (boolean options), but it is legal to specify
          empty values for some options which carry variable length data and which
          spec allows for the length of 0. For such options, the data parameter
          may be omitted in the configuration.</li><li class="listitem"><span class="command"><strong>csv-format</strong></span> - if this value is not specified
          and the definition for the particular option exists, the server will assume
          that the option data is specified as a list of comma separated values to be
          assigned to individual fields of the DHCP option. If the definition
          does not exist for this option, the server will assume that the data
          parameter contains the option payload in the binary format (represented
          as a string of hexadecimal digits). Note that not specifying this
          parameter doesn't imply that it defaults to a fixed value, but
          the configuration data interpretation also depends on the presence
          of the option definition. An administrator must be aware if the
          definition for the particular option exists when this parameter
          is not specified. It is generally recommended to not specify this
          parameter only for the options for which the definition exists, e.g.
          standard options. Setting <span class="command"><strong>csv-format</strong></span> to an explicit
          value will cause the server to strictly check the format of the option
          data specified.
          </li></ul></div><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-stateless-configuration"></a>7.2.13. Stateless Configuration of DHCPv4 clients</h3></div></div></div><p>The DHCPv4 server supports the stateless client configuration whereby the
      client has an IP address configured (e.g. using manual configuration) and only
      contacts the server to obtain other configuration parameters, e.g. DNS servers' addresses.
      In order to obtain the stateless configuration parameters the client sends the
      DHCPINFORM message to the server with the "ciaddr" set to the address that the
      client is currently using. The server unicasts the DHCPACK message to the
      client that includes the stateless configuration ("yiaddr" not set).
      </p><p>The server will respond to the DHCPINFORM when the client is associated
      with the particular subnet defined in the server's configuration. The example
      subnet configuration will look like this:
        </p><pre class="screen">
"Dhcp4": {
    "subnet4": [
        {
            "subnet": "192.0.2.0/24"
            "option-data": [ {
                "name": "domain-name-servers",
                "code": 6,
                "data": "192.0.2.200,192.0.2.201",
                "csv-format": true,
                "space": "dhcp4"
            } ]
        }
    ]
}</pre><p>
      </p><p>This subnet specifies the single option which will be included in
      the DHCPACK message to the client in response to DHCPINFORM. Note that
      the subnet definition does not require the address pool configuration
      if it will be used solely for the stateless configuration.
      </p><p>This server will associate the subnet with the client if one of
      the following conditions is met:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">The DHCPINFORM is relayed and the giaddr matches the
            configured subnet.</li><li class="listitem">The DHCPINFORM is unicast from the client and the ciaddr
            matches the configured subnet.</li><li class="listitem">The DHCPINFORM is unicast from the client, the ciaddr is
            not set but the source address of the IP packet matches the
            configured subnet.</li><li class="listitem">The DHCPINFORM is not relayed and the IP address on the
            interface on which the message is received matches the configured
            subnet.</li></ul></div><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-client-classifier"></a>7.2.14. Client Classification in DHCPv4</h3></div></div></div><p>
      The DHCPv4 server includes support for client classification.  At the
      current time the capabilities of the classification process are limited
      but it is expected they will be expanded in the future. For a deeper
      discussion of the classification process see <a class="xref" href="#classify" title="Chapter 12. Client Classification">Chapter 12, <i>Client Classification</i></a>.
      </p><p>
      In certain cases it is useful to differentiate between different types of
      clients and treat them accordingly. It is envisaged that client
      classification will be used for changing the behavior of almost any part of
      the DHCP message processing, including the assignment of leases from different
      pools, the assignment of different options (or different values of the same
      options) etc. In the current release of the software however, there are
      only three mechanisms that take advantage of client classification:
      subnet selection, assignment of different options, and, for cable modems, there
      are specific options for use with the TFTP server address and the boot file field.
      </p><p>
      Kea can be instructed to limit access to given subnets based on class information.
      This is particularly useful for cases where two types of devices share the
      same link and are expected to be served from two different subnets. The
      primary use case for such a scenario is cable networks. There are two
      classes of devices: the cable modem itself, which should be handed a lease
      from subnet A and all other devices behind the modem that should get a lease
      from subnet B. That segregation is essential to prevent overly curious
      users from playing with their cable modems. For details on how to set up
      class restrictions on subnets, see <a class="xref" href="#classification-subnets" title="12.5. Configuring Subnets With Class Information">Section 12.5, “Configuring Subnets With Class Information”</a>.
      </p><p>
      The process of doing classification is conducted in three steps. The first step
      is to assess an incoming packet and assign it to zero or more classes.  The
      second step is to choose a subnet, possibly based on the class information.
      The third step is to assign options again possibly based on the class
      information.
      </p><p>
      There are two methods of doing classification. The first is automatic and relies
      on examining the values in the vendor class options. Information from these
      options is extracted and a class name is constructed from it and added to
      the class list for the packet. The second allows you to specify an expression
      that is evaluated for each packet. If the result is true the packet is
      a member of the class.
      </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
        Care should be taken with client classification as it is easy for
        clients that do not meet class criteria to be denied any service altogether.
      </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="idp55897344"></a>7.2.14.1. Using Vendor Class Information in Classification</h4></div></div></div><p>
        The server checks whether an incoming packet includes the vendor class identifier
        option (60). If it does, the content of that option is prepended with
        "VENDOR_CLASS_" then it is interpreted as a class. For example,
        modern cable modems will send this option with value "docsis3.0"
        and as a result the packet will belong to class "VENDOR_CLASS_docsis3.0".
        </p><p>
        For clients that belong to the VENDOR_CLASS_docsis3.0 class, the siaddr
        field is set to the value of next-server (if specified in a subnet). If
        there is a boot-file-name option specified, its value is also set in the
        file field in the DHCPv4 packet. For eRouter1.0 class, the siaddr is
        always set to 0.0.0.0. That capability is expected to be moved to
        an external hook library that will be dedicated to cable modems.
        </p><p>
        This example shows a configuration using an automatically generated
        "VENDOR_CLASS_" class. The Administrator of the network has
        decided that addresses from range 192.0.2.10 to 192.0.2.20 are
        going to be managed by the Dhcp4 server and only clients belonging to the
        docsis3.0 client class are allowed to use that pool.

        </p><pre class="screen">
"Dhcp4": {
    "subnet4": [
        {
            "subnet": "192.0.2.0/24",
            "pools": [ { "pool": "192.0.2.10 - 192.0.2.20" } ],
            <strong class="userinput"><code>"client-class": "VENDOR_CLASS_docsis3.0"</code></strong>
        }
    ],
    ...
}</pre><p>
        </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="idp55901984"></a>7.2.14.2. Defining and Using Custom Classes</h4></div></div></div><p>
        The following example shows how to configure a class using an expression
        and a subnet making use of that class. This configuration defines the
        class named "Client_foo".
        It is comprised of all clients who's client ids (option 61) start with the
        string "foo". Members of this class will be given addresses from
        192.0.2.10 to 192.0.2.20 and 192.0.2.1 and 192.0.2.2 as their domain name
        servers. For a deeper discussion of the classification process see
        <a class="xref" href="#classify" title="Chapter 12. Client Classification">Chapter 12, <i>Client Classification</i></a>.

          </p><pre class="screen">
"Dhcp4": {
    "client-classes": [
        {<strong class="userinput"><code>
            "name": "Client_foo",
            "test": "substring(option[61].hex,0,3) == 'foo'",
            "option-data": [
                {
                    "name": "domain-name-servers",
                    "code": 6,
                    "space": "dhcp4",
                    "csv-format": true,
                    "data": "192.0.2.1, 192.0.2.2"
                }
            ]</code></strong>
        },
        ...
    ],
    "subnet4": [
        {
            "subnet": "192.0.2.0/24",
            "pools": [ { "pool": "192.0.2.10 - 192.0.2.20" } ],
            <strong class="userinput"><code>"client-class": "Client_foo"</code></strong>
        },
        ...
    ],
    ...
}</pre><p>
        </p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-ddns-config"></a>7.2.15. Configuring DHCPv4 for DDNS</h3></div></div></div><p>
      As mentioned earlier, kea-dhcp4 can be configured to generate requests to the
      DHCP-DDNS server (referred to here as "D2" ) to update DNS entries.  These requests are known as
      NameChangeRequests or NCRs.  Each NCR contains the following information:
      </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
      Whether it is a request to add (update) or remove DNS entries
      </p></li><li class="listitem"><p>
      Whether the change requests forward DNS updates (A records), reverse
      DNS updates (PTR records), or both.
      </p></li><li class="listitem"><p>
      The FQDN, lease address, and DHCID
      </p></li></ol></div><p>
      The parameters for controlling the generation of NCRs for submission to D2
      are contained in the <span class="command"><strong>dhcp-ddns</strong></span> section of the kea-dhcp4 server
      configuration. The mandatory parameters for the DHCP DDNS configuration
      are <span class="command"><strong>enable-updates</strong></span> which is unconditionally
      required, and <span class="command"><strong>qualifying-suffix</strong></span> which has no
      default value and is required when <span class="command"><strong>enable-updates</strong></span>
      is set to <span class="command"><strong>true</strong></span>.

      The two (disabled and enabled) minimal DHCP DDNS configurations are:
</p><pre class="screen">
"Dhcp4": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"enable-updates": false</code></strong>
    },
    ...
}
</pre><p>
      and for example:
</p><pre class="screen">
"Dhcp4": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"enable-updates": true,
        "qualifying-suffix": "example."</code></strong>
    },
    ...
}
</pre><p>

      The default values for the "dhcp-ddns" section are as follows:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
      <span class="command"><strong>"server-ip": "127.0.0.1"</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"server-port": 53001</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"sender-ip": ""</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"sender-port": 0</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"max-queue-size": 1024</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"ncr-protocol": "UDP"</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"ncr-format": "JSON"</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"override-no-update": false</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"override-client-update": false</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"replace-client-name": false</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"generated-prefix": "myhost"</strong></span>
      </li></ul></div><p>
      </p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="dhcpv4-d2-io-config"></a>7.2.15.1. DHCP-DDNS Server Connectivity</h4></div></div></div><p>
      In order for NCRs to reach the D2 server, kea-dhcp4 must be able
      to communicate with it.  kea-dhcp4 uses the following configuration
      parameters to control how it communications with D2:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
      <span class="command"><strong>enable-updates</strong></span> - determines whether or not kea-dhcp4 will
      generate NCRs.  By default, this value is false hence DDNS updates are
      disabled.  To enable DDNS updates set this value to true:
      </li><li class="listitem">
      <span class="command"><strong>server-ip</strong></span> - IP address on which D2 listens for requests. The default is
      the local loopback interface at address 127.0.0.1. You may specify
      either an IPv4 or IPv6 address.
      </li><li class="listitem">
      <span class="command"><strong>server-port</strong></span> - port on which D2 listens for requests.  The default value
      is 53001.
      </li><li class="listitem">
      <span class="command"><strong>sender-ip</strong></span> - IP address which kea-dhcp4 should use to send requests to D2.
      The default value is blank which instructs kea-dhcp4 to select a suitable
      address.
      </li><li class="listitem">
      <span class="command"><strong>sender-port</strong></span> - port which kea-dhcp4 should use to send requests to D2. The
      default value of 0 instructs kea-dhcp4 to select a suitable port.
      </li><li class="listitem">
      <span class="command"><strong>max-queue-size</strong></span> - maximum number of requests allowed to queue waiting to
      be sent to D2. This value guards against requests accumulating
      uncontrollably if they are being generated faster than they can be
      delivered.  If the number of requests queued for transmission reaches
      this value, DDNS updating will be turned off until the queue backlog has
      been sufficiently reduced.  The intention is to allow the kea-dhcp4 server to
      continue lease operations without running the risk that its memory usage
      grows without limit.  The default value is 1024.
      </li><li class="listitem">
      <span class="command"><strong>ncr-protocol</strong></span> - socket protocol use when sending requests to D2.  Currently
      only UDP is supported.  TCP may be available in an upcoming release.
      </li><li class="listitem">
      <span class="command"><strong>ncr-format</strong></span> - packet format to use when sending requests to D2.
      Currently only JSON format is supported.  Other formats may be available
      in future releases.
      </li></ul></div><p>
      By default, kea-dhcp-ddns is assumed to be running on the same machine as kea-dhcp4, and
      all of the default values mentioned above should be sufficient.
      If, however, D2 has been configured to listen on a different address or
      port, these values must be altered accordingly. For example, if D2 has been
      configured to listen on 192.168.1.10 port 900, the following configuration
      would be required:
</p><pre class="screen">
"Dhcp4": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"server-ip": "192.168.1.10",
        "server-port": 900</code></strong>,
        ...
    },
    ...
}
</pre><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="dhcpv4-d2-rules-config"></a>7.2.15.2. When Does the kea-dhcp4 Server Generate DDNS Requests?</h4></div></div></div><p>kea-dhcp4 follows the behavior prescribed for DHCP servers in
      <a class="ulink" href="http://tools.ietf.org/html/rfc4702" target="_top">RFC 4702</a>.
      It is important to keep in mind that kea-dhcp4 provides the initial decision
      making of when and what to update and forwards that information to D2 in
      the form of NCRs. Carrying out the actual DNS updates and dealing with
      such things as conflict resolution are within the purview of D2 itself (<a class="xref" href="#dhcp-ddns-server" title="Chapter 10. The DHCP-DDNS Server">Chapter 10, <i>The DHCP-DDNS Server</i></a>).
      This section describes when kea-dhcp4 will generate NCRs and the
      configuration parameters that can be used to influence this decision.
      It assumes that the "enable-updates" parameter is true.
      </p><p>
      In general, kea-dhcp4 will generate DDNS update requests when:
      </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
      A new lease is granted in response to a DHCP REQUEST
      </p></li><li class="listitem"><p>
      An existing lease is renewed but the FQDN associated with it has
      changed.
      </p></li><li class="listitem"><p>
      An existing lease is released in response to a DHCP RELEASE
      </p></li></ol></div><p>
      In the second case, lease renewal, two  DDNS requests will be issued: one
      request to remove entries for the previous FQDN and a second request to
      add entries for the new FQDN.  In the last case, a lease release, a
      single DDNS request to remove its entries will be made.  The decision
      making involved when granting a new lease (the first case) is more
      involved and is discussed next.
      </p><p>
      When a new lease is granted, kea-dhcp4 will generate a DDNS
      update request if the DHCP REQUEST contains either the FQDN option
      (code 81) or the Host Name option (code 12). If both are present,
      the server will use the FQDN option. By default kea-dhcp4
      will respect the FQDN N and S flags specified by the client as shown
      in the following table:
      </p><div class="table"><a name="fqdn-flag-table"></a><p class="title"><b>Table 7.4. Default FQDN Flag Behavior</b></p><div class="table-contents"><table summary="Default FQDN Flag Behavior" border="1"><colgroup><col align="left" class="cflags"><col align="left" class="meaning"><col align="left" class="response"><col align="left" class="sflags"></colgroup><thead><tr><th align="left">Client Flags:N-S</th><th align="left">Client Intent</th><th align="left">Server Response</th><th align="left">Server Flags:N-S-O</th></tr></thead><tbody><tr><td align="left">0-0</td><td align="left">
                Client wants to do forward updates, server should do reverse updates
                </td><td align="left">Server generates reverse-only request</td><td align="left">1-0-0</td></tr><tr><td align="left">0-1</td><td align="left">Server should do both forward and reverse updates</td><td align="left">Server generates request to update both directions</td><td align="left">0-1-0</td></tr><tr><td align="left">1-0</td><td align="left">Client wants no updates done</td><td align="left">Server does not generate a request</td><td align="left">1-0-0</td></tr></tbody></table></div></div><br class="table-break"><p>
      The first row in the table above represents "client delegation". Here
      the DHCP client states that it intends to do the forward DNS updates and
      the server should do the reverse updates.  By default, kea-dhcp4 will honor
      the client's wishes and generate a DDNS request to the DHCP-DDNS server to update only
      reverse DNS data.  The parameter <span class="command"><strong>override-client-update</strong></span> can be used
      to instruct the server to override client delegation requests.  When
      this parameter is true, kea-dhcp4 will disregard requests for client
      delegation and generate a DDNS request to update both forward and
      reverse DNS data.  In this case, the N-S-O flags in the server's
      response to the client will be 0-1-1 respectively.
      </p><p>
      (Note that the flag combination N=1, S=1 is prohibited according to
      <a class="ulink" href="http://tools.ietf.org/html/rfc4702" target="_top">RFC 4702</a>. If such a combination is received from the client, the packet
      will be dropped by kea-dhcp4.)
      </p><p>
      To override client delegation, set the following values in your configuration
      file:
      </p><pre class="screen">
"Dhcp4": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"override-client-update": true</code></strong>,
        ...
    },
    ...
}
</pre><p>
      The third row in the table above describes the case in which the client
      requests that no DNS updates be done. The parameter, <span class="command"><strong>override-no-update</strong></span>,
      can be used to instruct the server to disregard the client's wishes. When
      this parameter is true, kea-dhcp4 will generate a DDNS update request to kea-dhcp-ddns
      even if the client requests that no updates be done.  The N-S-O flags in the
      server's response to the client will be 0-1-1.
      </p><p>
      To override client delegation, the following values should be set in your configuration:
      </p><pre class="screen">
"Dhcp4": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"override-no-update": true</code></strong>,
        ...
    },
    ...
}
</pre><p>
      kea-dhcp4 will always generate DDNS update requests if the client request
      only contains the Host Name option. In addition it will include an FQDN
      option in the response to the client with the FQDN N-S-O flags set to
      0-1-0 respectively. The domain name portion of the FQDN option will be
      the name submitted to D2 in the DDNS update request.
      </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="dhcpv4-fqdn-name-generation"></a>7.2.15.3. kea-dhcp4 name generation for DDNS update requests</h4></div></div></div><p>Each NameChangeRequest must of course include the fully qualified domain
      name whose DNS entries are to be affected.  kea-dhcp4 can be configured to
      supply a portion or all of that name based upon what it receives from
      the client in the DHCP REQUEST.</p><p>
      The rules for determining the FQDN option are as follows:
      </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
      If configured to do, so ignore the DHCPREQUEST contents and generate a
      FQDN using a configurable prefix and suffix.
      </p></li><li class="listitem"><p>
      If the DHCPREQUEST contains the client FQDN option, the candidate
      name is taken from there, otherwise it is taken from the Host Name option.
      The candidate name may then be modified:
      </p><div class="orderedlist"><ol class="orderedlist" type="a"><li class="listitem"><p>
      If the candidate name is a fully qualified domain name, use it.
      </p></li><li class="listitem"><p>
      If the candidate name is a partial (i.e. unqualified) name then
      add a configurable suffix to the name and use the result as the FQDN.
      </p></li><li class="listitem"><p>
      If the candidate name is a empty, generate a FQDN using a
      configurable prefix and suffix.
      </p></li></ol></div><p>
      </p></li></ol></div><p>
      To instruct kea-dhcp4 to always generate the FQDN for a client, set the
      parameter <span class="command"><strong>replace-client-name</strong></span> to true as follows:
      </p><pre class="screen">
"Dhcp4": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"replace-client-name": true</code></strong>,
        ...
    },
    ...
}
</pre><p>
      The prefix used in the generation of a FQDN is specified by the
      <span class="command"><strong>generated-prefix</strong></span> parameter.  The default value is "myhost".  To alter
      its value simply set it to the desired string:
      </p><pre class="screen">
"Dhcp4": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"generated-prefix": "another.host"</code></strong>,
        ...
    },
    ...
}
</pre><p>
      The suffix used when generating a FQDN or when qualifying a
      partial name is specified by
      the <span class="command"><strong>qualifying-suffix</strong></span> parameter. This
      parameter has no default value, thus it is mandatory when
      DDNS updates are enabled.
      To set its value simply set it to the desired string:
      </p><pre class="screen">
"Dhcp4": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"qualifying-suffix": "foo.example.org"</code></strong>,
        ...
    },
    ...
}
</pre></div><p>
      When generating a name, kea-dhcp4 will construct name of the format:
      </p><p>
        [generated-prefix]-[address-text].[qualifying-suffix].
      </p><p>
      where address-text is simply the lease IP address converted to a
      hyphenated string.  For example, if the lease address is 172.16.1.10,
      the qualifying suffix "example.com", and the default value is used for
      <span class="command"><strong>generated-prefix</strong></span>, the generated FQDN would be:
      </p><p>
        myhost-172-16-1-10.example.com.
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-next-server"></a>7.2.16. Next Server (siaddr)</h3></div></div></div><p>In some cases, clients want to obtain configuration from the TFTP server.
      Although there is a dedicated option for it, some devices may use the siaddr field
      in the DHCPv4 packet for that purpose. That specific field can be configured
      using <span class="command"><strong>next-server</strong></span> directive. It is possible to define it in the global scope or
      for a given subnet only. If both are defined, the subnet value takes precedence.
      The value in subnet can be set to 0.0.0.0, which means that <span class="command"><strong>next-server</strong></span> should
      not be sent. It may also be set to an empty string, which means the same as if
      it was not defined at all, i.e. use the global value.
      </p><pre class="screen">
"Dhcp4": {
    <strong class="userinput"><code>"next-server": "192.0.2.123"</code></strong>,
    ...,
    "subnet4": [
        {
            <strong class="userinput"><code>"next-server": "192.0.2.234"</code></strong>,
            ...
        }
    ]
}
</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-echo-client-id"></a>7.2.17. Echoing Client-ID (RFC 6842)</h3></div></div></div><p>The original DHCPv4 specification
      (<a class="ulink" href="http://tools.ietf.org/html/rfc2131" target="_top">RFC 2131</a>)
      states that the DHCPv4
      server must not send back client-id options when responding to
      clients. However, in some cases that confused clients that did
      not have MAC address or client-id; see
      <a class="ulink" href="http://tools.ietf.org/html/rfc6842" target="_top">RFC 6842</a>.
      for details. That
      behavior has changed with the publication of
      <a class="ulink" href="http://tools.ietf.org/html/rfc6842" target="_top">RFC 6842</a>.
      which updated
      <a class="ulink" href="http://tools.ietf.org/html/rfc2131" target="_top">RFC 2131</a>.
      That update now states that the server must
      send client-id if the client sent it. That is the default behaviour
      that Kea offers. However, in some cases older devices that do
      not support
      <a class="ulink" href="http://tools.ietf.org/html/rfc6842" target="_top">RFC 6842</a>.
      may refuse to accept responses that include the
      client-id option. To enable backward compatibility, an optional
      configuration parameter has been introduced. To configure it,
      use the following configuration statement:</p><pre class="screen">
"Dhcp4": {
    <strong class="userinput"><code>"echo-client-id": false</code></strong>,
    ...
}
</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-match-client-id"></a>7.2.18. Using Client Identifier and Hardware Address</h3></div></div></div><p>DHCP server must be able to identify the client (distinguish it from
      other clients) from which it receives the message. There are many reasons
      why this identification is required and the most important ones are listed
      below.
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">When the client contacts the server to allocate a new
        lease, the server must store the client identification information in
        the lease database as a search key.</li><li class="listitem">When the client is trying to renew or release the existing
        lease, the server must be able to find the existing lease entry in the
        database for this client, using the client identification information as a
        search key.</li><li class="listitem">Some configurations use static reservations for the IP
        addresses and other configuration information. The server's administrator
        uses client identification information to create these static assignments.
        </li><li class="listitem">In the dual stack networks there is often a need to
        correlate the lease information stored in DHCPv4 and DHCPv6 server for
        a particular host. Using common identification information by the DHCPv4
        and DHCPv6 client allows the network administrator to achieve this
        correlation and better administer the network.</li></ul></div><p>
      </p><p>DHCPv4 makes use of two distinct identifiers which are placed
      by the client in the queries sent to the server and copied by the server
      to its responses to the client: 'chaddr' and 'client identifier'. The
      former was introduced as a part of the BOOTP specification and it is also
      used by DHCP to carry the hardware address of the interface used to send
      the query to the server (MAC address for the Ethernet). The latter is
      carried in the Client-identifier option, introduced in the
      <a class="ulink" href="http://tools.ietf.org/html/rfc2132" target="_top">RFC 2132</a>.
      </p><p>The <a class="ulink" href="http://tools.ietf.org/html/rfc2131" target="_top">RFC 2131</a>
      indicates that the server may use both of these identifiers to identify
      the client but the 'client identifier', if present, takes precedence
      over 'chaddr'. One of the reasons for this is that 'client identifier'
      is independent from the hardware used by the client to communicate with
      the server. For example, if the client obtained the lease using one
      network card and then the network card is moved to another host, the
      server will wrongly identify this host is the one which has obtained
      the lease. Moreover, the
      <a class="ulink" href="https://tools.ietf.org/html/rfc4361" target="_top">RFC 4361</a> gives
      the recommendation to use DUID
      (see <a class="ulink" href="https://tools.ietf.org/html/rfc3315" target="_top">DHCPv6 specification</a>)
      carried as 'client identifier' when dual stack networks are in use,
      to provide consistent identification information of the client, regardless
      of the protocol type it is using. Kea adheres to these specifications and
      the 'client identifier' by default takes precedence over the value carried
      in 'chaddr' field when the server searches, creates, updates or removes
      the client's lease.
      </p><p>When the server receives a DHCPDISCOVER or DHCPREQUEST message from the
      client, it will try to find out if the client already has a lease in the
      database and will hand out the existing lease rather than allocate
      a new one. Each lease in the lease database is associated with the
      'client identifier' and/or 'chaddr'. The server will first use the
      'client identifier' (if present) to search the lease. If the lease is
      found, the server will treat this lease as belonging to the client
      even if the current 'chaddr' and the 'chaddr' associated with
      the lease do not match. This facilitates the scenario when the network card
      on the client system has been replaced and thus the new MAC address
      appears in the messages sent by the DHCP client. If the server fails
      to find the lease using the 'client identifier' it will perform another lookup
      using the 'chaddr'. If this lookup returns no result, the client is
      considered as not having a lease and the new lease will be created.
      </p><p>A common problem reported by network operators is that bogus
      client implementations do not use stable client identifiers such as
      generating a new 'client identifier' each time the client connects
      to the network. Another well known case is when the client changes its
      'client identifier' during the multi-stage boot process (PXE). In such
      cases, the MAC address of the client's interface remains stable and
      using 'chaddr' field to identify the client guarantees that the
      particular system is considered to be the same client, even though its
      'client identifier' changes.
      </p><p>To address this problem, Kea includes a configuration option
      which enables client identification using 'chaddr' only by instructing
      the server to disregard server to "ignore" the 'client identifier' during
      lease lookups and allocations for a particular subnet. Consider the following
      simplified server configuration:</p><pre class="screen">
"Dhcp4": {
    ...
    <strong class="userinput"><code>"match-client-id": true,</code></strong>
    ...
    "subnet4": [
    {
        "subnet": "192.0.10.0/24",
        "pools": [ { "pool": "192.0.2.23-192.0.2.87" } ],
        <strong class="userinput"><code>"match-client-id": false</code></strong>
    },
    {
        "subnet": "10.0.0.0/8",
        "pools": [ { "pool": "10.0.0.23-10.0.2.99" } ],
    }
    ]
}
</pre><p>The <span class="command"><strong>match-client-id</strong></span> is a boolean value which
     controls this behavior. The default value of <strong class="userinput"><code>true</code></strong>
     indicates that the server will use the 'client identifier' for lease
     lookups and 'chaddr' if the first lookup returns no results. The
     <span class="command"><strong>false</strong></span> means that the server will only
     use the 'chaddr' to search for client's lease. Whether the DHCID for
     DNS updates is generated from the 'client identifier' or 'chaddr' is
     controlled through the same parameter accordingly.</p><p>The <span class="command"><strong>match-client-id</strong></span> parameter may appear
     both in the global configuration scope and/or under any subnet
     declaration. In the example shown above, the effective value of the
     <span class="command"><strong>match-client-id</strong></span> will be <strong class="userinput"><code>false</code></strong>
     for the subnet 192.0.10.0/24, because the subnet specific setting
     of the parameter overrides the global value of the parameter. The
     effective value of the <span class="command"><strong>match-client-id</strong></span> for the subnet
     10.0.0.0/8 will be set to <strong class="userinput"><code>true</code></strong> because the
     subnet declaration lacks this parameter and the global setting is
     by default used for this subnet. In fact, the global entry for this
     parameter could be omitted in this case, because
     <strong class="userinput"><code>true</code></strong> is the default value.
     </p><p>It is important to explain what happens when the client obtains
     its lease for one setting of the <span class="command"><strong>match-client-id</strong></span>
     and then renews when the setting has been changed. Let's first consider
     the case when the client obtains the lease when the
     <span class="command"><strong>match-client-id</strong></span> is set to <strong class="userinput"><code>true</code></strong>.
     The server will store the lease information including 'client identifier'
     (if supplied) and 'chaddr' in the lease database. When the setting is
     changed and the client renews the lease the server will determine that
     it should use the 'chaddr' to search for the existing lease. If the
     client hasn't changed its MAC address the server should successfully
     find the existing lease. The 'client identifier' associated with the
     returned lease is ignored and the client is allowed to use this lease.
     When the lease is renewed only the 'chaddr' is recorded for this
     lease according to the new server setting.
     </p><p>In the second case the client has the lease with only a 'chaddr'
     value recorded. When the setting is changed to
     <span class="command"><strong>match-client-id</strong></span> set to <strong class="userinput"><code>true</code></strong>
     the server will first try to use the 'client identifier' to find the
     existing client's lease. This will return no results because the
     'client identifier' was not recorded for this lease. The server will
     then use the 'chaddr' and the lease will be found. If the lease appears
     to have no 'client identifier' recorded, the server will assume that
     this lease belongs to the client and that it was created with the previous
     setting of the <span class="command"><strong>match-client-id</strong></span>.
     However, if the lease contains 'client identifier' which is different
     from the 'client identifier' used by the client the lease will be
     assumed to belong to another client and the new lease will be
     allocated.
     </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="host-reservation-v4"></a>7.3. Host reservation in DHCPv4</h2></div></div></div><p>There are many cases where it is useful to provide a configuration on
    a per host basis. The most obvious one is to reserve specific, static
    address for exclusive use by a given client (host) ‐ returning client will
    receive the same address from the server every time, and other clients will
    generally not receive that address. Note that there may be cases when the
    new reservation has been made for the client for the address being currently
    in use by another client. We call this situation a "conflict". The conflicts
    get resolved automatically over time as described in the subsequent sections.
    Once conflict is resolved, the client will keep receiving the reserved
    configuration when it renews.</p><p>Another example when the host reservations are applicable is when a host
    that has specific requirements, e.g. a printer that needs additional DHCP options.
    Yet another possible use case is to define unique names for hosts. Although not all
    of the presented use cases are implemented yet, Kea software will support them in the
    near future.</p><p>Hosts reservations are defined as parameters for each subnet. Each host
    has to be identified by its hardware/MAC address. There is an optional
    <span class="command"><strong>reservations</strong></span> array in the <span class="command"><strong>Subnet4</strong></span>
    element. Each element in that array is a structure, that holds information
    about reservations for a single host. In particular, such a structure has
    to have an identifier that uniquely identifies a host.  In DHCPv4 context, such an
    identifier is a hardware or MAC address.  In most cases, also an address
    will be specified. It is possible to specify a hostname. Additional
    capabilities are planned.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>In Kea 1.0.0 it is only possible to create host reservations
    using client's hardware address. Host reservations by client identifier
    (or DUID) are not supported in this version of Kea. This capability will
    be implemented in Kea 1.1.0. Currently, the configuration parsing code
    will accept the "duid" parameter in the reservation configuration, but
    the server will misinterpret its value. Therefore, this parameter MUST
    NOT be used until the client identifier based host reservations are
    properly implemented and documented.</p></div><p>The following example shows how to reserve addresses for specific
    hosts:

</p><pre class="screen">
"subnet4": [
    {
        "pools": [ { "pool":  "192.0.2.1 - 192.0.2.200" } ],
        "subnet": "192.0.2.0/24",
        "interface": "eth0",
        <strong class="userinput"><code>"reservations": [
            {
                "hw-address": "1a:1b:1c:1d:1e:1f",
                "ip-address": "192.0.2.202"
            },
            {
                "hw-address": "0a:0b:0c:0d:0e:0f",
                "ip-address": "192.0.2.100",
                "hostname": "alice-laptop"
            }
        ]</code></strong>
    }
]
</pre><p>
    The first entry reserves the 192.0.2.202 address for the client that uses
    MAC address of 1a:1b:1c:1d:1e:1f. The second entry reserves the address
    192.0.2.100 and the hostname of alice-laptop for client using MAC
    address 0a:0b:0c:0d:0e:0f. Note that if you plan to do DNS updates, it
    is strongly recommended for the hostnames to be unique.
    </p><p>Making a reservation for a mobile host that may visit multiple subnets
    requires a separate host definition in each subnet it is expected to visit.
    It is not allowed to define multiple host definitions with the same hardware
    address in a single subnet. It is a valid configuration, if such definitions
    are specified in different subnets, though.
    </p><p>Adding host reservation incurs a performance penalty. In principle,
    when the server that does not support host reservation responds to a query,
    it needs to check whether there is a lease for a given address being
    considered for allocation or renewal. The server that also supports host
    reservation, has to perform additional checks: not only if the address is
    currently used (if there is a lease for it), but also whether the address
    could be used by someone else (if there is a reservation for it). That
    additional check incurs performance penalty.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="reservation4-types"></a>7.3.1. Address reservation types</h3></div></div></div><p>In a typical scenario there is an IPv4 subnet defined,
      e.g. 192.0.2.0/24, with certain part of it dedicated for dynamic allocation
      by the DHCPv4 server. That dynamic part is referred to as a dynamic pool or
      simply a pool. In principle, the host reservation can reserve any address
      that belongs to the subnet. The reservations that specify addresses that
      belong to configured pools are called <span class="command"><strong>in-pool reservations</strong></span>.
      In contrast, those that do not belong to dynamic pools are called
      <span class="command"><strong>out-of-pool reservations</strong></span>. There is no formal difference
      in the reservation syntax. As of 0.9.1, both reservation types are
      handled uniformly. However, upcoming releases may offer improved performance
      if there are only out-of-pool reservations as the server will be able
      to skip reservation checks when dealing with existing leases. Therefore,
      system administrators are encouraged to use out-of-pool reservations, if
      possible.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="reservation4-conflict"></a>7.3.2. Conflicts in DHCPv4 reservations</h3></div></div></div><p>As the reservations and lease information are stored separately,
      conflicts may arise. Consider the following series of events. The server
      has configured the dynamic pool of addresses from the range of 192.0.2.10 to
      192.0.2.20. The Host A requests an address and gets 19.0.2.10. Now the system
      administrator decides to reserve the address for the Host B. He decides to
      reserve 192.0.2.10 for that purpose. In general, reserving an address that
      is currently assigned to someone else is not recommended, but there are
      valid use cases where such an operation is warranted.</p><p>The server now has a conflict to resolve. Let's analyze the
      situation here. If the Host B boots up and requests an address, the server is
      not able to assign the reserved address 192.0.2.10 for the Host B. A naive
      approach would to be immediately remove the existing lease for the Host A
      and create a new one for the Host B. That would not solve the problem,
      though, because as soon as the Host B gets the address, it will detect
      that the address is already in use by the Host A and would send
      the DHCPDECLINE message. Therefore, in this situation, the server has
      to temporarily assign a different address (not matching what has been
      reserved) to the Host B.</p><p>When the Host A renews its address, the server will discover that
      the address being renewed is now reserved for another host - the Host
      B. Therefore the server will inform the Host A that it is no longer
      allowed to use it by sending DHCPNAK message. The server will not remove the
      lease, though, as there's small chance that the DHCPNAK may be lost if the
      network is lossy. If that happens, the client will not receive any
      responses, so it will retransmit its DHCPREQUEST packet. Once the
      DHCPNAK is received by the Host A, it will then revert to the server
      discovery and will eventually get a different address. Besides
      allocating a new lease, the server will also remove the old one. As
      a result, the address 192.0.2.10 will be no longer used. When Host B
      tries to renew its temporarily assigned address, the server will detect
      that it has a valid lease, but there is a reservation for a different
      address. The server will send DHCPNAK to inform Host B that its address
      is no longer usable, but will keep its lease (again, the DHCPNAK may be
      lost, so the server will keep it, until the client returns for a new
      address). The Host B will revert to the server discovery phase and will
      eventually send a DHCPREQUEST message. This time the server will find
      out that there is a reservation for that host and the reserved address
      192.0.2.10 is not used, so it will be granted. It will also remove the
      lease for the temporarily assigned address that the Host B previously
      obtained.</p><p>This recovery will succeed, even if other hosts will attempt to get
      the reserved address. Had the Host C requested address 192.0.2.10 after
      the reservation was made, the server will either offer a different
      address (when responding to DHCPDISCOVER) or would send DHCPNAK
      (when responding to DHCPREQUEST).</p><p>This recovery mechanism allows the server to fully recover from a
      case where reservations conflict with the existing leases. This procedure
      takes time and will roughly take as long as renew-timer value specified.
      The best way to avoid such recovery is to not define new reservations that
      conflict with existing leases. Another recommendation is to use
      out-of-pool reservations. If the reserved address does not belong to a
      pool, there is no way that other clients could get this address (note that
      having multiple reservations for the same address is not allowed).
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="reservation4-hostname"></a>7.3.3. Reserving a hostname</h3></div></div></div><p>When the reservation for the client includes the <span class="command"><strong>hostname
      </strong></span>, the server will assign this hostname to the client and send
      it back in the Client FQDN or Hostname option, depending on which of them
      the client has sent to the server. The reserved hostname always takes
      precedence over the hostname supplied by the client or the autogenerated
      (from the IPv4 address) hostname.</p><p>The server qualifies the reserved hostname with the value
      of the <span class="command"><strong>qualifying-suffix</strong></span> parameter. For example, the
      following subnet configuration:
</p><pre class="screen">
    {
        "subnet4": [ {
            "subnet": "10.0.0.0/24",
            "pools": [ { "pool": "10.0.0.10-10.0.0.100" } ],
            "reservations": [
               {
                 "hw-address": "aa:bb:cc:dd:ee:ff",
                 "hostname": "alice-laptop"
               }
            ]
         }],
        "dhcp-ddns": {
            "enable-updates": true,
            "qualifying-suffix": "example.isc.org."
        }
    }
</pre><p>
      will result in assigning the "alice-laptop.example.isc.org." hostname to the
      client using the MAC address "aa:bb:cc:dd:ee:ff". If the <span class="command"><strong>qualifying-suffix
      </strong></span> is not specified, the default (empty) value will be used, and
      in this case the value specified as a <span class="command"><strong>hostname</strong></span> will
      be treated as fully qualified name. Thus, by leaving the
      <span class="command"><strong>qualifying-suffix</strong></span> empty it is possible to qualify
      hostnames for the different clients with different domain names:
</p><pre class="screen">
    {
        "subnet4": [ {
            "subnet": "10.0.0.0/24",
            "pools": [ { "pool": "10.0.0.10-10.0.0.100" } ],
            "reservations": [
               {
                 "hw-address": "aa:bb:cc:dd:ee:ff",
                 "hostname": "alice-laptop.isc.org."
               },
               {
                 "hw-address": "12:34:56:78:99:AA",
                 "hostname": "mark-desktop.example.org."
               }

            ]
         }],
        "dhcp-ddns": {
            "enable-updates": true,
        }
    }
</pre><p>

      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="reservation4-options"></a>7.3.4. Reserving specific options</h3></div></div></div><p>Currently it is not possible to specify options in host
      reservation. Such a feature will be added in the upcoming Kea
      releases.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="reservation4-mode"></a>7.3.5. Fine Tuning IPv4 Host Reservation</h3></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p><span class="command"><strong>reservation-mode</strong></span> configuration parameter in DHCPv4
        server is accepted, but not used in the Kea 0.9.1 beta. Full implementation
        will be available in the upcoming releases.</p></div><p>Host reservation capability introduces additional restrictions for the
      allocation engine during lease selection and renewal. In particular, three
      major checks are necessary. First, when selecting a new lease, it is not
      sufficient for a candidate lease to be not used by another DHCP client. It
      also must not be reserved for another client. Second, when renewing a lease,
      additional check must be performed whether the address being renewed is not
      reserved for another client. Finally, when a host renews an address, the server
      has to check whether there's a reservation for this host, so the existing
      (dynamically allocated) address should be revoked and the reserved one be
      used instead.
      </p><p>Some of those checks may be unnecessary in certain deployments. Not
      performing them may improve performance. The Kea server provides the
      <span class="command"><strong>reservation-mode</strong></span> configuration parameter to select the
      types of reservations allowed for the particular subnet. Each reservation
      type has different constraints for the checks to be performed by the
      server when allocating or renewing a lease for the client.
      Allowed values are:

      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> <span class="command"><strong>all</strong></span> - enables all host reservation
      types. This is the default value. This setting is the safest and the most
      flexible. It allows in-pool and out-of-pool reservations. As all checks
      are conducted, it is also the slowest.
      </li><li class="listitem"> <span class="command"><strong>out-of-pool</strong></span> - allows only out of
      pool host reservations.  With this setting in place, the server may assume
      that all host reservations are for addresses that do not belong to the
      dynamic pool. Therefore it can skip the reservation checks when dealing
      with in-pool addresses, thus improving performance. Do not use this mode
      if any of your reservations use in-pool address. Caution is advised when
      using this setting. Kea 0.9.1 does not sanity check the reservations against
      <span class="command"><strong>reservation-mode</strong></span>. Misconfiguration may cause problems.
      </li><li class="listitem">
      <span class="command"><strong>disabled</strong></span> - host reservation support is disabled. As there
      are no reservations, the server will skip all checks. Any reservations defined
      will be completely ignored. As the checks are skipped, the server may
      operate faster in this mode.
      </li></ul></div><p>
      </p><p>
        An example configuration that disables reservation looks like follows:
</p><pre class="screen">
"Dhcp4": {
    "subnet4": [
    {
        "subnet": "192.0.2.0/24",
        <strong class="userinput"><code>"reservation-mode": "disabled"</code></strong>,
        ...
    }
    ]
}
</pre><p>
      </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp4-serverid"></a>7.4. Server Identifier in DHCPv4</h2></div></div></div><p>
        The DHCPv4 protocol uses a "server identifier" to allow clients
        to discriminate between several servers present on the same link: this
        value is an IPv4 address of the server. The server chooses the IPv4 address
        of the interface on which the message from the client (or relay) has been
        received. A single server instance will use multiple server identifiers
        if it is receiving queries on multiple interfaces.
      </p><p>
        Currently there is no mechanism to override the default server identifiers
        by an administrator. In the future, the configuration mechanism will be used
        to specify the custom server identifier.
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp4-subnet-selection"></a>7.5. How the DHCPv4 Server Selects a Subnet for the Client</h2></div></div></div><p>
        The DHCPv4 server differentiates between the directly connected clients,
        clients trying to renew leases and clients sending their messages through
        relays. For the directly connected clients the server will check the
        configuration for the interface on which the message has been received, and
        if the server configuration doesn't match any configured subnet the
        message is discarded.</p><p>Assuming that the server's interface is configured with the
        IPv4 address 192.0.2.3, the server will only process messages received through
        this interface from a directly connected client if there is a subnet
        configured to which this IPv4 address belongs, e.g. 192.0.2.0/24.
        The server will use this subnet to assign IPv4 address for the client.
      </p><p>
        The rule above does not apply when the client unicasts its message, i.e.
        is trying to renew its lease. Such a message is accepted through any
        interface. The renewing client sets ciaddr to the currently used IPv4
        address. The server uses this address to select the subnet for the client
        (in particular, to extend the lease using this address).
      </p><p>
        If the message is relayed it is accepted through any interface. The giaddr
        set by the relay agent is used to select the subnet for the client.
      </p><p>
        It is also possible to specify a relay IPv4 address for a given subnet. It
        can be used to match incoming packets into a subnet in uncommon configurations,
        e.g. shared subnets. See <a class="xref" href="#dhcp4-relay-override" title="7.5.1. Using a Specific Relay Agent for a Subnet">Section 7.5.1, “Using a Specific Relay Agent for a Subnet”</a> for details.
      </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>The subnet selection mechanism described in this section is based
        on the assumption that client classification is not used. The classification
        mechanism alters the way in which a subnet is selected for the client,
        depending on the classes to which the client belongs.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-relay-override"></a>7.5.1. Using a Specific Relay Agent for a Subnet</h3></div></div></div><p>
        The relay has to have an interface connected to the link on which
        the clients are being configured. Typically the relay has an IPv4
        address configured on that interface that belongs to the subnet from which
        the server will assign addresses. In the typical case, the
        server is able to use the IPv4 address inserted by the relay (in the giaddr
        field of the DHCPv4 packet) to select the appropriate subnet.
      </p><p>
        However, that is not always the case. In certain uncommon —
        valid — deployments, the relay address may not match the subnet. This
        usually means that there is more than one subnet allocated for a given
        link. The two most common examples where this is the case are long lasting
        network renumbering (where both old and new address space is still being
        used) and a cable network. In a cable network both cable modems and the
        devices behind them are physically connected to the same link, yet
        they use distinct addressing. In such a case, the DHCPv4 server needs
        additional information (the IPv4 address of the relay) to properly select
        an appropriate subnet.
      </p><p>
        The following example assumes that there is a subnet 192.0.2.0/24
        that is accessible via a relay that uses 10.0.0.1 as its IPv4 address.
        The server will be able to select this subnet for any incoming packets
        that came from a relay that has an address in 192.0.2.0/24 subnet.
        It will also select that subnet for a relay with address 10.0.0.1.
</p><pre class="screen">
"Dhcp4": {
    "subnet4": [
        {
            "subnet": "192.0.2.0/24",
            "pools": [ { "pool": "192.0.2.10 - 192.0.2.20" } ],
            <strong class="userinput"><code>"relay": {
                "ip-address": "10.0.0.1"
            }</code></strong>,
            ...
        }
    ],
    ...
}
</pre><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp4-srv-example-client-class-relay"></a>7.5.2. Segregating IPv4 Clients in a Cable Network</h3></div></div></div><p>
          In certain cases, it is useful to mix relay address information,
          introduced in <a class="xref" href="#dhcp4-relay-override" title="7.5.1. Using a Specific Relay Agent for a Subnet">Section 7.5.1, “Using a Specific Relay Agent for a Subnet”</a> with client
          classification, explained in <a class="xref" href="#classify" title="Chapter 12. Client Classification">Chapter 12, <i>Client Classification</i></a>.
          One specific example is cable network, where typically modems
          get addresses from a different subnet than all devices connected
          behind them.
        </p><p>
          Let's assume that there is one CMTS (Cable Modem Termination System)
          with one CM MAC (a physical link that modems are connected to).
          We want the modems to get addresses from the 10.1.1.0/24 subnet, while
          everything connected behind modems should get addresses from another
          subnet (192.0.2.0/24). The CMTS that acts as a relay uses address
          10.1.1.1. The following configuration can serve that configuration:
</p><pre class="screen">
"Dhcp4": {
    "subnet4": [
        {
            "subnet": "10.1.1.0/24",
            "pools":  [ { "pool": "10.1.1.2 - 10.1.1.20" } ],
            <strong class="userinput"><code>"client-class" "docsis3.0",
            "relay": {
                "ip-address": "10.1.1.1"
            }</code></strong>
        },
        {
            "subnet": "192.0.2.0/24",
            "pools": [ { "pool": "192.0.2.10 - 192.0.2.20" } ],
            <strong class="userinput"><code>"relay": {
                "ip-address": "10.1.1.1"
            }</code></strong>
        }
    ],
    ...
}
</pre><p>
      </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp4-decline"></a>7.6. Duplicate Addresses (DHCPDECLINE support)</h2></div></div></div><p>The DHCPv4 server is configured with a certain pool of addresses
      that it is expected to hand out to the DHCPv4 clients.  It is
      assumed that the server is authoritative and has complete jurisdiction
      over those addresses. However, due to various reasons, such as
      misconfiguration or a faulty client implementation that retains its
      address beyond the valid lifetime, there may be devices connected that use
      those addresses without the server's approval or knowledge.</p><p>Such an
      unwelcome event can be detected by legitimate clients (using ARP or ICMP
      Echo Request mechanisms) and reported to the DHCPv4 server using a DHCPDECLINE
      message. The server will do a sanity check (if the client declining an
      address really was supposed to use it), and then will conduct a clean up
      operation. Any DNS entries related to that address will be removed, the
      fact will be logged and hooks will be triggered. After that is done, the
      address will be marked as declined (which indicates that it is used by an
      unknown entity and thus not available for assignment to anyone) and a
      probation time will be set on it. Unless otherwise configured, the
      probation period lasts 24 hours. After that period, the server will
      recover the lease, i.e. put it back into the available state. The address will
      be available for assignment again. It should be noted that if the
      underlying issue of a misconfigured device is not resolved, the duplicate
      address scenario will repeat. On the other hand, it provides an
      opportunity to recover from such an event automatically, without any
      sysadmin intervention.</p><p>To configure the decline probation period to a value different
      than the default, the following syntax can be used:
</p><pre class="screen">
  "Dhcp4": {
    <strong class="userinput"><code>"decline-probation-period": 3600</code></strong>,
    "subnet4": [ ... ],
    ...
}
</pre><p>
      The parameter is expressed in seconds, so the example above will instruct
      the server to recycle declined leases after an hour.</p><p>There are several statistics and hook points associated with the
      Decline handling procedure. The lease4_decline hook is triggered after the
      incoming DHCPDECLINE message has been sanitized and the server is about to
      decline the lease. The declined-addresses statistic is increased after the
      hook returns (both global and subnet specific variants).</p><p>Once the probation time elapses, the declined lease is recovered
      using the standard expired lease reclamation procedure, with several
      additional steps. In particular, both declined-addresses statistics
      (global and subnet specific) are decreased. At the same time,
      reclaimed-declined-addresses statistics (again in two variants, global and
      subnet specific) are increased.</p><p>Note about statistics: The server does not decrease
      assigned-addresses statistics when a DHCPDECLINE is received and processed
      successfully. While technically a declined address is no longer assigned,
      the primary usage of the assigned-addresses statistic is to monitor pool
      utilization. Most people would forget to include declined-addresses in the
      calculation, and simply do assigned-addresses/total-addresses. This would
      have a bias towards under-representing pool utilization. As this has a
      potential for major issues, we decided not to decrease assigned addresses
      immediately after receiving DHCPDECLINE, but to do it later when we
      recover the address back to the available pool.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp4-stats"></a>7.7. Statistics in DHCPv4 server</h2></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This section describes DHCPv4-specific statistics. For a general
        overview and usage of statistics, see <a class="xref" href="#stats" title="Chapter 14. Statistics">Chapter 14, <i>Statistics</i></a>.</p></div><p>
        The DHCPv4 server supports the following statistics:
      </p><div class="table"><a name="dhcp4-statistics"></a><p class="title"><b>Table 7.5. DHCPv4 Statistics</b></p><div class="table-contents"><table summary="DHCPv4 Statistics" border="1"><colgroup><col align="center" class="statistic"><col align="center" class="type"><col align="left" class="description"></colgroup><thead><tr><th align="center">Statistic</th><th align="center">Data Type</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">pkt4-received</td><td align="center">integer</td><td align="left">
            Number of DHCPv4 packets received. This includes all packets: valid,
            bogus, corrupted, rejected etc.  This statistic is expected to grow
            rapidly.
            </td></tr><tr><td align="center">pkt4-discover-received</td><td align="center">integer</td><td align="left">
            Number of DHCPDISCOVER packets received. This statistic is expected to grow.
            Its increase means that clients that just booted started their configuration process
            and their initial packets reached your server.
            </td></tr><tr><td align="center">pkt4-offer-received</td><td align="center">integer</td><td align="left">
            Number of DHCPOFFER packets received. This statistic
            is expected to remain zero at all times, as DHCPOFFER packets are sent
            by the server and the server is never expected to receive them. Non-zero
            value indicates an error. One likely cause would be a misbehaving relay
            agent that incorrectly forwards DHCPOFFER messages towards the server,
            rather back to the clients.
            </td></tr><tr><td align="center">pkt4-request-received</td><td align="center">integer</td><td align="left">
            Number of DHCPREQUEST packets received. This statistic
            is expected to grow. Its increase means that clients that just booted
            received server's response (DHCPOFFER), accepted it and now requesting
            an address (DHCPREQUEST).
            </td></tr><tr><td align="center">pkt4-ack-received</td><td align="center">integer</td><td align="left">
            Number of DHCPACK packets received. This statistic
            is expected to remain zero at all times, as DHCPACK packets are sent
            by the server and the server is never expected to receive them. Non-zero
            value indicates an error. One likely cause would be a misbehaving relay
            agent that incorrectly forwards DHCPACK messages towards the server,
            rather back to the clients.
            </td></tr><tr><td align="center">pkt4-nak-received</td><td align="center">integer</td><td align="left">
            Number of DHCPNAK packets received. This statistic
            is expected to remain zero at all times, as DHCPNAK packets are sent
            by the server and the server is never expected to receive them. Non-zero
            value indicates an error. One likely cause would be a misbehaving relay
            agent that incorrectly forwards DHCPNAK messages towards the server,
            rather back to the clients.
            </td></tr><tr><td align="center">pkt4-release-received</td><td align="center">integer</td><td align="left">
            Number of DHCPRELEASE packets received. This statistic
            is expected to grow. Its increase means that clients that had an address
            are shutting down or stop using their addresses.
            </td></tr><tr><td align="center">pkt4-decline-received</td><td align="center">integer</td><td align="left">
            Number of DHCPDECLINE packets received. This statistic
            is expected to remain close to zero. Its increase means that a client
            that leased an address, but discovered that the address is currently
            used by an unknown device in your network.
            </td></tr><tr><td align="center">pkt4-inform-received</td><td align="center">integer</td><td align="left">
            Number of DHCPINFORM packets received. This statistic
            is expected to grow. Its increase means that there are clients that
            either do not need an address or already have an address and are
            interested only in getting additional configuration parameters.
            </td></tr><tr><td align="center">pkt4-unknown-received</td><td align="center">integer</td><td align="left">
            Number of packets received of an unknown type. Non-zero
            value of this statistic indicates that the server received a packet
            that it wasn't able to recognize: either with unsupported type
            or possibly malformed (without message type option).
            </td></tr><tr><td align="center">pkt4-sent</td><td align="center">integer</td><td align="left">
            Number of DHCPv4 packets sent. This statistic is expected to grow
            every time the server transmits a packet. In general, it should
            roughly match pkt4-received, as most incoming packets cause
            server to respond. There are exceptions (e.g. DHCPRELEASE), so
            do not worry, if it is lesser than pkt4-received.
            </td></tr><tr><td align="center">pkt4-offer-sent</td><td align="center">integer</td><td align="left">
            Number of DHCPOFFER packets sent. This statistic is expected to
            grow in most cases after a DHCPDISCOVER is processed. There are
            certain uncommon, but valid cases where incoming DHCPDISCOVER is
            dropped, but in general this statistic is expected to be close to
            pkt4-discover-received.
            </td></tr><tr><td align="center">pkt4-ack-sent</td><td align="center">integer</td><td align="left">
            Number of DHCPACK packets sent. This statistic is expected to
            grow in most cases after a DHCPREQUEST is processed. There are
            certain cases where DHCPNAK is sent instead. In general, the sum of
            pkt4-ack-sent and pkt4-nak-sent should be close to
            pkt4-request-received.
            </td></tr><tr><td align="center">pkt4-nak-sent</td><td align="center">integer</td><td align="left">
            Number of DHCPNAK packets sent. This statistic is expected to
            grow when the server choses to not honor the address requested by a
            client. In general, the sum of pkt4-ack-sent and pkt4-nak-sent
            should be close to pkt4-request-received.
            </td></tr><tr><td align="center">pkt4-parse-failed</td><td align="center">integer</td><td align="left">
            Number of incoming packets that could not be parsed.  Non-zero value of
            this statistic indicates that the server received malformed or truncated packet.
            This may indicate problems in your network, faulty clients or server code bug.
            </td></tr><tr><td align="center">pkt4-receive-drop</td><td align="center">integer</td><td align="left">
            Number of incoming packets that were dropped.
            Exact reason for dropping packets is logged, but the most common
            reasons may be: an unacceptable packet type, direct responses are
            forbidden, or the server-id sent by the client does not match
            the server's server-id.
            </td></tr><tr><td align="center">subnet[id].total-addresses</td><td align="center">integer</td><td align="left">The total number of addresses available for the DHCPv4
              management. In other words, this is the sum of all addresses in
              all configured pools. This statistic changes only during
              configuration changes. Note it does not take into account any
              addresses that may be reserved due to host reservation. The
              <span class="emphasis"><em>id</em></span> is the subnet-id of a given subnet. This
              statistic is exposed for each subnet separately. This statistic is
              reset during reconfiguration event.</td></tr><tr><td align="center">subnet[id].assigned-addresses</td><td align="center">integer</td><td align="left">This statistic shows the number of assigned addresses in a
              given subnet.  This statistic increases every time a new lease is
              allocated (as a result of receiving a DHCPREQUEST message) and is
              decreased every time a lease is released (a DHCPRELEASE message is
              received) or expires. The <span class="emphasis"><em>id</em></span> is the subnet-id
              of a given subnet. This statistic is exposed for each subnet
              separately. This statistic is reset during reconfiguration event.
              </td></tr><tr><td align="center">declined-addresses</td><td align="center">integer</td><td align="left">
              This statistic shows the number of IPv4 addresses that are
              currently declined. This statistic counts the number of leases
              currently unavailable. Once a lease is recovered, this
              statistic will be decreased. Ideally, this statistic should be
              zero. If this statistic is non-zero (or worse increasing),
              a network administrator should investigate if there is
              a misbehaving device in his network. This is a global statistic
              that covers all subnets.
            </td></tr><tr><td align="center">subnet[id].declined-addresses</td><td align="center">integer</td><td align="left">
              This statistic shows the number of IPv4 addresses that are
              currently declined in a given subnet. This statistic counts the
              number of leases currently unavailable. Once a lease is
              recovered, this statistic will be decreased. Ideally, this
              statistic should be zero. If this statistic is
              non-zero (or worse increasing), a network administrator should
              investigate if there is a misbehaving device in his network. The
              <span class="emphasis"><em>id</em></span> is the subnet-id of a given subnet. This
              statistic is exposed for each subnet separately.
            </td></tr><tr><td align="center">reclaimed-declined-addresses</td><td align="center">integer</td><td align="left">
              This statistic shows the number of IPv4 addresses that were
              declined, but have now been recovered. Unlike
              declined-addresses, this statistic never decreases. It can be used
              as a long term indicator of how many actual valid Declines were
              processed and recovered from. This is a global statistic that
              covers all subnets.
            </td></tr><tr><td align="center">subnet[id].reclaimed-declined-addresses</td><td align="center">integer</td><td align="left">
              This statistic shows the number of IPv4 addresses that were
              declined, but have now been recovered. Unlike
              declined-addresses, this statistic never decreases. It can be used
              as a long term indicator of how many actual valid Declines were
              processed and recovered from. The
              <span class="emphasis"><em>id</em></span> is the subnet-id of a given subnet. This
              statistic is exposed for each subnet separately.
            </td></tr></tbody></table></div></div><br class="table-break"></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp4-ctrl-channel"></a>7.8. Management API for the DHCPv4 server</h2></div></div></div><p>
        Management API has been introduced in Kea 0.9.2-beta. It allows issuing specific
        management commands, like statistics retrieval, reconfiguration or shutdown.
        For more details, see <a class="xref" href="#ctrl-channel" title="Chapter 15. Management API">Chapter 15, <i>Management API</i></a>. Currently the only
        supported communication channel type is UNIX stream socket. By default there
        are no sockets open. To instruct Kea to open a socket, the following entry
        in the configuration file can be used:
</p><pre class="screen">
"Dhcp4": {
    "control-socket": {
        "socket-type": "unix",
        "socket-name": <strong class="userinput"><code>"/path/to/the/unix/socket"</code></strong>
    },

    "subnet4": [
        ...
    ],
    ...
}
</pre><p>
      </p><p>
	The length of the path specified by the <span class="command"><strong>socket-name</strong></span>
	parameter is restricted by the maximum length for the unix socket name
	on your operating system, i.e. the size of the <span class="command"><strong>sun_path</strong></span>
	field in the <span class="command"><strong>sockaddr_un</strong></span> structure, decreased by 1.
	This value varies on different operating systems between 91 and 107
	characters. The typical values are 107 on Linux and 103 on FreeBSD.
      </p><p>
        Communication over control channel is conducted using JSON structures.
        See the Control Channel section in the Kea Developer's Guide for more details.
      </p><p>DHCPv4 server supports <span class="command"><strong>statistic-get</strong></span>,
      <span class="command"><strong>statistic-reset</strong></span>, <span class="command"><strong>statistic-remove</strong></span>,
      <span class="command"><strong>statistic-get-all</strong></span>, <span class="command"><strong>statistic-reset-all</strong></span>
      and <span class="command"><strong>statistic-remove-all</strong></span>, specified in
      <a class="xref" href="#command-stats" title="14.3. Commands for Manipulating Statistics">Section 14.3, “Commands for Manipulating Statistics”</a>. It also supports
      <span class="command"><strong>list-commands</strong></span> and <span class="command"><strong>shutdown</strong></span>,
      specified in <a class="xref" href="#command-list-commands" title="15.3.2. list-commands command">Section 15.3.2, “list-commands command”</a> and
      <a class="xref" href="#command-shutdown" title="15.3.3. shutdown command">Section 15.3.3, “shutdown command”</a>, respectively.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp4-std"></a>7.9. Supported DHCP Standards</h2></div></div></div><p>The following standards are currently supported:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="emphasis"><em>Dynamic Host Configuration Protocol</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc2131" target="_top">RFC 2131</a>:
            Supported messages are DHCPDISCOVER (1), DHCPOFFER (2),
            DHCPREQUEST (3), DHCPRELEASE (7), DHCPINFORM (8), DHCPACK (5), and
            DHCPNAK(6).</li><li class="listitem"><span class="emphasis"><em>DHCP Options and BOOTP Vendor Extensions</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc2132" target="_top">RFC 2132</a>:
            Supported options are: PAD (0),
            END(255), Message Type(53), DHCP Server Identifier (54),
            Domain Name (15), DNS Servers (6), IP Address Lease Time
            (51), Subnet mask (1), and Routers (3).</li><li class="listitem"><span class="emphasis"><em>DHCP Relay Agent Information Option</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc3046" target="_top">RFC 3046</a>:
            Relay Agent Information option is supported.</li><li class="listitem"><span class="emphasis"><em>Vendor-Identifying Vendor Options for
            Dynamic Host Configuration Protocol version 4</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc3925" target="_top">RFC 3925</a>:
            Vendor-Identifying Vendor Class and Vendor-Identifying Vendor-Specific
            Information options are supported.</li><li class="listitem"><span class="emphasis"><em>Client Identifier Option in DHCP Server Replies</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc6842" target="_top">RFC 6842</a>:
            Server by default sends back client-id option. That capability may be
            disabled. See <a class="xref" href="#dhcp4-echo-client-id" title="7.2.17. Echoing Client-ID (RFC 6842)">Section 7.2.17, “Echoing Client-ID (RFC 6842)”</a> for details.
            </li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp4-limit"></a>7.10. DHCPv4 Server Limitations</h2></div></div></div><p>These are the current limitations of the DHCPv4 server
      software. Most of them are reflections of the current stage of
      development and should be treated as <span class="quote"><span class="quote">not implemented
      yet</span></span>, rather than actual limitations. However, some of them
      are implications of the design choices made. Those are clearly
      marked as such.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
              Removal of a subnet during server reconfiguration may cause renumbering
              of auto-generated subnet identifiers, as described in section
              <a class="xref" href="#ipv4-subnet-id" title="7.2.6. IPv4 Subnet Identifier">Section 7.2.6, “IPv4 Subnet Identifier”</a>.
            </li><li class="listitem">Host reservation (static addresses) is not supported yet.</li><li class="listitem">Full featured client classification is not supported yet.</li><li class="listitem">
              BOOTP (<a class="ulink" href="http://tools.ietf.org/html/rfc951" target="_top">RFC 951</a>)
              is not supported. This is a design choice. BOOTP support is not planned.
            </li><li class="listitem">On Linux and BSD system families the DHCP messages are sent
            and received over the raw sockets (using LPF and BPF) and all packet
            headers (including data link layer, IP and UDP headers) are created and
            parsed by Kea, rather than the system kernel. Currently, Kea can
            only parse the data link layer headers with a format adhering to
            IEEE 802.3 standard and assumes this data link layer header format
            for all interfaces. Hence, Kea will fail to work on interfaces
            which use different data link layer header formats (e.g. Infiniband).
            </li><li class="listitem">The DHCPv4 server does not  verify that
            assigned address is unused. According to <a class="ulink" href="http://tools.ietf.org/html/rfc2131" target="_top">RFC 2131</a>, the
            allocating server should verify that address is not used by
            sending ICMP echo request.</li><li class="listitem">Address duplication report (DECLINE) is not supported yet.</li></ul></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="dhcp6"></a>Chapter 8. The DHCPv6 Server</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#dhcp6-start-stop">8.1. Starting and Stopping the DHCPv6 Server</a></span></dt><dt><span class="section"><a href="#dhcp6-configuration">8.2. DHCPv6 Server Configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#idp50920624">8.2.1. Introduction</a></span></dt><dt><span class="section"><a href="#idp55550160">8.2.2. Lease Storage</a></span></dt><dt><span class="section"><a href="#dhcp6-interface-selection">8.2.3. Interface selection</a></span></dt><dt><span class="section"><a href="#ipv6-subnet-id">8.2.4. IPv6 Subnet Identifier</a></span></dt><dt><span class="section"><a href="#dhcp6-unicast">8.2.5. Unicast traffic support</a></span></dt><dt><span class="section"><a href="#dhcp6-address-config">8.2.6. Subnet and Address Pool</a></span></dt><dt><span class="section"><a href="#idp55239488">8.2.7. Subnet and Prefix Delegation Pools</a></span></dt><dt><span class="section"><a href="#dhcp6-std-options">8.2.8. Standard DHCPv6 options</a></span></dt><dt><span class="section"><a href="#dhcp6-custom-options">8.2.9. Custom DHCPv6 options</a></span></dt><dt><span class="section"><a href="#dhcp6-vendor-opts">8.2.10. DHCPv6 vendor specific options</a></span></dt><dt><span class="section"><a href="#dhcp6-option-spaces">8.2.11. Nested DHCPv6 options (custom option spaces)</a></span></dt><dt><span class="section"><a href="#dhcp6-option-data-defaults">8.2.12. Unspecified parameters for DHCPv6 option configuration</a></span></dt><dt><span class="section"><a href="#dhcp6-config-subnets">8.2.13. IPv6 Subnet Selection</a></span></dt><dt><span class="section"><a href="#dhcp6-rapid-commit">8.2.14. Rapid Commit</a></span></dt><dt><span class="section"><a href="#dhcp6-relays">8.2.15. DHCPv6 Relays</a></span></dt><dt><span class="section"><a href="#dhcp6-rsoo">8.2.16. Relay-Supplied Options</a></span></dt><dt><span class="section"><a href="#dhcp6-client-classifier">8.2.17. Client Classification in DHCPv6</a></span></dt><dt><span class="section"><a href="#dhcp6-ddns-config">8.2.18. Configuring DHCPv6 for DDNS</a></span></dt></dl></dd><dt><span class="section"><a href="#host-reservation-v6">8.3. Host reservation in DHCPv6</a></span></dt><dd><dl><dt><span class="section"><a href="#reservation6-types">8.3.1. Address/prefix reservation types</a></span></dt><dt><span class="section"><a href="#reservation6-conflict">8.3.2. Conflicts in DHCPv6 reservations</a></span></dt><dt><span class="section"><a href="#reservation6-hostname">8.3.3. Reserving a hostname</a></span></dt><dt><span class="section"><a href="#reservation6-options">8.3.4. Reserving specific options</a></span></dt><dt><span class="section"><a href="#reservation6-mode">8.3.5. Fine Tuning IPv6 Host Reservation</a></span></dt></dl></dd><dt><span class="section"><a href="#dhcp6-serverid">8.4. Server Identifier in DHCPv6</a></span></dt><dt><span class="section"><a href="#stateless-dhcp6">8.5. Stateless DHCPv6 (Information-Request Message)</a></span></dt><dt><span class="section"><a href="#dhcp6-rfc7550">8.6. Support for RFC 7550</a></span></dt><dt><span class="section"><a href="#dhcp6-relay-override">8.7. Using specific relay agent for a subnet</a></span></dt><dt><span class="section"><a href="#dhcp6-client-class-relay">8.8. Segregating IPv6 clients in a cable network</a></span></dt><dt><span class="section"><a href="#mac-in-dhcpv6">8.9. MAC/Hardware addresses in DHCPv6</a></span></dt><dt><span class="section"><a href="#dhcp6-decline">8.10. Duplicate Addresses (DECLINE support)</a></span></dt><dt><span class="section"><a href="#dhcp6-stats">8.11. Statistics in DHCPv6 server</a></span></dt><dt><span class="section"><a href="#dhcp6-ctrl-channel">8.12. Management API for the DHCPv6 server</a></span></dt><dt><span class="section"><a href="#dhcp6-std">8.13. Supported DHCPv6 Standards</a></span></dt><dt><span class="section"><a href="#dhcp6-limit">8.14. DHCPv6 Server Limitations</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp6-start-stop"></a>8.1. Starting and Stopping the DHCPv6 Server</h2></div></div></div><p>
      It is recommended that the Kea DHCPv6 server be started and stopped
      using <span class="command"><strong>keactrl</strong></span> (described in <a class="xref" href="#keactrl" title="Chapter 6. Managing Kea with keactrl">Chapter 6, <i>Managing Kea with keactrl</i></a>).
      However, it is also possible to run the server directly: it accepts
      the following command-line switches:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
            <span class="command"><strong>-c <em class="replaceable"><code>file</code></em></strong></span> -
            specifies the configuration file. This is the only mandatory
            switch.</li><li class="listitem">
            <span class="command"><strong>-d</strong></span> - specifies whether the server
            logging should be switched to verbose mode. In verbose mode,
            the logging severity and debuglevel specified in the configuration
            file are ignored and "debug" severity and the maximum debuglevel
            (99) are assumed. The flag is convenient, for temporarily
            switching the server into maximum verbosity, e.g. when
            debugging.</li><li class="listitem">
            <span class="command"><strong>-p <em class="replaceable"><code>port</code></em></strong></span> -
            specifies UDP port on which the server will listen. This is only
            useful during testing, as a DHCPv6 server listening on
            ports other than default DHCPv6 ports will not be able to
            handle regular DHCPv6 queries.</li><li class="listitem">
              <span class="command"><strong>-v</strong></span> - prints out Kea version and exits.
            </li><li class="listitem">
              <span class="command"><strong>-V</strong></span> - prints out Kea extended version with
              additional parameters and exits.
            </li><li class="listitem">
              <span class="command"><strong>-W</strong></span> - prints out Kea configuration report
              and exits.
            </li></ul></div><p>
            The <span class="command"><strong>-V</strong></span> command returns the versions of the
            external libraries dynamically linked.
      </p><p>
            The <span class="command"><strong>-W</strong></span> command describes the environment used
            to build Kea.  This command displays a copy of the
            <code class="filename">config.report</code> file produced by
            <strong class="userinput"><code>./configure</code></strong> that is embedded in the
            executable binary.
      </p><p>
            The <code class="filename">config.report</code> may also be accessed more
            directly.  The following command may be used to extract this
            information.  The binary <strong class="userinput"><code>path</code></strong> may be found
            in the install directory or in the <code class="filename">.libs</code>
            subdirectory in the source tree. For example
            <code class="filename">kea/src/bin/dhcp6/.libs/kea-dhcp6</code>.

</p><pre class="screen">
strings <strong class="userinput"><code>path</code></strong>/kea-dhcp6 | sed -n 's/;;;; //p'
</pre><p>
      </p><p>
            When running in a console, the server can be shut down by
            pressing ctrl-c. It detects the key combination and shuts
            down gracefully.
      </p><p>
        On start-up, the server will detect available network interfaces
        and will attempt to open UDP sockets on all interfaces
        mentioned in the configuration file.
      </p><p>
        Since the DHCPv6 server opens privileged ports, it requires root
        access. Make sure you run this daemon as root.
      </p><p>
        During startup the server will attempt to create a PID file of the
        form: [localstatedir]/[conf name].kea-dhcp6.pid
        where:
        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="command"><strong>localstatedir</strong></span>: The value as passed into the
            build configure script. It defaults to "/usr/local/var".  Note
            that this value may be overridden at run time by setting the environment
            variable KEA_PIDFILE_DIR.  This is intended primarily for testing purposes.
            </li><li class="listitem"><span class="command"><strong>conf name</strong></span>: The configuration file name
            used to start the server, minus all preceding path and file extension.
            For example, given a pathname of "/usr/local/etc/kea/myconf.txt", the
            portion used would be "myconf".
            </li></ul></div><p>
        If the file already exists and contains the PID of a live process,
        the server will issue a DHCP6_ALREADY_RUNNING log message and exit. It
        is possible, though unlikely, that the file is a remnant of a system crash
        and the process to which the PID belongs is unrelated to Kea.  In such a
        case it would be necessary to manually delete the PID file.
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp6-configuration"></a>8.2. DHCPv6 Server Configuration</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp50920624"></a>8.2.1. Introduction</h3></div></div></div><p>
        This section explains how to configure the DHCPv6 server using the
        Kea configuration backend. (Kea configuration using any other
        backends is outside of scope of this document.) Before DHCPv6
        is started, its configuration file has to be created. The
        basic configuration looks as follows:
</p><pre class="screen">
{
# DHCPv6 configuration starts on the next line
"Dhcp6": {

# First we set up global values
    "renew-timer": 1000,
    "rebind-timer": 2000,
    "preferred-lifetime": 3000,
    "valid-lifetime": 4000,

# Next we setup the interfaces to be used by the server.
    "interfaces-config": {
        "interfaces": [ "eth0" ]
    },

# And we specify the type of a lease database
    "lease-database": {
        "type": "memfile",
        "persist": true,
        "name": "/var/kea/dhcp6.leases"
    },

# Finally, we list the subnets from which we will be leasing addresses.
    "subnet6": [
        {
            "subnet": "2001:db8:1::/64",
            "pools": [
                 {
                     "pool": "2001:db8:1::1-2001:db8:1::ffff"
                 }
             ]
        }
    ]
# DHCPv6 configuration ends with the next line
}

} </pre><p>
</p><p>The following paragraphs provide a brief overview of the parameters in
the above example and
their format. Subsequent sections of this chapter go into much greater detail
for these and other parameters.</p><p>The lines starting with a hash (#) are comments and are ignored by
the server; they do not impact its
operation in any way.</p><p>The configuration starts in the first line with the initial
opening curly bracket (or brace). Each configuration consists of
one or more objects. In this specific example, we have only one
object called Dhcp6. This is a simplified configuration, as usually
there will be additional objects, like <span class="command"><strong>Logging</strong></span> or
<span class="command"><strong>DhcpDns</strong></span>, but we omit them now for clarity. The Dhcp6
configuration starts with the <span class="command"><strong>"Dhcp6": {</strong></span> line
and ends with the corresponding closing brace (in the above example,
the brace after the last comment).  Everything defined between those
lines is considered to be the Dhcp6 configuration.</p><p>In the general case, the order in which those parameters appear does not
matter. There are two caveats here though. The first one is to remember that
the configuration file must be well formed JSON. That means that parameters
for any given scope must be separated by a comma and there must not be a comma
after the last parameter. When reordering a configuration file, keep in mind that
moving a parameter to or from the last position in a given scope may require
moving the comma as well. The second caveat is that it is uncommon — although
legal JSON — to
repeat the same parameter multiple times. If that happens, the last occurrence of a
given parameter in a given scope is used while all previous instances are
ignored. This is unlikely to cause any confusion as there are no real life
reasons to keep multiple copies of the same parameter in your configuration
file.</p><p>Moving onto the DHCPv6 configuration elements, the very first few elements
define some global parameters. <span class="command"><strong>valid-lifetime</strong></span>
defines for how long the addresses (leases) given out by the server are valid. If
nothing changes, a client that got an address is allowed to use it for 4000
seconds. (Note that integer numbers are specified as is, without any quotes
around them.) The address will become deprecated in 3000 seconds (clients are
allowed to keep old connections, but can't use this address for creating new
connections). <span class="command"><strong>renew-timer</strong></span> and <span class="command"><strong>
rebind-timer</strong></span> are values that define T1 and T2 timers that govern when
the client will begin the renewal and rebind procedures.</p><p>The <span class="command"><strong>interfaces-config</strong></span> map specifies the server
configuration concerning the network interfaces, on which the server should
listen to the DHCP messages. The <span class="command"><strong>interfaces</strong></span> parameter
specifies a list of network interfaces on which the server should listen.
Lists are opened and closed with square brackets, with elements separated
by commas. Had we wanted to listen on two interfaces, the
<span class="command"><strong>interfaces-config</strong></span> would look like this:
</p><pre class="screen">
"interfaces-config": {
    "interfaces": [ "eth0", "eth1" ]
},
</pre><p>
</p><p>The next couple of lines define the lease database, the place where the server
stores its lease information. This particular example tells the server to use
<span class="command"><strong>memfile</strong></span>, which is the simplest (and fastest) database
backend. It uses an in-memory database and stores leases on disk in a CSV
file. This is a very simple configuration. Usually, lease database configuration
is more extensive and contains additional parameters.  Note that
<span class="command"><strong>lease-database</strong></span>
is an object and opens up a new scope, using an opening brace.
Its parameters (just one in this example -- <span class="command"><strong>type</strong></span>)
follow. Had there been more than one, they would be separated by commas. This
scope is closed with a closing brace. As more parameters follow, a trailing
comma is present.</p><p>Finally, we need to define a list of IPv6 subnets. This is the
most important DHCPv6 configuration structure as the server uses that
information to process clients' requests. It defines all subnets from
which the server is expected to receive DHCP requests. The subnets are
specified with the <span class="command"><strong>subnet6</strong></span> parameter.  It is a list,
so it starts and ends with square brackets.  Each subnet definition in
the list has several attributes associated with it, so it is a structure
and is opened and closed with braces. At minimum, a subnet definition
has to have at least two parameters: <span class="command"><strong>subnet</strong></span> (that
defines the whole subnet) and <span class="command"><strong>pool</strong></span> (which is a list of
dynamically allocated pools that are governed by the DHCP server).</p><p>The example contains a single subnet. Had more than one been defined,
additional elements
in the <span class="command"><strong>subnet6</strong></span> parameter would be specified and
separated by commas. For example, to define two subnets, the following
syntax would be used:
</p><pre class="screen">
"subnet6": [
    {
        "pools": [
        {
            "pool": "2001:db8:1::/112"
        }
        ],
        "subnet": "2001:db8:1::/64"
    },
    {
        "pools": [ { "pool": "2001:db8:2::1-2001:db8:2::ffff" } ],
        "subnet": "2001:db8:2::/64",
        "interface": "eth0"
    }
]
</pre><p>
Note that indentation is optional and is used for aesthetic purposes only.
In some cases in may be preferable to use more compact notation.
</p><p>After all parameters are specified, we have two contexts open:
global and Dhcp6, hence we need two closing curly brackets to close them.
In a real life configuration file there most likely would be additional
components defined such as Logging or DhcpDdns, so the closing brace would
be followed by a comma and another object definition.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp55550160"></a>8.2.2. Lease Storage</h3></div></div></div><p>All leases issued by the server are stored in the lease database.
  Currently there are three database backends available:
  memfile (which is the default backend), MySQL and PostgreSQL.</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="idp55551520"></a>8.2.2.1. Memfile, Basic Storage for Leases</h4></div></div></div><p>The server is able to store lease data in different repositories. Larger
  deployments may elect to store leases in a database. <a class="xref" href="#database-configuration6" title="8.2.2.2. Lease Database Configuration">Section 8.2.2.2, “Lease Database Configuration”</a> describes this option. In typical
  smaller deployments though, the server will use a CSV file rather than a database to
  store lease information. As well as requiring less administration, an
  advantage of using a file for storage is that it
  eliminates a dependency on third-party database software.</p><p>The configuration of the file backend (Memfile) is controlled through
  the Dhcp6/lease-database parameters. The <span class="command"><strong>type</strong></span> parameter
  is mandatory and it specifies which storage for leases the server should use.
  The value of <strong class="userinput"><code>"memfile"</code></strong> indicates that the file should
  be used as the storage. The following list presents the remaining, not mandatory
  parameters, which can be used to configure the Memfile backend.

  </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="command"><strong>persist</strong></span>: controls whether the new leases and
      updates to existing leases are written to the file. It is strongly
      recommended that the value of this parameter is set to
      <strong class="userinput"><code>true</code></strong> at all times, during the server's normal
      operation. Not writing leases to disk will mean that if a server is restarted
      (e.g. after a power failure), it will not know what addresses have been
      assigned.  As a result, it may hand out addresses to new clients that are
      already in use. The value of <strong class="userinput"><code>false</code></strong> is mostly useful
      for performance testing purposes. The default value of the
      <span class="command"><strong>persist</strong></span> parameter is <strong class="userinput"><code>true</code></strong>,
      which enables writing lease updates
      to the lease file.
      </li><li class="listitem"><span class="command"><strong>name</strong></span>: specifies an absolute location of the lease
      file in which new leases and lease updates will be recorded. The default value
      for this parameter is <strong class="userinput"><code>"[kea-install-dir]/var/kea/kea-leases6.csv"
      </code></strong>.</li><li class="listitem"><span class="command"><strong>lfc-interval</strong></span>: specifies the interval in seconds, at
      which the server (Memfile backend) will perform a lease file cleanup (LFC),
      which removes the redundant (historical) information from the lease file
      and effectively reduces the lease file size. The cleanup process is described
      in more detailed fashion further in this section. The default value of the
      <span class="command"><strong>lfc-interval</strong></span> is <strong class="userinput"><code>0</code></strong>, which disables
      the LFC.</li></ul></div><p>
  </p><p>The example configuration of the Memfile backend is presented below:

</p><pre class="screen">
"Dhcp6": {
    "lease-database": {
        <strong class="userinput"><code>"type": "memfile"</code></strong>,
        <strong class="userinput"><code>"persist": true</code></strong>,
        <strong class="userinput"><code>"name": "/tmp/kea-leases6.csv"</code></strong>,
        <strong class="userinput"><code>"lfc-interval": 1800</code></strong>
    }
}
</pre><p>
  </p><p>It is important to know how the lease file contents are organized
  to understand why the periodic lease file cleanup is needed. Every time when
  the server updates a lease or creates a new lease for the client, the new
  lease information must be recorded in the lease file. For performance reasons,
  the server does not supersede the existing client's lease, as it would require
  the lookup of the specific lease entry, but simply appends the new lease
  information at the end of the lease file. The previous lease entries for the
  client are not removed. When the server loads leases from the lease file, e.g.
  at the server startup, it assumes that the latest lease entry for the client
  is the valid one. The previous entries are discarded. This means that the
  server can re-construct the accurate information about the leases even though
  there may be many lease entries for each client. However, storing many entries
  for each client results in bloated lease file and impairs the performance of
  the server's startup and reconfiguration, as it needs to process larger number
  of lease entries.
  </p><p>The lease file cleanup removes all previous entries for each client and
  leaves only the latest ones. The interval at which the cleanup is performed
  is configurable, and it should be selected according to the frequency of lease
  renewals initiated by the clients. The more frequent renewals are, the lesser
  value of the <span class="command"><strong>lfc-interval</strong></span> should be. Note however, that the
  LFC takes time and thus it is possible (although unlikely) that new cleanup
  is started while the previous cleanup instance is still running, if the
  <span class="command"><strong>lfc-interval</strong></span> is too short. The server would recover from
  this by skipping the new cleanup when it detects that the previous cleanup
  is still in progress. But, this implies that the actual cleanups will be
  triggered more rarely than configured. Moreover, triggering a new cleanup
  adds an overhead to the server, which will not be able to respond to new
  requests for a short period of time when the new cleanup process is spawned.
  Therefore, it is recommended that the <span class="command"><strong>lfc-interval</strong></span> value
  is selected in a way that would allow for completing the cleanup before the
  new cleanup is triggered.
  </p><p>The LFC is performed by a separate process (in background) to avoid
  performance impact on the server process. In order to avoid the conflicts
  between the two processes both using the same lease files, the LFC process
  operates on the copy of the original lease file, rather than on the lease
  file used by the server to record lease updates. There are also other files
  being created as a side effect of the lease file cleanup. The detailed
  description of the LFC is located on the Kea wiki:
  <a class="ulink" href="http://kea.isc.org/wiki/LFCDesign" target="_top">http://kea.isc.org/wiki/LFCDesign</a>.
  </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="database-configuration6"></a>8.2.2.2. Lease Database Configuration</h4></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>Lease database access information must be configured for the DHCPv6 server,
    even if it has already been configured for the DHCPv4 server.  The servers
    store their information independently, so each server can use a separate
    database or both servers can use the same database.</p></div><p>Lease database configuration is controlled through the
  Dhcp6/lease-database parameters. The type of the database must be set to
  "memfile", "mysql" or "postgresql", e.g.
</p><pre class="screen">
"Dhcp6": { "lease-database": { <strong class="userinput"><code>"type": "mysql"</code></strong>, ... }, ... }
</pre><p>
  Next, the name of the database is to hold the leases must be set: this is the
  name used when the lease database was created (see <a class="xref" href="#mysql-database-create" title="4.3.2.1. First Time Creation of Kea Database">Section 4.3.2.1, “First Time Creation of Kea Database”</a>
  or <a class="xref" href="#pgsql-database-create" title="4.3.3.1. Manually Create the PostgreSQL Database and the Kea User">Section 4.3.3.1, “Manually Create the PostgreSQL Database and the Kea User”</a>).
</p><pre class="screen">
"Dhcp6": { "lease-database": { <strong class="userinput"><code>"name": "<em class="replaceable"><code>database-name</code></em>" </code></strong>, ... }, ... }
</pre><p>
  If the database is located on a different system than the DHCPv6 server, the
  database host name must also be specified (although it should be noted that this
  configuration may have a severe impact on server performance):
</p><pre class="screen">
"Dhcp6": { "lease-database": { <strong class="userinput"><code>"host": <em class="replaceable"><code>remote-host-name</code></em></code></strong>, ... }, ... }
</pre><p>
  The usual state of affairs will be to have the database on the same machine as
  the DHCPv6 server.  In this case, set the value to the empty string:
</p><pre class="screen">
"Dhcp6": { "lease-database": { <strong class="userinput"><code>"host" : ""</code></strong>, ... }, ... }
</pre><p>
  </p><p>Finally, the credentials of the account under which the server will
  access the database should be set:
</p><pre class="screen">
"Dhcp6": { "lease-database": { <strong class="userinput"><code>"user": "<em class="replaceable"><code>user-name</code></em>"</code></strong>,
                               <strong class="userinput"><code>"password": "<em class="replaceable"><code>password</code></em>"</code></strong>,
                              ... },
           ... }
</pre><p>
  If there is no password to the account, set the password to the empty string
  "". (This is also the default.)</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-interface-selection"></a>8.2.3. Interface selection</h3></div></div></div><p>The DHCPv6 server has to be configured to listen on specific network
  interfaces.  The simplest network interface configuration instructs the server to
  listen on all available interfaces:
  </p><pre class="screen">
"Dhcp6": {
    "interfaces-config": {
        "interfaces": [ <strong class="userinput"><code>"*"</code></strong> ]
    }
    ...
}
</pre><p>
  The asterisk plays the role of a wildcard and means "listen on all interfaces".
  However, it is usually a good idea to explicitly specify interface names:
  </p><pre class="screen">
"Dhcp6": {
    "interfaces-config": {
        "interfaces": [ <strong class="userinput"><code>"eth1", "eth3"</code></strong> ]
    },
    ...
}
  </pre><p>
</p><p>It is possible to use wildcard interface name (asterisk) concurrently
  with the actual interface names:
  </p><pre class="screen">
"Dhcp6": {
    "interfaces-config": {
        "interfaces": [ <strong class="userinput"><code>"eth1", "eth3", "*"</code></strong> ]
    },
    ...
}
  </pre><p>
It is anticipated that this will form of usage only be used where it is desired to
temporarily override a list of interface names and listen on all interfaces.
  </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="ipv6-subnet-id"></a>8.2.4. IPv6 Subnet Identifier</h3></div></div></div><p>
        The subnet identifier is a unique number associated with a particular subnet.
        In principle, it is used to associate clients' leases with respective subnets.
        When the subnet identifier is not specified for a subnet being configured, it will
        be automatically assigned by the configuration mechanism. The identifiers
        are assigned from 1 and are monotonically increased for each subsequent
        subnet: 1, 2, 3 ....
      </p><p>
       If there are multiple subnets configured with auto-generated identifiers and
       one of them is removed, the subnet identifiers may be renumbered. For example:
       if there are four subnets and the third is removed the last subnet will be assigned
       the identifier that the third subnet had before removal. As a result, the leases
       stored in the lease database for subnet 3 are now associated with
       subnet 4, which may have unexpected consequences. In the future it is planned
       to implement a mechanism to preserve auto-generated subnet ids upon removal
       of one of the subnets. Currently, the only remedy for this issue is to
       manually specify a unique subnet identifier for each subnet.
      </p><p>
        The following configuration will assign the specified subnet
        identifier to the newly configured subnet:

        </p><pre class="screen">
"Dhcp6": {
    "subnet6": [
        {
            "subnet": "2001:db8:1::/64",
            <strong class="userinput"><code>"id": 1024</code></strong>,
            ...
        }
    ]
}
</pre><p>
        This identifier will not change for this subnet unless the "id" parameter is
        removed or set to 0. The value of 0 forces auto-generation of the subnet
        identifier.
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-unicast"></a>8.2.5. Unicast traffic support</h3></div></div></div><p>
        When the DHCPv6 server starts, by default it listens to the DHCP traffic
        sent to multicast address ff02::1:2 on each interface that it is
        configured to listen on (see <a class="xref" href="#dhcp6-interface-selection" title="8.2.3. Interface selection">Section 8.2.3, “Interface selection”</a>).
        In some cases it is useful to configure a server to handle incoming
        traffic sent to the global unicast addresses as well. The most common
        reason for that is to have relays send their traffic to the server
        directly. To configure the server to listen on a specific unicast address, the
        notation to specify interfaces has been extended.  An interface name can be
        optionally followed by a slash, followed by the global unicast address on which
        the server should listen. This will be done in addition to normal
        link-local binding + listening on ff02::1:2 address. The sample configuration
        below shows how to listen on 2001:db8::1 (a global address)
        configured on the eth1 interface.
      </p><p>
 </p><pre class="screen">
"Dhcp6": {
    "interfaces-config": {
        "interfaces": [ <strong class="userinput"><code>"eth1/2001:db8::1"</code></strong> ]
    },
    ...
}
 </pre><p>

        This configuration will cause the server to listen on
        eth1 on link-local address, multicast group (ff02::1:2) and 2001:db8::1.
      </p><p>
        It is possible to mix interface names, wildcards and interface name/addresses
        on the list of interfaces. It is not possible to specify more than one
        unicast address on a given interface.
      </p><p>
        Care should be taken to specify proper unicast addresses. The server will
        attempt to bind to those addresses specified, without any additional checks.
        This approach is selected on purpose, so the software can be used to
        communicate over uncommon addresses if the administrator so desires.
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-address-config"></a>8.2.6. Subnet and Address Pool</h3></div></div></div><p>
        The essential role of a DHCPv6 server is address assignment. For this,
        the server has to be configured with at least one subnet and one pool of dynamic
        addresses to be managed. For example, assume that the server
        is connected to a network segment that uses the 2001:db8:1::/64
        prefix. The Administrator of that network has decided that addresses from range
        2001:db8:1::1 to 2001:db8:1::ffff are going to be managed by the Dhcp6
        server. Such a configuration can be achieved in the following way:
        </p><pre class="screen">
"Dhcp6": {
    <strong class="userinput"><code>"subnet6": [
       {
           "subnet": "2001:db8:1::/64",
           "pools": [
               {
                   "pool": "2001:db8:1::1-2001:db8:1::ffff"
               }
           ],
           ...
       }
    ]</code></strong>
}</pre><p>

        Note that subnet is defined as a simple string, but the pool parameter
        is actually a list of pools: for this reason, the pool definition is
        enclosed in square brackets, even though only one range of addresses
        is specified.</p><p>Each <span class="command"><strong>pool</strong></span> is a structure that contains the
        parameters that describe a single pool. Currently there is only one
        parameter, <span class="command"><strong>pool</strong></span>, which gives the range of addresses
        in the pool. Additional parameters will be added in future releases of
        Kea.</p><p>It is possible to define more than one pool in a
        subnet: continuing the previous example, further assume that
        2001:db8:1:0:5::/80 should also be managed by the server. It could be written as
        2001:db8:1:0:5:: to 2001:db8:1::5:ffff:ffff:ffff, but typing so many 'f's
        is cumbersome. It can be expressed more simply as 2001:db8:1:0:5::/80. Both
        formats are supported by Dhcp6 and can be mixed in the pool list.
        For example, one could define the following pools:
        </p><pre class="screen">
"Dhcp6": {
    <strong class="userinput"><code>"subnet6": [
    {
        "subnet": "2001:db8:1::/64",
        "pools": [
            { "pool": "2001:db8:1::1-2001:db8:1::ffff" },
            { "pool": "2001:db8:1:05::/80" }
        ]</code></strong>,
        ...
    }
    ]
}</pre><p>
        The number of pools is not limited, but for performance reasons it is recommended to
        use as few as possible.
      </p><p>
         The server may be configured to serve more than one subnet. To add a second subnet,
         use a command similar to the following:
        </p><pre class="screen">
"Dhcp6": {
    <strong class="userinput"><code>"subnet6": [
    {
        "subnet": "2001:db8:1::/64",
        "pools": [
            { "pool": "2001:db8:1::1-2001:db8:1::ffff" }
        ]
    },
    {
        "subnet": "2001:db8:2::/64",
        "pools": [
            { "pool": "2001:db8:2::/64" }
        ]
    },
</code></strong>
        ...
    ]
}</pre><p>
        In this example, we allow the server to
        dynamically assign all addresses available in the whole subnet. Although
        rather wasteful, it is certainly a valid configuration to dedicate the
        whole /64 subnet for that purpose. Note that the Kea server does not preallocate
        the leases, so there is no danger in using gigantic address pools.
      </p><p>
        When configuring a DHCPv6 server using prefix/length notation, please pay
        attention to the boundary values. When specifying that the server can use
        a given pool, it will also be able to allocate the first (typically network
        address) address from that pool. For example for pool 2001:db8:2::/64 the
        2001:db8:2:: address may be assigned as well. If you want to avoid this,
        use the "min-max" notation.
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp55239488"></a>8.2.7. Subnet and Prefix Delegation Pools</h3></div></div></div><p>
        Subnets may also be configured to delegate prefixes, as defined in
            <a class="ulink" href="http://tools.ietf.org/html/rfc3633" target="_top">RFC 3633</a>.
        A subnet may have one or more prefix delegation pools.  Each pool has
        a prefixed address, which is specified as a prefix and a prefix length,
        as well as a delegated prefix length. <span class="command"><strong>delegated-len</strong></span>
            must not be shorter (that is it must be numerically greater or equal)
            than <span class="command"><strong>prefix-len</strong></span>.
            If both <span class="command"><strong>delegated-len</strong></span>
            and <span class="command"><strong>prefix-len</strong></span> are equal, the server will be able to
            delegate only one prefix. The delegated <span class="command"><strong>prefix</strong></span> does
        not have to match the <span class="command"><strong>subnet</strong></span> prefix.
      </p><p> Below is a sample subnet configuration which enables prefix
      delegation for the subnet:
      </p><pre class="screen">
"Dhcp6": {
    "subnet6": [
        {
            "subnet": "2001:d8b:1::/64",
            <strong class="userinput"><code>"pd-pools": [
                {
                    "prefix": "3000:1::",
                    "prefix-len": 64,
                    "delegated-len": 96
                }
            ]</code></strong>
        }
    ],
    ...
}</pre><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-std-options"></a>8.2.8. Standard DHCPv6 options</h3></div></div></div><p>
        One of the major features of a DHCPv6 server is to provide configuration
        options to clients.  Although there are several options that require
        special behavior, most options are sent by the server only if the client
        explicitly requests them.  The following example shows how to
        configure DNS servers, which is one of the most frequently used
        options.  Numbers in the first column are added for easier reference and
        will not appear on screen.  Options specified in this way are considered
        global and apply to all configured subnets.

        </p><pre class="screen">
"Dhcp6": {
    "option-data": [
        {
           <strong class="userinput"><code>"name": "dns-servers",
           "code": 23,
           "space": "dhcp6",
           "csv-format": true,
           "data": "2001:db8::cafe, 2001:db8::babe"</code></strong>
        },
        ...
    ]
}
</pre><p>
      </p><p>
      The <span class="command"><strong>option-data&gt;</strong></span> line creates a new entry in
      the option-data table.  This table contains
      information on all global options that the server is supposed to configure
      in all subnets.  The <span class="command"><strong>name</strong></span> line specifies the option name.
      (For a complete list
      of currently supported names, see <a class="xref" href="#dhcp6-std-options-list" title="Table 8.1. List of standard DHCPv6 options">Table 8.1, “List of standard DHCPv6 options”</a>.)  The next line specifies the option code,
      which must match one of the values from that list. The line beginning with
      <span class="command"><strong>space</strong></span> specifies the option space, which must always be set
      to "dhcp6" as these are standard DHCPv6 options.  For other name spaces,
      including custom option spaces, see <a class="xref" href="#dhcp6-option-spaces" title="8.2.11. Nested DHCPv6 options (custom option spaces)">Section 8.2.11, “Nested DHCPv6 options (custom option spaces)”</a>. The next line specifies the format in
      which the data will be entered: use of CSV (comma separated values) is
      recommended. The <span class="command"><strong>data</strong></span> line gives the actual value to be sent to
      clients.  Data is specified as normal text, with values separated by
      commas if more than one value is allowed.
    </p><p>
      Options can also be configured as hexadecimal values.  If "csv-format" is
      set to false, the option data must be specified as a string of hexadecimal
      numbers.  The
      following commands configure the DNS-SERVERS option for all
      subnets with the following addresses: 2001:db8:1::cafe and
      2001:db8:1::babe.
        </p><pre class="screen">
"Dhcp6": {
    "option-data": [
        {
           <strong class="userinput"><code>"name": "dns-servers",
           "code": 23,
           "space": "dhcp6",
           "csv-format": false,
           "data": "2001 0DB8 0001 0000 0000 0000 0000 CAFE
                    2001 0DB8 0001 0000 0000 0000 0000 BABE"</code></strong>
        },
        ...
    ]
}
</pre><p>

       The value for the setting of the "data" element is split across two
       lines in this document for clarity: when entering the command, the
       whole string should be entered on the same line.  Care should be taken
       to use proper encoding when using hexadecimal format as Kea's ability
       to validate data correctness in hexadecimal is limited.
      </p><p>
        Most of the parameters in the "option-data" structure are optional and
        can be omitted in some circumstances as discussed in the
        <a class="xref" href="#dhcp6-option-data-defaults" title="8.2.12. Unspecified parameters for DHCPv6 option configuration">Section 8.2.12, “Unspecified parameters for DHCPv6 option configuration”</a>.
      </p><p>
      It is possible to override options on a per-subnet basis.  If
      clients connected to most of your subnets are expected to get the
      same values of a given option, you should use global options: you
      can then override specific values for a small number of subnets.
      On the other hand, if you use different values in each subnet,
      it does not make sense to specify global option values
      (Dhcp6/option-data), rather you should set only subnet-specific values
      (Dhcp6/subnet[X]/option-data[Y]).
     </p><p>
      The following commands override the global
      DNS servers option for a particular subnet, setting a single DNS
      server with address 2001:db8:1::3.
</p><pre class="screen">
"Dhcp6": {
    "subnet6": [
        {
            <strong class="userinput"><code>"option-data": [
                {
                    "name": "dns-servers",
                    "code": 23,
                    "space": "dhcp6",
                    "csv-format": true,
                    "data": "2001:db8:1::3"
                },
                ...
            ]</code></strong>,
            ...
        },
        ...
    ],
    ...
}
</pre><p>
    </p><p>
      The currently supported standard DHCPv6 options are
      listed in <a class="xref" href="#dhcp6-std-options-list" title="Table 8.1. List of standard DHCPv6 options">Table 8.1, “List of standard DHCPv6 options”</a>.
      The "Name" and "Code"
      are the values that should be used as a name in the option-data
      structures. "Type" designates the format of the data: the meanings of
      the various types is given in <a class="xref" href="#dhcp-types" title="Table 7.3. List of standard DHCP option types">Table 7.3, “List of standard DHCP option types”</a>.
    </p><p>
      Experimental options (like standard options but with a code
      which was not assigned by IANA) are listed in
      <a class="xref" href="#dhcp6-exp-options-list" title="Table 8.2. List of experimental DHCPv6 options">Table 8.2, “List of experimental DHCPv6 options”</a>.
    </p><p>
      Some options are designated as arrays, which means that more than one
      value is allowed in such an option. For example the option dns-servers
      allows the specification of more than one IPv6 address, allowing
      clients to obtain the addresses of multiple DNS servers.
    </p><p>
        The <a class="xref" href="#dhcp6-custom-options" title="8.2.9. Custom DHCPv6 options">Section 8.2.9, “Custom DHCPv6 options”</a> describes the configuration
        syntax to create custom option definitions (formats). It is generally not
        allowed to create custom definitions for standard options, even if the
        definition being created matches the actual option format defined in the
        RFCs. There is an exception from this rule for standard options for which
        Kea does not provide a definition yet. In order to use such options,
        a server administrator must create a definition as described in
        <a class="xref" href="#dhcp6-custom-options" title="8.2.9. Custom DHCPv6 options">Section 8.2.9, “Custom DHCPv6 options”</a> in the 'dhcp6' option space. This
        definition should match the option format described in the relevant
        RFC but the configuration mechanism would allow any option format as it has
        no means to validate the format at the moment.
      </p><p>
      </p><div class="table"><a name="dhcp6-std-options-list"></a><p class="title"><b>Table 8.1. List of standard DHCPv6 options</b></p><div class="table-contents"><table summary="List of standard DHCPv6 options" border="1"><colgroup><col class="name"><col align="center" class="code"><col align="center" class="type"><col align="center" class="array"></colgroup><thead><tr><th>Name</th><th align="center">Code</th><th align="center">Type</th><th align="center">Array?</th></tr></thead><tbody><tr><td>preference</td><td align="center">7</td><td align="center">uint8</td><td align="center">false</td></tr><tr><td>vendor-opts</td><td align="center">17</td><td align="center">uint32</td><td align="center">false</td></tr><tr><td>sip-server-dns</td><td align="center">21</td><td align="center">fqdn</td><td align="center">true</td></tr><tr><td>sip-server-addr</td><td align="center">22</td><td align="center">ipv6-address</td><td align="center">true</td></tr><tr><td>dns-servers</td><td align="center">23</td><td align="center">ipv6-address</td><td align="center">true</td></tr><tr><td>domain-search</td><td align="center">24</td><td align="center">fqdn</td><td align="center">true</td></tr><tr><td>nis-servers</td><td align="center">27</td><td align="center">ipv6-address</td><td align="center">true</td></tr><tr><td>nisp-servers</td><td align="center">28</td><td align="center">ipv6-address</td><td align="center">true</td></tr><tr><td>nis-domain-name</td><td align="center">29</td><td align="center">fqdn</td><td align="center">true</td></tr><tr><td>nisp-domain-name</td><td align="center">30</td><td align="center">fqdn</td><td align="center">true</td></tr><tr><td>sntp-servers</td><td align="center">31</td><td align="center">ipv6-address</td><td align="center">true</td></tr><tr><td>information-refresh-time</td><td align="center">32</td><td align="center">uint32</td><td align="center">false</td></tr><tr><td>bcmcs-server-dns</td><td align="center">33</td><td align="center">fqdn</td><td align="center">true</td></tr><tr><td>bcmcs-server-addr</td><td align="center">34</td><td align="center">ipv6-address</td><td align="center">true</td></tr><tr><td>geoconf-civic</td><td align="center">36</td><td align="center">record (uint8, uint16, binary)</td><td align="center">false</td></tr><tr><td>remote-id</td><td align="center">37</td><td align="center">record (uint32, binary)</td><td align="center">false</td></tr><tr><td>subscriber-id</td><td align="center">38</td><td align="center">binary</td><td align="center">false</td></tr><tr><td>client-fqdn</td><td align="center">39</td><td align="center">record (uint8, fqdn)</td><td align="center">false</td></tr><tr><td>pana-agent</td><td align="center">40</td><td align="center">ipv6-address</td><td align="center">true</td></tr><tr><td>new-posix-timezone</td><td align="center">41</td><td align="center">string</td><td align="center">false</td></tr><tr><td>new-tzdb-timezone</td><td align="center">42</td><td align="center">string</td><td align="center">false</td></tr><tr><td>ero</td><td align="center">43</td><td align="center">uint16</td><td align="center">true</td></tr><tr><td>lq-query</td><td align="center">44</td><td align="center">record (uint8, ipv6-address)</td><td align="center">false</td></tr><tr><td>client-data</td><td align="center">45</td><td align="center">empty</td><td align="center">false</td></tr><tr><td>clt-time</td><td align="center">46</td><td align="center">uint32</td><td align="center">false</td></tr><tr><td>lq-relay-data</td><td align="center">47</td><td align="center">record (ipv6-address, binary)</td><td align="center">false</td></tr><tr><td>lq-client-link</td><td align="center">48</td><td align="center">ipv6-address</td><td align="center">true</td></tr><tr><td>bootfile-url</td><td align="center">59</td><td align="center">string</td><td align="center">false</td></tr><tr><td>bootfile-param</td><td align="center">60</td><td align="center">binary</td><td align="center">false</td></tr><tr><td>client-arch-type</td><td align="center">61</td><td align="center">uint16</td><td align="center">true</td></tr><tr><td>nii</td><td align="center">62</td><td align="center">record (uint8, uint8, uint8)</td><td align="center">false</td></tr><tr><td>erp-local-domain-name</td><td align="center">65</td><td align="center">fqdn</td><td align="center">false</td></tr><tr><td>rsoo</td><td align="center">66</td><td align="center">empty</td><td align="center">false</td></tr><tr><td>client-linklayer-addr</td><td align="center">79</td><td align="center">binary</td><td align="center">false</td></tr><tr><td>dhcp4o6-server-addr</td><td align="center">88</td><td align="center">ipv6-address</td><td align="center">true</td></tr></tbody></table></div></div><p><br class="table-break">
    </p><p>
      </p><div class="table"><a name="dhcp6-exp-options-list"></a><p class="title"><b>Table 8.2. List of experimental DHCPv6 options</b></p><div class="table-contents"><table summary="List of experimental DHCPv6 options" border="1"><colgroup><col class="name"><col align="center" class="code"><col align="center" class="type"><col align="center" class="array"></colgroup><thead><tr><th>Name</th><th align="center">Code</th><th align="center">Type</th><th align="center">Array?</th></tr></thead><tbody><tr><td>public-key</td><td align="center">701</td><td align="center">binary</td><td align="center">false</td></tr><tr><td>certificate</td><td align="center">702</td><td align="center">binary</td><td align="center">false</td></tr><tr><td>signature</td><td align="center">703</td><td align="center">record (uint8, uint8, binary)</td><td align="center">false</td></tr><tr><td>timestamp</td><td align="center">704</td><td align="center">binary</td><td align="center">false</td></tr></tbody></table></div></div><p><br class="table-break">
    </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-custom-options"></a>8.2.9. Custom DHCPv6 options</h3></div></div></div><p>It is also possible to define options other than the standard ones.
      Assume that we want to define a new DHCPv6 option called "foo" which will have
      code 100 and will convey a single unsigned 32 bit integer value. We can define
      such an option by using the following commands:
</p><pre class="screen">
"Dhcp6": {
    "option-def": [
        {
            <strong class="userinput"><code>"name": "foo",
            "code": 100,
            "type": "uint32",
            "array": false,
            "record-types": "",
            "space": "dhcp6",
            "encapsulate": ""</code></strong>
        }, ...
    ],
    ...
}
</pre><p>
      The "false" value of the "array" parameter determines that the option does
      NOT comprise an array of "uint32" values but rather a single value.  Two
      other parameters have been left blank: "record-types" and "encapsulate".
      The former specifies the comma separated list of option data fields if the
      option comprises a record of data fields. The "record-fields" value should
      be non-empty if the "type" is set to "record". Otherwise it must be left
      blank. The latter parameter specifies the name of the option space being
      encapsulated by the particular option. If the particular option does not
      encapsulate any option space it should be left blank.  Note that the above
      set of comments define the format of the new option and do not set its
      values.
      </p><p>The <span class="command"><strong>name</strong></span>, <span class="command"><strong>code</strong></span> and
      <span class="command"><strong>type</strong></span> parameters are required, all others are
      optional. The <span class="command"><strong>array</strong></span> default value is
      <span class="command"><strong>false</strong></span>. The <span class="command"><strong>record-types</strong></span>
      and <span class="command"><strong>encapsulate</strong></span> default values are blank
      (i.e. ""). The default <span class="command"><strong>space</strong></span> is "dhcp6".
      </p><p>Once the new option format is defined, its value is set
      in the same way as for a standard option. For example the following
      commands set a global value that applies to all subnets.
</p><pre class="screen">
"Dhcp6": {
    "option-data": [
        {
            <strong class="userinput"><code>"name": "foo",
            "code": 100,
            "space": "dhcp6",
            "csv-format": true,
            "data": "12345"</code></strong>
        }, ...
    ],
    ...
}
</pre><p>
      </p><p>New options can take more complex forms than simple use of
      primitives (uint8, string, ipv6-address etc): it is possible to
      define an option comprising a number of existing primitives.
      </p><p>
      Assume we want to define a new option that will consist of an IPv6
      address, followed by an unsigned 16 bit integer, followed by a
      boolean value, followed by a text string. Such an option could
      be defined in the following way:
</p><pre class="screen">
"Dhcp6": {
    "option-def": [
        {
            <strong class="userinput"><code>"name": "bar",
            "code": 101,
            "space": "dhcp6",
            "type": "record",
            "array": false,
            "record-types": "ipv6-address, uint16, boolean, string",
            "encapsulate": ""</code></strong>
        }, ...
    ],
    ...
}
</pre><p>
      The "type" is set to "record" to indicate that the option contains
      multiple values of different types.  These types are given as a comma-separated
      list in the "record-types" field and should be those listed in <a class="xref" href="#dhcp-types" title="Table 7.3. List of standard DHCP option types">Table 7.3, “List of standard DHCP option types”</a>.
      </p><p>
      The values of the option are set as follows:
</p><pre class="screen">
"Dhcp6": {
    "option-data": [
        {
            <strong class="userinput"><code>"name": "bar",
            "space": "dhcp6",
            "code": 101,
            "csv-format": true,
            "data": "2001:db8:1::10, 123, false, Hello World"</code></strong>
        }
    ],
    ...
}</pre><p>

      <span class="command"><strong>csv-format</strong></span> is set <span class="command"><strong>true</strong></span> to indicate
      that the <span class="command"><strong>data</strong></span> field comprises a command-separated list
      of values.  The values in the "data" must correspond to the types set in
      the "record-types" field of the option definition.
      </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>In the general case, boolean values are specified as <span class="command"><strong>true</strong></span> or
       <span class="command"><strong>false</strong></span>, without quotes. Some specific boolean parameters may
       accept also <span class="command"><strong>"true"</strong></span>, <span class="command"><strong>"false"</strong></span>,
       <span class="command"><strong>0</strong></span>, <span class="command"><strong>1</strong></span>, <span class="command"><strong>"0"</strong></span> and
       <span class="command"><strong>"1"</strong></span>. Future Kea versions will accept all those values
       for all boolean parameters.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-vendor-opts"></a>8.2.10. DHCPv6 vendor specific options</h3></div></div></div><p>
      Currently there are two option spaces defined for the DHCPv6
      daemon: "dhcp6" (for top level DHCPv6 options) and "vendor-opts-space",
      which is empty by default, but options can be defined in it.
      Those options will be carried in the Vendor-specific
      Information option (code 17). The following examples show how to
      define an option "foo" with code 1 that consists of an IPv6 address,
      an unsigned 16 bit integer and a string. The "foo" option is
      conveyed in a Vendor-specific Information option. This option
      comprises a single uint32 value that is set to "12345".
      The sub-option "foo" follows the data field holding this value.
      </p><pre class="screen">
"Dhcp6": {
    "option-def": [
        {
            <strong class="userinput"><code>"name": "foo",
            "code": 1,
            "space": "vendor-opts-space",
            "type": "record",
            "array": false,
            "record-types": "ipv6-address, uint16, string",
            "encapsulate": ""</code></strong>
        }
    ],
    ...
}</pre><p>
     (Note that the option space is set to <span class="command"><strong>vendor-opts-space</strong></span>.)
     Once the option format is defined, the next step is to define actual values
     for that option:
</p><pre class="screen">
"Dhcp6": {
    "option-data": [
        {
            <strong class="userinput"><code>"name": "foo",
            "space": "vendor-opts-space",
            "data": "2001:db8:1::10, 123, Hello World"</code></strong>
        },
        ...
    ],
    ...
}</pre><p>
    We should also define a value (enterprise-number) for the
    Vendor-specific Information option, that conveys our option "foo".
</p><pre class="screen">
"Dhcp6": {
    "option-data": [
        ...,
        {
            <strong class="userinput"><code>"name": "vendor-opts",
            "data": "12345"</code></strong>
        }
    ],
    ...
}</pre><p>
    Alternatively, the option can be specified using its code.
</p><pre class="screen">
"Dhcp6": {
    "option-data": [
        ...,
        {
            <strong class="userinput"><code>"code": 17,
            "data": "12345"</code></strong>
        }
    ],
    ...
}</pre><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-option-spaces"></a>8.2.11. Nested DHCPv6 options (custom option spaces)</h3></div></div></div><p>It is sometimes useful to define completely new option
      spaces.  This is useful if the user wants his new option to
      convey sub-options that use a separate numbering scheme, for
      example sub-options with codes 1 and 2. Those option codes
      conflict with standard DHCPv6 options, so a separate option
      space must be defined.
      </p><p>Note that it is not required to create a new option space when
      defining sub-options for a standard option because it is
      created by default if the standard option is meant to convey
      any sub-options (see <a class="xref" href="#dhcp6-vendor-opts" title="8.2.10. DHCPv6 vendor specific options">Section 8.2.10, “DHCPv6 vendor specific options”</a>).
      </p><p>
      Assume that we want to have a DHCPv6 option called "container"
      with code 102 that conveys two sub-options with codes 1 and 2.
      First we need to define the new sub-options:
</p><pre class="screen">
"Dhcp6": {
    "option-def": [
        {
            <strong class="userinput"><code>"name": "subopt1",
            "code": 1,
            "space": "isc",
            "type": "ipv6-address",
            "record-types": "",
            "array": false,
            "encapsulate": ""</code></strong>
        },
        {
            <strong class="userinput"><code>"name": "subopt2",
            "code": 2,
            "space": "isc",
            "type": "string",
            "record-types": "",
            "array": false
            "encapsulate": ""</code></strong>
        }
    ],
    ...
}</pre><p>
    Note that we have defined the options to belong to a new option space
    (in this case, "isc").
    </p><p>
The next step is to define a regular DHCPv6 option and specify that it
should include options from the isc option space:
</p><pre class="screen">
"Dhcp6": {
    "option-def": [
        ...,
        {
            <strong class="userinput"><code>"name": "container",
            "code": 102,
            "space": "dhcp6",
            "type": "empty",
            "array": false,
            "record-types": "",
            "encapsulate": "isc"</code></strong>
        }
    ],
    ...
}</pre><p>

    The name of the option space in which the sub-options are defined is set in
    the <span class="command"><strong>encapsulate</strong></span> field. The <span class="command"><strong>type</strong></span> field
    is set to <span class="command"><strong>empty</strong></span> which limits this option to only carrying
    data in sub-options.
    </p><p>
    Finally, we can set values for the new options:
</p><pre class="screen">
"Dhcp6": {
    "option-data": [
        {
            <strong class="userinput"><code>"name": "subopt1",
            "code": 1,
            "space": "isc",
            "data": "2001:db8::abcd"</code></strong>
        },
        }
            <strong class="userinput"><code>"name": "subopt2",
            "code": 2,
            "space": "isc",
            "data": "Hello world"</code></strong>
        },
        {
            <strong class="userinput"><code>"name": "container",
            "code": 102,
            "space": "dhcp6"</code></strong>
        }
    ],
    ...
}
</pre><p>
    </p><p>Note that it is possible to create an option which carries some data
    in addition to the sub-options defined in the encapsulated option space.
    For example, if the "container" option from the previous example was
    required to carry an uint16 value as well as the sub-options, the "type"
    value would have to be set to "uint16" in the option definition. (Such an
    option would then have the following data structure: DHCP header, uint16
    value, sub-options.) The value specified with the "data" parameter — which
    should be a valid integer enclosed in quotes, e.g. "123" — would then be
    assigned to the uint16 field in the "container" option.
    </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-option-data-defaults"></a>8.2.12. Unspecified parameters for DHCPv6 option configuration</h3></div></div></div><p>In many cases it is not required to specify all parameters for
      an option configuration and the default values can be used. However, it is
      important to understand the implications of not specifying some of them
      as it may result in configuration errors. The list below explains
      the behavior of the server when a particular parameter is not explicitly
      specified:

      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="command"><strong>name</strong></span> - the server requires an option name or
          option code to identify an option. If this parameter is unspecified, the
          option code must be specified.
          </li><li class="listitem"><span class="command"><strong>code</strong></span> - the server requires an option name or
          option code to identify an option. This parameter may be left unspecified if
          the <span class="command"><strong>name</strong></span> parameter is specified. However, this also
          requires that the particular option has its definition (it is either a
          standard option or an administrator created a definition for the option
          using an 'option-def' structure), as the option definition associates an
          option with a particular name. It is possible to configure an option
          for which there is no definition (unspecified option format).
          Configuration of such options requires the use of option code.
          </li><li class="listitem"><span class="command"><strong>space</strong></span> - if the option space is unspecified it
          will default to 'dhcp6' which is an option space holding DHCPv6 standard
          options.
          </li><li class="listitem"><span class="command"><strong>data</strong></span> - if the option data is unspecified it
          defaults to an empty value. The empty value is mostly used for the
          options which have no payload (boolean options), but it is legal to specify
          empty values for some options which carry variable length data and which
          spec allows for the length of 0. For such options, the data parameter
          may be omitted in the configuration.</li><li class="listitem"><span class="command"><strong>csv-format</strong></span> - if this value is not specified
          and the definition for the particular option exists, the server will assume
          that the option data is specified as a list of comma separated values to be
          assigned to individual fields of the DHCP option. If the definition
          does not exist for this option, the server will assume that the data
          parameter contains the option payload in the binary format (represented
          as a string of hexadecimal digits). Note that not specifying this
          parameter doesn't imply that it defaults to a fixed value, but
          the configuration data interpretation also depends on the presence
          of the option definition. An administrator must be aware if the
          definition for the particular option exists when this parameter
          is not specified. It is generally recommended to not specify this
          parameter only for the options for which the definition exists, e.g.
          standard options. Setting <span class="command"><strong>csv-format</strong></span> to an explicit
          value will cause the server to strictly check the format of the option
          data specified.
          </li></ul></div><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-config-subnets"></a>8.2.13. IPv6 Subnet Selection</h3></div></div></div><p>
        The DHCPv6 server may receive requests from local (connected to the
        same subnet as the server) and remote (connecting via relays) clients.
        As the server may have many subnet configurations defined, it must select
        an appropriate subnet for a given request.
      </p><p>
        The server can not assume which of the configured subnets are local. In IPv4
        it is possible as there is a reasonable expectation that the
        server will have a (global) IPv4 address configured on the interface,
        and can use that information to detect whether a subnet is local or
        not. That assumption is not true in IPv6, the DHCPv6 server must be able
        to operate while only having link-local addresses. Therefore an optional
        "interface" parameter is available within a subnet definition
        to designate that a given subnet is local, i.e. reachable directly over
        the specified interface. For example the server that is intended to serve
        a local subnet over eth0 may be configured as follows:
        </p><pre class="screen">
"Dhcp6": {
    "subnet6": [
        {
            "subnet": "2001:db8:beef::/48",
            "pools": [
                 {
                     "pool": "2001:db8:beef::/48"
                 }
             ],
            <strong class="userinput"><code>"interface": "eth0"</code></strong>
        }
    ],
    ...
}
</pre><p>
        </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-rapid-commit"></a>8.2.14. Rapid Commit</h3></div></div></div><p>The Rapid Commit option, described in
        <a class="ulink" href="http://tools.ietf.org/html/rfc3315" target="_top">RFC 3315</a>, is supported
        by the Kea DHCPv6 server. However, support is disabled by default for
        all subnets. It can be enabled for a particular subnet using the
        <span class="command"><strong>rapid-commit</strong></span> parameter as shown below:
</p><pre class="screen">
"Dhcp6": {
    "subnet6": [
        {
            "subnet": "2001:db8:beef::/48",
            <strong class="userinput"><code>"rapid-commit": true</code></strong>,
            "pools": [
                 {
                     "pool": "2001:db8:beef::1-2001:db8:beef::10"
                 }
             ],
        }
    ],
    ...
}
</pre><p>
        </p><p>
          This setting only affects the subnet for which the
          <span class="command"><strong>rapid-commit</strong></span> is set to <span class="command"><strong>true</strong></span>.
          For clients connected to other subnets, the server will ignore the
          Rapid Commit option sent by the client and will follow the 4-way
          exchange procedure, i.e. respond with the Advertise for the Solicit
          containing Rapid Commit option.
        </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-relays"></a>8.2.15. DHCPv6 Relays</h3></div></div></div><p>
          A DHCPv6 server with multiple subnets defined must select the
          appropriate subnet when it receives a request from a client.  For clients
          connected via relays, two mechanisms are used:
        </p><p>
          The first uses the linkaddr field in the RELAY_FORW message. The name
          of this field is somewhat misleading in that it does not contain a link-layer
          address: instead, it holds an address (typically a global address) that is
          used to identify a link. The DHCPv6 server checks if the address belongs
          to a defined subnet and, if it does, that subnet is selected for the client's
          request.
        </p><p>
          The second mechanism is based on interface-id options. While forwarding a client's
          message, relays may insert an interface-id option into the message that
          identifies the interface on the relay that received the message. (Some
          relays allow configuration of that parameter, but it is sometimes
          hardcoded and may range from the very simple (e.g. "vlan100") to the very cryptic:
          one example seen on real hardware was "ISAM144|299|ipv6|nt:vp:1:110"). The
          server can use this information to select the appropriate subnet.
          The information is also returned to the relay which then knows the
          interface to use to transmit the response to the client. In order for
          this to work successfully, the relay interface IDs must be unique within
          the network and the server configuration must match those values.
        </p><p>
          When configuring the DHCPv6 server, it should be noted that two
          similarly-named parameters can be configured for a subnet:
          </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
              "interface" defines which local network interface can be used
              to access a given subnet.
            </li><li class="listitem">
              "interface-id" specifies the content of the interface-id option
              used by relays to identify the interface on the relay to which
              the response packet is sent.
            </li></ul></div><p>
          The two are mutually exclusive: a subnet cannot be both reachable locally
          (direct traffic) and via relays (remote traffic). Specifying both is a
          configuration error and the DHCPv6 server will refuse such a configuration.
        </p><p>
          To specify interface-id with value "vlan123", the following commands can
          be used:
          </p><pre class="screen">
"Dhcp6": {
    "subnet6": [
        {
            "subnet": "2001:db8:beef::/48",
            "pools": [
                 {
                     "pool": "2001:db8:beef::/48"
                 }
             ],
            <strong class="userinput"><code>"interface-id": "vlan123"</code></strong>
        }
    ],
    ...
}
</pre><p>
        </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-rsoo"></a>8.2.16. Relay-Supplied Options</h3></div></div></div><p><a class="ulink" href="http://tools.ietf.org/html/rfc6422" target="_top">RFC 6422</a>
      defines a mechanism called Relay-Supplied DHCP Options. In certain cases relay
      agents are the only entities that may have specific information. They can
      insert options when relaying messages from the client to the server. The
      server will then do certain checks and copy those options to the response
      that will be sent to the client.</p><p>There are certain conditions that must be met for the option to be
      included. First, the server must not provide the option by itself. In
      other words, if both relay and server provide an option, the server always
      takes precedence. Second, the option must be RSOO-enabled. IANA maintains a
      list of RSOO-enabled options <a class="ulink" href="http://www.iana.org/assignments/dhcpv6-parameters/dhcpv6-parameters.xhtml#options-relay-supplied" target="_top">here</a>.
      However, there may be cases when system administrators want to echo other
      options. Kea can be instructed to treat other options as RSOO-enabled.
      For example, to mark options 110, 120 and 130 as RSOO-enabled, the following
      syntax should be used:
</p><pre class="screen">
"Dhcp6": {
    <strong class="userinput"><code>"relay-supplied-options": [ "110", "120", "130" ],</code></strong>
    ...
}
</pre><p>
      </p><p>As of March 2015, only option 65 is RSOO-enabled by IANA. This
      option will always be treated as such and there's no need to explicitly
      mark it. Also, when enabling standard options, it is possible to use their
      names, rather than option code, e.g. (e.g. use
      <span class="command"><strong>dns-servers</strong></span> instead of <span class="command"><strong>23</strong></span>). See
      <a class="xref" href="#dhcp6-std-options-list" title="Table 8.1. List of standard DHCPv6 options">Table 8.1, “List of standard DHCPv6 options”</a> for the names. In certain cases
      it could also work for custom options, but due to the nature of the parser
      code this may be unreliable and should be avoided.
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-client-classifier"></a>8.2.17. Client Classification in DHCPv6</h3></div></div></div><p>
      The DHCPv6 server includes support for client classification.  At the
      current time the capabilities of the classification process are limited
      but it is expected they will be expanded in the future. For a deeper
      discussion of the classification process see <a class="xref" href="#classify" title="Chapter 12. Client Classification">Chapter 12, <i>Client Classification</i></a>.
      </p><p>
      In certain cases it is useful to differentiate between different types
      of clients and treat them accordingly. It is envisaged that client
      classification will be used for changing the behavior of almost any part of
      the DHCP message processing, including the assignment of leases from different
      pools, the assignment of different options (or different values of the same
      options) etc. In the current release of the software however, there are
      only two mechanisms that take advantage of client classification:
      subnet selection and assignment of different options.
      </p><p>
      Kea can be instructed to limit access to given subnets based on class information.
      This is particularly useful for cases where two types of devices share the
      same link and are expected to be served from two different subnets. The
      primary use case for such a scenario is cable networks. There are two
      classes of devices: the cable modem itself, which should be handed a lease
      from subnet A and all other devices behind the modem that should get a lease
      from subnet B. That segregation is essential to prevent overly curious
      users from playing with their cable modems. For details on how to set up
      class restrictions on subnets, see <a class="xref" href="#classification-subnets" title="12.5. Configuring Subnets With Class Information">Section 12.5, “Configuring Subnets With Class Information”</a>.
      </p><p>
      The process of doing classification is conducted in three steps. The first step
      is to assess an incoming packet and assign it to zero or more classes.  The
      second step is to choose a subnet, possibly based on the class information.
      The third step is to assign options again possibly based on the class
      information.
      </p><p>
      There are two methods of doing classification. The first is automatic and relies
      on examining the values in the vendor class options. Information from these
      options is extracted and a class name is constructed from it and added to
      the class list for the packet. The second allows you to specify an expression
      that is evaluated for each packet. If the result is true the packet is
      a member of the class.
      </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
        Care should be taken with client classification as it is easy for
        clients that do not meet class criteria to be denied any service altogether.
      </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="idp56625104"></a>8.2.17.1. Defining and Using Custom Classes</h4></div></div></div><p>
        The following example shows how to configure a class using an expression
        and a subnet making use of that class. This configuration defines the
        class named "Client_enterprise". It is comprised
        of all clients who's client identifiers start with the given hex string (which
        would indicate a DUID based on an enterprise id of 0xAABBCCDD).
        They will be given an address from 2001:db8:1::0 to 2001:db8:1::FFFF and
        2001:db8:0::1 and 2001:db8:2::1 for their domain name servers. For a deeper
        discussion of the classification process see <a class="xref" href="#classify" title="Chapter 12. Client Classification">Chapter 12, <i>Client Classification</i></a>.

        </p><pre class="screen">
"Dhcp6": {
    "client-classes": [
        {<strong class="userinput"><code>
            "name": "Client_enterprise",
            "test": "substring(option[1].hex,0,6) == 0x0002AABBCCDD'",
            "option-data": [
                {
                    "name": "dns-servers",
                    "code": 23,
                    "space": "dhcp6",
                    "csv-format": true,
                    "data": "2001:db8:0::1, 2001:db8:2::1"
                }
            ]</code></strong>
        },
        ...
    ],
    "subnet6": [
        {
            "subnet": "2001:db8:1::/64",
            "pools": [ { "pool": "2001:db8:1::-2001:db8:1::ffff" } ],
            <strong class="userinput"><code>"client-class": "Client_enterprise"</code></strong>
        }
    ],
    ...
}</pre><p>
      </p><p>
      This example shows a configuration using an automatically generated
      "VENDOR_CLASS_" class. The Administrator of the network has
      decided that addresses from range 2001:db8:1::1 to 2001:db8:1::ffff are
      going to be managed by the Dhcp6 server and only clients belonging to the
      eRouter1.0 client class are allowed to use that pool.

        </p><pre class="screen">
"Dhcp6": {
    "subnet6": [
        {
            "subnet": "2001:db8:1::/64",
            "pools": [
                 {
                     "pool": "2001:db8:1::-2001:db8:1::ffff"
                 }
             ],
            <strong class="userinput"><code>"client-class": "VENDOR_CLASS_eRouter1.0"</code></strong>
        }
    ],
    ...
}
</pre><p>
        </p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="dhcp6-ddns-config"></a>8.2.18. Configuring DHCPv6 for DDNS</h3></div></div></div><p>
      As mentioned earlier, kea-dhcp6 can be configured to generate requests to
      the DHCP-DDNS server (referred to here as "D2") to update
      DNS entries.  These requests are known as NameChangeRequests or NCRs.
      Each NCR contains the following information:
      </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
      Whether it is a request to add (update) or remove DNS entries
      </p></li><li class="listitem"><p>
      Whether the change requests forward DNS updates (AAAA records), reverse
      DNS updates (PTR records), or both.
      </p></li><li class="listitem"><p>
      The FQDN, lease address, and DHCID
      </p></li></ol></div><p>
      The parameters controlling the generation of NCRs for submission to D2
      are contained in the "dhcp-ddns" section of kea-dhcp6
      configuration. The mandatory parameters for the DHCP DDNS configuration
      are <span class="command"><strong>enable-updates</strong></span> which is unconditionally
      required, and <span class="command"><strong>qualifying-suffix</strong></span> which has no
      default value and is required when <span class="command"><strong>enable-updates</strong></span>
      is set to <span class="command"><strong>true</strong></span>.

      The two (disabled and enabled) minimal DHCP DDNS configurations are:
</p><pre class="screen">
"Dhcp6": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"enable-updates": false</code></strong>
    },
    ...
}
</pre><p>
      and for example:
</p><pre class="screen">
"Dhcp6": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"enable-updates": true,
        "qualifying-suffix": "example."</code></strong>
    },
    ...
}
</pre><p>

      The default values for the "dhcp-ddns" section are as follows:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
      <span class="command"><strong>"server-ip": "127.0.0.1"</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"server-port": 53001</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"sender-ip": ""</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"sender-port": 0</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"max-queue-size": 1024</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"ncr-protocol": "UDP"</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"ncr-format": "JSON"</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"override-no-update": false</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"override-client-update": false</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"replace-client-name": false</strong></span>
      </li><li class="listitem">
      <span class="command"><strong>"generated-prefix": "myhost"</strong></span>
      </li></ul></div><p>
      </p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="dhcpv6-d2-io-config"></a>8.2.18.1. DHCP-DDNS Server Connectivity</h4></div></div></div><p>
      In order for NCRs to reach the D2 server, kea-dhcp6 must be able
      to communicate with it.  kea-dhcp6 uses the following configuration
      parameters to control how it communications with D2:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
      <span class="command"><strong>enable-updates</strong></span> - determines whether or not kea-dhcp6 will
      generate NCRs.  If missing, this value is assumed to be false hence DDNS updates
      are disabled.  To enable DDNS updates set this value to true:
      </li><li class="listitem">
      <span class="command"><strong>server-ip</strong></span> - IP address on which D2 listens for requests. The default is
      the local loopback interface at address 127.0.0.1. You may specify
      either an IPv4 or IPv6 address.
      </li><li class="listitem">
      <span class="command"><strong>server-port</strong></span> - port on which D2 listens for requests.  The default value
      is 53001.
      </li><li class="listitem">
      <span class="command"><strong>sender-ip</strong></span> - IP address which kea-dhcp6 should use to send requests to D2.
      The default value is blank which instructs kea-dhcp6 to select a suitable
      address.
      </li><li class="listitem">
      <span class="command"><strong>sender-port</strong></span> - port which kea-dhcp6 should use to send requests to D2. The
      default value of 0 instructs kea-dhcp6 to select a suitable port.
      </li><li class="listitem">
      <span class="command"><strong>max-queue-size</strong></span> - maximum number of requests allowed to queue waiting to
      be sent to D2. This value guards against requests accumulating
      uncontrollably if they are being generated faster than they can be
      delivered.  If the number of requests queued for transmission reaches
      this value, DDNS updating will be turned off until the queue backlog has
      been sufficiently reduced.  The intent is to allow kea-dhcp6 to
      continue lease operations.  The default value is 1024.
      </li><li class="listitem">
      <span class="command"><strong>ncr-protocol</strong></span> - Socket protocol use when sending requests to D2.  Currently
      only UDP is supported.  TCP may be available in an upcoming release.
      </li><li class="listitem">
      <span class="command"><strong>ncr-format</strong></span> - Packet format to use when sending requests to D2.
      Currently only JSON format is supported.  Other formats may be available
      in future releases.
      </li></ul></div><p>
      By default, kea-dhcp-ddns is assumed to running on the same machine as kea-dhcp6, and
      all of the default values mentioned above should be sufficient.
      If, however, D2 has been configured to listen on a different address or
      port, these values must altered accordingly. For example, if D2 has been
      configured to listen on 2001:db8::5 port 900, the following commands
      would be required:
</p><pre class="screen">
"Dhcp6": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"server-ip": "2001:db8::5",
        "server-port": 900</code></strong>,
        ...
    },
    ...
}
</pre><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="dhcpv6-d2-rules-config"></a>8.2.18.2. When does kea-dhcp6 generate DDNS request</h4></div></div></div><p>kea-dhcp6 follows the behavior prescribed for DHCP servers in
      <a class="ulink" href="http://tools.ietf.org/html/rfc4704" target="_top">RFC 4704</a>.
      It is important to keep in mind that kea-dhcp6 provides the initial
      decision making of when and what to update and forwards that
      information to D2 in the form of NCRs. Carrying out the actual
      DNS updates and dealing with such things as conflict resolution
      are the purview of D2 (<a class="xref" href="#dhcp-ddns-server" title="Chapter 10. The DHCP-DDNS Server">Chapter 10, <i>The DHCP-DDNS Server</i></a>).</p><p>
      This section describes when kea-dhcp6 will generate NCRs and the
      configuration parameters that can be used to influence this decision.
      It assumes that the "enable-updates" parameter is true.
      </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
        Currently the interface between kea-dhcp6 and D2 only supports requests
        which update DNS entries for a single IP address.  If a lease grants
        more than one address, kea-dhcp6 will create the DDNS update request for
        only the first of these addresses.  Support for multiple address
        mappings may be provided in a future release.
        </p></div><p>
      In general, kea-dhcp6 will generate DDNS update requests when:
      </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
      A new lease is granted in response to a DHCP REQUEST
      </p></li><li class="listitem"><p>
      An existing lease is renewed but the FQDN associated with it has
      changed.
      </p></li><li class="listitem"><p>
      An existing lease is released in response to a DHCP RELEASE
      </p></li></ol></div><p>
      In the second case, lease renewal, two  DDNS requests will be issued: one
      request to remove entries for the previous FQDN and a second request to
      add entries for the new FQDN.  In the last case, a lease release, a
      single DDNS request to remove its entries will be made.  The decision
      making involved when granting a new lease is more involved and is
      discussed next.
      </p><p>
      kea-dhcp6 will generate a DDNS update request only if the DHCP REQUEST
      contains the FQDN option (code 39). By default kea-dhcp6 will
      respect the FQDN N and S flags specified by the client as shown in the
      following table:
      </p><div class="table"><a name="dhcp6-fqdn-flag-table"></a><p class="title"><b>Table 8.3. Default FQDN Flag Behavior</b></p><div class="table-contents"><table summary="Default FQDN Flag Behavior" border="1"><colgroup><col align="left" class="cflags"><col align="left" class="meaning"><col align="left" class="response"><col align="left" class="sflags"></colgroup><thead><tr><th align="left">Client Flags:N-S</th><th align="left">Client Intent</th><th align="left">Server Response</th><th align="left">Server Flags:N-S-O</th></tr></thead><tbody><tr><td align="left">0-0</td><td align="left">
                Client wants to do forward updates, server should do reverse updates
                </td><td align="left">Server generates reverse-only request</td><td align="left">1-0-0</td></tr><tr><td align="left">0-1</td><td align="left">Server should do both forward and reverse updates</td><td align="left">Server generates request to update both directions</td><td align="left">0-1-0</td></tr><tr><td align="left">1-0</td><td align="left">Client wants no updates done</td><td align="left">Server does not generate a request</td><td align="left">1-0-0</td></tr></tbody></table></div></div><br class="table-break"><p>
      The first row in the table above represents "client delegation". Here
      the DHCP client states that it intends to do the forward DNS updates and
      the server should do the reverse updates.  By default, kea-dhcp6 will honor
      the client's wishes and generate a DDNS request to D2 to update only
      reverse DNS data.  The parameter, "override-client-update", can be used
      to instruct the server to override client delegation requests.  When
      this parameter is true, kea-dhcp6 will disregard requests for client
      delegation and generate a DDNS request to update both forward and
      reverse DNS data.  In this case, the N-S-O flags in the server's
      response to the client will be 0-1-1 respectively.
      </p><p>
      (Note that the flag combination N=1, S=1 is prohibited according to
      RFC 4702. If such a combination is received from the client, the packet
      will be dropped by kea-dhcp6.)
      </p><p>
      To override client delegation, issue the following commands:
      </p><pre class="screen">
"Dhcp6": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"override-client-update": true</code></strong>,
        ...
    },
    ...
}
</pre><p>
      The third row in the table above describes the case in which the client
      requests that no DNS updates be done. The parameter, "override-no-update",
      can be used to instruct the server to disregard the client's wishes. When
      this parameter is true, kea-dhcp6 will generate DDNS update requests to
      kea-dhcp-ddns even if the client requests no updates be done.  The N-S-O
      flags in the server's response to the client will be 0-1-1.
      </p><p>
      To override client delegation, issue the following commands:
      </p><pre class="screen">
"Dhcp6": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"override-no-update": true</code></strong>,
        ...
    },
    ...
}
</pre></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="dhcpv6-fqdn-name-generation"></a>8.2.18.3. kea-dhcp6 name generation for DDNS update requests</h4></div></div></div><p>Each NameChangeRequest must of course include the fully qualified domain
      name whose DNS entries are to be affected.  kea-dhcp6 can be configured to
      supply a portion or all of that name based upon what it receives from
      the client in the DHCP REQUEST.</p><p>The rules for determining the FQDN option are as follows:
      </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
      If configured to do so ignore the REQUEST contents and generate a
      FQDN using a configurable prefix and suffix.
      </p></li><li class="listitem"><p>
      Otherwise, using the domain name value from the client FQDN option as
      the candidate name:
      </p><div class="orderedlist"><ol class="orderedlist" type="a"><li class="listitem"><p>
      If the candidate name is a fully qualified domain name then use it.
      </p></li><li class="listitem"><p>
      If the candidate name is a partial (i.e. unqualified) name then
      add a configurable suffix to the name and use the result as the FQDN.
      </p></li><li class="listitem"><p>
      If the candidate name is a empty then generate a FQDN using a
      configurable prefix and suffix.
      </p></li></ol></div><p>
      </p></li></ol></div><p>
      To instruct kea-dhcp6 to always generate a FQDN, set the parameter
      "replace-client-name" to true:
      </p><pre class="screen">
"Dhcp6": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"replace-client-name": true</code></strong>,
        ...
    },
    ...
}
</pre><p>
      The prefix used when generating a FQDN is specified by the
      "generated-prefix" parameter.  The default value is "myhost".  To alter
      its value, simply set it to the desired string:
      </p><pre class="screen">
"Dhcp6": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"generated-prefix": "another.host"</code></strong>,
        ...
    },
    ...
}
</pre><p>
      The suffix used when generating a FQDN or when qualifying a
      partial name is specified by
      the <span class="command"><strong>qualifying-suffix</strong></span> parameter. This
      parameter has no default value, thus it is mandatory when
      DDNS updates are enabled.
      To set its value simply set it to the desired string:
      </p><pre class="screen">
"Dhcp6": {
    "dhcp-ddns": {
        <strong class="userinput"><code>"qualifying-suffix": "foo.example.org"</code></strong>,
        ...
    },
    ...
}
</pre></div><p>
      When qualifying a partial name, kea-dhcp6 will construct a name with the
      format:
      </p><p>
        [candidate-name].[qualifying-suffix].
      </p><p>
      where candidate-name is the partial name supplied in the REQUEST.
      For example, if FQDN domain name value was "some-computer" and
      qualifying-suffix "example.com", the generated FQDN would be:
      </p><p>
        some-computer.example.com.
      </p><p>
      When generating the entire name, kea-dhcp6 will construct name of the
      format:
      </p><p>
        [generated-prefix]-[address-text].[qualifying-suffix].
      </p><p>
      where address-text is simply the lease IP address converted to a
      hyphenated string.  For example, if lease address is 3001:1::70E,
      the qualifying suffix "example.com", and the default value is used for
      <span class="command"><strong>generated-prefix</strong></span>, the generated FQDN would be:
      </p><p>
        myhost-3001-1--70E.example.com.
      </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="host-reservation-v6"></a>8.3. Host reservation in DHCPv6</h2></div></div></div><p>There are many cases where it is useful to provide a configuration on
    a per host basis. The most obvious one is to reserve specific, static IPv6
    address or/and prefix for exclusive use by a given client (host) ‐ returning
    client will get the same address or/and prefix every time and other clients will
    never get that address. Note that there may be cases when the
    new reservation has been made for the client for the address or prefix being
    currently in use by another client. We call this situation a "conflict". The
    conflicts get resolved automatically over time as described in the subsequent
    sections. Once conflict is resolved, the client will keep receiving the reserved
    configuration when it renews.</p><p>Another example when the host reservations are applicable is when a host
    that has specific requirements, e.g. a printer that needs additional DHCP options
    or a cable modem needs specific parameters. Yet another possible use case for
    host reservation is to define unique names for hosts.  Although not all of
    the presented use cases are implemented yet, Kea software will support them
    in the near future.</p><p>Hosts reservations are defined as parameters for each subnet. Each host
    can be identified by either DUID or its hardware/MAC address. See
    <a class="xref" href="#mac-in-dhcpv6" title="8.9. MAC/Hardware addresses in DHCPv6">Section 8.9, “MAC/Hardware addresses in DHCPv6”</a> for details. There is an optional
    <span class="command"><strong>reservations</strong></span> array in the
    <span class="command"><strong>Subnet6</strong></span> structure. Each element in that array
    is a structure, that holds information about a single host. In
    particular, such a structure has to have an identifier that
    uniquely identifies a host.  In DHCPv6 context, such an identifier
    is a hardware (MAC) address or a DUID.  Also, either one or more
    addresses or prefixes should be specified. It is possible to
    specify a hostname. Additional capabilities are planned.</p><p>The following example shows how to reserve addresses and prefixes
    for specific hosts:

</p><pre class="screen">
"subnet6": [
    {
        "subnet": "2001:db8:1::/48",
        "pools": [ { "pool": "2001:db8:1::/80" } ],
        "pd-pools": [
            {
                "prefix": "2001:db8:1:8000::",
                "prefix-len": 56,
                "delegated-len": 64
            }
        ],
        <strong class="userinput"><code>"reservations": [
            {
                "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
                "ip-addresses": [ "2001:db8:1::100" ]
            },
            {
                "hw-address": "00:01:02:03:04:05",
                "ip-addresses": [ "2001:db8:1::101" ]
            },
            {
                "duid": "01:02:03:04:05:06:07:08:09:0A",
                "ip-addresses": [ "2001:db8:1::102" ],
                "prefixes": [ "2001:db8:2:abcd::/64" ],
                "hostname": "foo.example.com"
            }
        ]</code></strong>
    }
]
</pre><p>
    This example makes 3 reservations. The first one reserves 2001:db8:1::100 address
    for the client using DUID 01:02:03:04:05:0A:0B:0C:0D:0E. The second one
    also reserves an address, but does so using MAC or hardware address, rather than
    DUID. The third example is most advanced. It reserves an address, a prefix and
    a hostname at the same time.
    </p><p>Note that DHCPv6 allows for a single client to lease multiple addresses
    and multiple prefixes at the same time. In the upcoming Kea releases, it will
    be possible to have multiple addresses and prefixes reserved for a single
    host. Therefore <span class="command"><strong>ip-addresses</strong></span> and <span class="command"><strong>prefixes</strong></span>
    are plural and are actually arrays. As of 0.9.1 having more than one IPv6
    address or prefix is only partially supported.</p><p>Making a reservation for a mobile host that may visit multiple subnets
    requires a separate host definition in each subnet it is expected to visit.
    It is not allowed to define multiple host definitions with the same hardware
    address in a single subnet. It is a valid configuration, if such definitions
    are specified in different subnets, though. The reservation for a given host
    should include only one identifier, either DUID or hardware address. Defining
    both for the same host is considered a configuration error, but as of 0.9.1
    beta, it is not rejected.
    </p><p>Adding host reservation incurs a performance penalty. In principle,
    when the server that does not support host reservation responds to a query,
    it needs to check whether there is a lease for a given address being
    considered for allocation or renewal. The server that also supports host
    reservation, has to perform additional checks: not only if the address is
    currently used (if there is a lease for it), but also whether the address
    could be used by someone else (if there is a reservation for it). That
    additional check incurs performance penalty.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="reservation6-types"></a>8.3.1. Address/prefix reservation types</h3></div></div></div><p>In a typical scenario there's an IPv6 subnet defined with a certain
      part of it dedicated for dynamic address allocation by the DHCPv6
      server. There may be an additional address space defined for prefix
      delegation. Those dynamic parts are referred to as dynamic pools, address
      and prefix pools or simply pools. In principle, the host reservation can
      reserve any address or prefix that belongs to the subnet. The reservations
      that specify an address that belongs to configured pools are called
      <span class="command"><strong>in-pool reservations</strong></span>. In contrast, those that do not
      belong to dynamic pools are called <span class="command"><strong>out-of-pool
      reservations</strong></span>. There is no formal difference in the reservation
      syntax. As of 0.9.1, both reservation types are handled
      uniformly. However, upcoming releases may offer improved performance if
      there are only out-of-pool reservations as the server will be able to skip
      reservation checks when dealing with existing leases. Therefore, system
      administrators are encouraged to use out-of-pool reservations, if
      possible.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="reservation6-conflict"></a>8.3.2. Conflicts in DHCPv6 reservations</h3></div></div></div><p>As reservations and lease information are stored in different places,
      conflicts may arise. Consider the following series of events. The server
      has configured the dynamic pool of addresses from the range of 2001:db8::10
      to 2001:db8::20. Host A requests an address and gets 2001:db8::10. Now the
      system administrator decides to reserve an address for host B. He decides
      to reserve 2001:db8::10 for that purpose. In general, reserving an address
      that is currently assigned to someone else is not recommended, but there
      are valid use cases where such an operation is warranted.</p><p>The server now has a conflict to resolve. Let's analyze the
      situation here. If host B boots up and request an address, the server is
      not able to assign the reserved address 2001:db8::10. A naive approach
      would to be immediately remove the lease for host A and create a new one
      for host B. That would not solve the problem, though, because as soon as
      host B get the address, it will detect that the address is already in use
      by someone else (host A) and would send Decline. Therefore in this
      situation, the server has to temporarily assign a different address from the
      dynamic pool (not matching what has been reserved) to host B.</p><p>When the host A renews its address, the server will discover that
      the address being renewed is now reserved for someone else (host
      B). Therefore the server will remove the lease for 2001:db8::10 and select
      a new address and will create a new lease for it. It will send two
      addresses in its response: the old address with lifetimes set to 0 to
      explicitly indicate that it is no longer valid and a new address with
      non-zero lifetimes. When the host B renews its temporarily assigned
      address, the server will detect that the existing lease does not match
      reservation, so it will release the current address host B has and will
      create a new lease matching the reservation. Similar as before, the server
      will send two addresses: the temporarily assigned one with zeroed
      lifetimes, and the new one that matches reservation with proper lifetimes
      set.</p><p>This recovery will succeed, even if other hosts will attempt to get
      the reserved address. Had the host C requested address 2001:db8::10 after
      the reservation was made, the server will propose a different address.</p><p>This recovery mechanism allows the server to fully recover from a
      case where reservations conflict with existing leases. This procedure
      takes time and will roughly take as long as renew-timer value specified.
      The best way to avoid such recovery is to not define new reservations that
      conflict with existing leases. Another recommendation is to use
      out-of-pool reservations. If the reserved address does not belong to a
      pool, there is no way that other clients could get this address (note that
      having multiple reservations for the same address is not allowed).
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="reservation6-hostname"></a>8.3.3. Reserving a hostname</h3></div></div></div><p>When the reservation for the client includes the <span class="command"><strong>hostname
      </strong></span>, the server will assign this hostname to the client and send
      it back in the Client FQDN, if the client sent the FQDN option to the
      server. The reserved hostname always takes precedence over the hostname
       supplied by the client (via the FQDN option) or the autogenerated
      (from the IPv6 address) hostname.</p><p>The server qualifies the reserved hostname with the value
      of the <span class="command"><strong>qualifying-suffix</strong></span> parameter. For example, the
      following subnet configuration:
</p><pre class="screen">
"subnet6": [
    {
        "subnet": "2001:db8:1::/48",
        "pools": [ { "pool": "2001:db8:1::/80" } ],
        "reservations": [
            {
                "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
                "ip-addresses": [ "2001:db8:1::100" ]
                "hostname": "alice-laptop"
            }
        ]
    }
],
"dhcp-ddns": {
    "enable-updates": true,
    "qualifying-suffix": "example.isc.org."
}
</pre><p>
      will result in assigning the "alice-laptop.example.isc.org." hostname to the
      client using the DUID "01:02:03:04:05:0A:0B:0C:0D:0E". If the <span class="command"><strong>qualifying-suffix
      </strong></span> is not specified, the default (empty) value will be used, and
      in this case the value specified as a <span class="command"><strong>hostname</strong></span> will
      be treated as fully qualified name.  Thus, by leaving the
      <span class="command"><strong>qualifying-suffix</strong></span> empty it is possible to qualify
      hostnames for the different clients with different domain names:
</p><pre class="screen">
"subnet6": [
    {
        "subnet": "2001:db8:1::/48",
        "pools": [ { "pool": "2001:db8:1::/80" } ],
        "reservations": [
            {
                "duid": "01:02:03:04:05:0A:0B:0C:0D:0E",
                "ip-addresses": [ "2001:db8:1::100" ]
                "hostname": "mark-desktop.example.org."
            }
        ]
    }
],
"dhcp-ddns": {
    "enable-updates": true,
}
</pre><p>
      will result in assigning the "mark-desktop.example.org." hostname to the
      client using the DUID "01:02:03:04:05:0A:0B:0C:0D:0E".
    </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="reservation6-options"></a>8.3.4. Reserving specific options</h3></div></div></div><p>Currently it is not possible to specify options in host
      reservation. Such a feature will be added in the upcoming Kea
      releases.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="reservation6-mode"></a>8.3.5. Fine Tuning IPv6 Host Reservation</h3></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p><span class="command"><strong>reservation-mode</strong></span> in the DHCPv6 server is
        implemented in Kea 0.9.1 beta, but has not been tested and is
        considered experimental.</p></div><p>Host reservation capability introduces additional restrictions for the
      allocation engine during lease selection and renewal. In particular, three
      major checks are necessary. First, when selecting a new lease, it is not
      sufficient for a candidate lease to be not used by another DHCP client. It
      also must not be reserved for another client. Second, when renewing a lease,
      additional check must be performed whether the address being renewed is not
      reserved for another client. Finally, when a host renews an address or a
      prefix, the server has to check whether there's a reservation for this host,
      so the existing (dynamically allocated) address should be revoked and the
      reserved one be used instead.</p><p>Some of those checks may be unnecessary in certain deployments. Not
      performing them may improve performance. The Kea server provides the
      <span class="command"><strong>reservation-mode</strong></span> configuration parameter to select the
      types of reservations allowed for the particular subnet. Each reservation
      type has different constraints for the checks to be performed by the
      server when allocating or renewing a lease for the client.
      Allowed values are:

      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> <span class="command"><strong>all</strong></span> - enables all host reservation
      types. This is the default value. This setting is the safest and the most
      flexible. It allows in-pool and out-of-pool reservations. As all checks
      are conducted, it is also the slowest.
      </li><li class="listitem"> <span class="command"><strong>out-of-pool</strong></span> - allows only out of
      pool host reservations.  With this setting in place, the server may assume
      that all host reservations are for addresses that do not belong to the
      dynamic pool. Therefore it can skip the reservation checks when dealing
      with in-pool addresses, thus improving performance. Do not use this mode
      if any of your reservations use in-pool address. Caution is advised when
      using this setting. Kea 0.9.1 does not sanity check the reservations against
      <span class="command"><strong>reservation-mode</strong></span>. Misconfiguration may cause problems.
      </li><li class="listitem">
      <span class="command"><strong>disabled</strong></span> - host reservation support is disabled. As there
      are no reservations, the server will skip all checks. Any reservations defined
      will be completely ignored. As the checks are skipped, the server may
      operate faster in this mode.
      </li></ul></div><p>
      </p><p>
        An example configuration that disables reservation looks like follows:
        </p><pre class="screen">
"Dhcp6": {
    "subnet6": [
        {
        "subnet": "2001:db8:1::/64",
        <strong class="userinput"><code>"reservation-mode": "disabled"</code></strong>,
        ...
        }
    ]
}
</pre><p>
      </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp6-serverid"></a>8.4. Server Identifier in DHCPv6</h2></div></div></div><p>The DHCPv6 protocol uses a "server identifier" (also known
      as a DUID) for clients to be able to discriminate between several
      servers present on the same link.
      <a class="ulink" href="http://tools.ietf.org/html/rfc3315" target="_top">RFC 3315</a>
      defines three DUID types: DUID-LLT, DUID-EN and DUID-LL.
      <a class="ulink" href="http://tools.ietf.org/html/rfc6355" target="_top">RFC 6355</a>
      also defines DUID-UUID. Future specifications may introduce new
      DUID types.</p><p>Kea DHCPv6 server generates a server identifier once, upon
      the first startup, and stores it in a file. This identifier isn't
      modified across restarts of the server (stable identifier).</p><p>Kea follows recommendation from
      <a class="ulink" href="http://tools.ietf.org/html/rfc3315" target="_top">RFC 3315</a>
      to use DUID-LLT as a default server identifier. However, we have
      received reports that some deployments require different DUID
      types, and there is a need to administratively select both DUID
      type and/or its contents.</p><p>The server identifier can be configured using parameters
      within the <span class="command"><strong>server-id</strong></span> map element in the global
      scope of the Kea configuration file. The following example
      demonstrates how to select DUID-EN as a server identifier:

</p><pre class="screen">
"Dhcp6": {
    "server-id": {
        "type": "EN"
    },
    ...
}
</pre><p>

      </p><p>Currently supported values for <span class="command"><strong>type</strong></span>
      parameter are: "LLT", "EN" and "LL", for DUID-LLT, DUID-EN and
      DUID-LL respectively.</p><p>When a new DUID type is selected the server will generate its
      value and replace any existing DUID in the file. The server will
      use the new server identifier in all future interactions with the
      clients.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>If the new server identifier is created after some clients
      have obtained their leases, the clients using old identifier will not
      be able to renew the leases. The server will ignore messages
      containing the old server identifier. Clients will continue sending
      Renew until they transition to rebinding state. In this state they
      will start sending Rebind messages to multicast address and without
      a server identifier. The server will respond to the Rebind messages
      with a new server identifier and the clients will associate the
      new server identifier with their leases. Although the clients will
      be able to keep their leases and will eventually learn the new server
      identifier, this will be at the cost of increased number of renewals
      and multicast traffic due to a need to rebind. Therefore it is
      recommended to avoid modification of the server identifier type
      and its value if the server has already assigned leases and these
      leases are still valid.</p></div><p>There are cases when an administrator needs to explicitly
      specify a DUID value, rather than allow the server to generate it.
      The following example demonstrates how to explicitly set all
      components of a DUID-LLT.

</p><pre class="screen">
"Dhcp6": {
    "server-id": {
        "type": "LLT",
        "htype": 8,
        "identifier": "A65DC7410F05",
        "time": 2518920166
    },
    ...
}
</pre><p>

      where:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="command"><strong>htype</strong></span> is a 16-bit unsigned value
        specifying hardware type,</li><li class="listitem"><span class="command"><strong>identifier</strong></span> is a link layer
        address, specified as a string of hexadecimal digits,</li><li class="listitem"><span class="command"><strong>time</strong></span> is a 32-bit unsigned
        time value.</li></ul></div><p>
      </p><p>The hexadecimal representation of the DUID generated as a result
      of the configuration specified above will be:
</p><pre class="screen">
00:01:00:08:96:23:AB:E6:A6:5D:C7:41:0F:05
------------------------------------------
|type|htype|   time    |   identifier    |
</pre><p>
      </p><p>It is allowed to use special value of 0 for "htype" and "time",
      which indicates that the server should use ANY value for these
      components. If the server already uses a DUID-LLT it will use the
      values from this DUID. If the server uses a DUID of a different type
      or doesn't use any DUID yet, it will generate these values.
      Similarly, if the "identifier" is assigned an empty string, the
      value of the identifier will be generated. Omitting any of these
      parameters is equivalent to setting them to those special values.
      </p><p>For example, the following configuration:
</p><pre class="screen">
"Dhcp6": {
    "server-id": {
        "type": "LLT",
        "htype": 0,
        "identifier": "",
        "time": 2518920166
    },
    ...
}
</pre><p>

      indicates that the server should use ANY link layer address and
      hardware type. If the server is already using DUID-LLT it will
      use link layer address and hardware type from the existing DUID.
      If the server is not using any DUID yet, it will use link layer
      address and hardware type from one of the available network
      interfaces. The server will use explicit value of time. If it
      is different than a time value present in the currently used
      DUID, this value will be replaced. This will effectively cause
      modification of the current server identifier.
      </p><p>
        The following example demonstrates an explicit configuration of
        a DUID-EN:

</p><pre class="screen">
"Dhcp6": {
    "server-id": {
        "type": "EN",
        "enterprise-id": 2495,
        "identifier": "87ABEF7A5BB545"
    },
    ...
}
</pre><p>

      where:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="command"><strong>enterprise-id</strong></span> is a 32-bit
        unsigned value holding enterprise number,</li><li class="listitem"><span class="command"><strong>identifier</strong></span> is a variable
        length identifier within DUID-EN.</li></ul></div><p>
      </p><p>
        The hexadecimal representation of the DUID-EN created according to
        the configuration above is:
</p><pre class="screen">
00:02:00:00:09:BF:87:AB:EF:7A:5B:B5:45
--------------------------------------
|type|  ent-id   |    identifier     |
</pre><p>
      </p><p>As in the case of the DUID-LLT, special values can be used for the
      configuration of the DUID-EN. If the "enterprise-id" is 0, the server
      will use a value from the existing DUID-EN. If the server is not using
      any DUID or the existing DUID has a different type, the ISC enterprise
      id will be used. When an empty string is used for "identifier", the
      identifier from the existing DUID-EN will be used. If the server is
      not using any DUID-EN the new 6-bytes long identifier will be generated.
      </p><p>DUID-LL is configured in the same way as DUID-LLT with an exception
      that the <span class="command"><strong>time</strong></span> parameter has no effect for DUID-LL,
      because this DUID type only comprises a hardware type and link layer
      address. The following example demonstrates how to configure DUID-LL:

</p><pre class="screen">
"Dhcp6": {
    "server-id": {
        "type": "LL",
        "htype": 8,
        "identifier": "A65DC7410F05"
    },
    ...
}
</pre><p>

      </p><p>
      which will result in the following server identifier:

</p><pre class="screen">
00:03:00:08:A6:5D:C7:41:0F:05
------------------------------
|type|htype|   identifier   |
</pre><p>
      </p><p>Server stores a generated server identifier in the following
      location: <strong class="userinput"><code>[kea-install-dir]/var/kea/kea-dhcp6-serverid
      </code></strong>.
      </p><p>In some uncommon deployments where no stable storage is
      available, it is desired to configure the server to not try to
      store the server identifier on the stable storage. It is controlled
      by the value of <span class="command"><strong>persist</strong></span> boolean parameter:
</p><pre class="screen">
"Dhcp6": {
    "server-id": {
        "type": "EN",
        "enterprise-id": 2495,
        "identifier": "87ABEF7A5BB545",
        "persist": false
    },
    ...
}
</pre><p>
      </p><p>The default value of the "persist" parameter is
      <span class="command"><strong>true</strong></span> which configures the server to store the
      server identifier on a disk.</p><p>In the example above, the server is configured to not store
      the generated server identifier on a disk. But, if the server
      identifier is not modified in the configuration the same value
      will be used after server restart, because entire server
      identifier is explicitly specified in a configuration.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="stateless-dhcp6"></a>8.5. Stateless DHCPv6 (Information-Request Message)</h2></div></div></div><p>Typically DHCPv6 is used to assign both addresses and options. These
      assignments (leases) have state that changes over time, hence
      their name, stateful. DHCPv6 also supports a stateless mode,
      where clients request configuration options only. This mode is
      considered lightweight from the server perspective, as it does not require
      any state tracking; hence its name.</p><p>The Kea server supports stateless mode. Clients can send
      Information-Request messages and the server will send back
      answers with the requested options (providing the options are
      available in the server configuration).  The server will attempt to
      use per-subnet options first. If that fails - for whatever reason - it
      will then try to provide options defined in the global scope.</p><p>Stateless and stateful mode can be used together. No special
      configuration directives are required to handle this. Simply use the
      configuration for stateful clients and the stateless clients will get
      just options they requested.</p><p>This usage of global options allows for an interesting case.
      It is possible to run a server that provides just options and no
      addresses or prefixes. If the options have the same value in each
      subnet, the configuration can define required options in the global
      scope and skip subnet definitions altogether. Here's a simple example of
      such a configuration:
</p><pre class="screen">
"Dhcp6": {
    "interfaces-config": {
        "interfaces": [ "ethX" ]
    },
    <strong class="userinput"><code>"option-data": [ {
        "name": "dns-servers",
        "data": "2001:db8::1, 2001:db8::2"
    } ]</code></strong>,
    "lease-database": { "type": "memfile" }
 }
</pre><p>
      This very simple configuration will provide DNS server information
      to all clients in the network, regardless of their location. Note the
      specification of the memfile lease database: this is required since,
      as of version 0.9.1, Kea requires a lease database to be specified
      even if it is not used.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp6-rfc7550"></a>8.6. Support for RFC 7550</h2></div></div></div><p>The <a class="ulink" href="http://tools.ietf.org/html/rfc7550" target="_top">RFC 7550</a>
      has introduced some changes to the DHCPv6 protocol to resolve a few issues
      with the coexistence of multiple stateful options in the messages sent
      between the clients and servers.</p><p>The typical example is when the client, such as a requesting
      router, requests an allocation of both addresses and prefixes when
      it performs the 4-way (SARR) exchange with the server. If the
      server is not configured to allocate any prefixes but it can allocate
      some addresses, it will respond with the IA_NA(s) containing allocated
      addresses and the IA_PD(s) containing the NoPrefixAvail status code. If
      the client can operate without prefixes it may transition to the
      'bound' state when it sends Renew/Rebind messages to the server,
      according to the T1 and T2 times, to extend the lifetimes of the
      allocated addresses. If the client is still interested in obtaining
      prefixes from the server it may also include IA_PD in the Renew/Rebind
      to request allocation of the prefixes. If the server still cannot
      allocate the prefixes, it will respond with the IA_PD(s) containing
      NoPrefixAvail status code. However, if the server can now allocate
      the prefixes it will do so, and send them in the IA_PD(s) to the client.
      Allocation of leases during the Renew/Rebind was not supported in the
      <a class="ulink" href="http://tools.ietf.org/html/rfc3315" target="_top">RFC 3315</a>
      and <a class="ulink" href="http://tools.ietf.org/html/rfc3633" target="_top">RFC 3633</a>,
      and has been introduced in
      <a class="ulink" href="http://tools.ietf.org/html/rfc7550" target="_top">RFC 7550</a>.
      Kea supports this new behavior and it doesn't provide any configuration
      mechanisms to disable it.
      </p><p>
        The following are the other behaviors specified in the
        <a class="ulink" href="http://tools.ietf.org/html/rfc7550" target="_top">RFC 7550</a>
        supported by the Kea DHCPv6 server:
        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">set T1/T2 timers to the same value for all
          stateful (IA_NA and IA_PD) options to facilitate renewal of all
          client's leases at the same time (in a single message exchange),
          </li><li class="listitem">NoAddrsAvail and NoPrefixAvail status codes
          are placed in the IA_NA and IA_PD options in the Advertise message,
          rather than as the top level options.</li></ul></div><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp6-relay-override"></a>8.7. Using specific relay agent for a subnet</h2></div></div></div><p>
        The relay has to have an interface connected to the link on which
        the clients are being configured. Typically the relay has a global IPv6
        address configured on the interface that belongs to the subnet from which
        the server will assign addresses. In the typical case, the
        server is able to use the IPv6 address inserted by the relay (in the link-addr
        field in RELAY-FORW message) to select the appropriate subnet.
      </p><p>
        However, that is not always the case. The relay
        address may not match the subnet in certain deployments. This
        usually means that there is more than one subnet allocated for a given
        link. The two most common examples where this is the case are long lasting
        network renumbering (where both old and new address space is still being
        used) and a cable network. In a cable network both cable modems and the
        devices behind them are physically connected to the same link, yet
        they use distinct addressing. In such case, the DHCPv6 server needs
        additional information (like the value of interface-id option or IPv6
        address inserted in the link-addr field in RELAY-FORW message) to
        properly select an appropriate subnet.
      </p><p>
        The following example assumes that there is a subnet 2001:db8:1::/64
        that is accessible via relay that uses 3000::1 as its IPv6 address.
        The server will be able to select this subnet for any incoming packets
        that came from a relay that has an address in 2001:db8:1::/64 subnet.
        It will also select that subnet for a relay with address 3000::1.
        </p><pre class="screen">
"Dhcp6": {
    "subnet6": [
        {
            "subnet": "2001:db8:1::/64",
            "pools": [
                 {
                     "pool": "2001:db8:1::1-2001:db8:1::ffff"
                 }
             ],
             <strong class="userinput"><code>"relay": {
                 "ip-address": "3000::1"
             }</code></strong>
        }
    ]
}
</pre><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp6-client-class-relay"></a>8.8. Segregating IPv6 clients in a cable network</h2></div></div></div><p>
          In certain cases, it is useful to mix relay address information,
          introduced in <a class="xref" href="#dhcp6-relay-override" title="8.7. Using specific relay agent for a subnet">Section 8.7, “Using specific relay agent for a subnet”</a> with client
          classification, explained in <a class="xref" href="#classify" title="Chapter 12. Client Classification">Chapter 12, <i>Client Classification</i></a>.
          One specific example is a cable network, where typically modems
          get addresses from a different subnet than all devices connected
          behind them.
        </p><p>
          Let's assume that there is one CMTS (Cable Modem Termination System)
          with one CM MAC (a physical link that modems are connected to).
          We want the modems to get addresses from the 3000::/64 subnet,
          while everything connected behind modems should get addresses from
          another subnet (2001:db8:1::/64). The CMTS that acts as a relay
          an uses address 3000::1. The following configuration can serve
          that configuration:
        </p><pre class="screen">
"Dhcp6": {
    "subnet6": [
        {
            "subnet": "3000::/64",
            "pools": [
                { "pool": "3000::2 - 3000::ffff" }
            ],
            <strong class="userinput"><code>"client-class": "VENDOR_CLASS_docsis3.0",
            "relay": {
                "ip-address": "3000::1"
            }</code></strong>
        },

        {
            "subnet": "2001:db8:1::/64",
            "pools": [
                 {
                     "pool": "2001:db8:1::1-2001:db8:1::ffff"
                 }
             ],
             <strong class="userinput"><code>"relay": {
                 "ip-address": "3000::1"
             }</code></strong>
        }
    ]
}
</pre><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="mac-in-dhcpv6"></a>8.9. MAC/Hardware addresses in DHCPv6</h2></div></div></div><p>MAC/hardware addresses are available in DHCPv4 messages
      from the clients and administrators
      frequently use that information to perform certain tasks, like per host
      configuration, address reservation for specific MAC addresses and other.
      Unfortunately, the DHCPv6 protocol does not provide any completely reliable way
      to retrieve that information. To mitigate that issue a number of mechanisms
      have been implemented in Kea that attempt to gather that information. Each
      of those mechanisms works in certain cases, but may fail in other cases.
      Whether the mechanism works or not in the particular deployment is
      somewhat dependent on the network topology and the technologies used.</p><p>Kea allows for configuration which of the supported methods should be
      used and in which order. This configuration may be considered a fine tuning
      of the DHCP deployment. In a typical deployment the default
      value of <span class="command"><strong>"any"</strong></span> is sufficient and there is no
      need to select specific methods. Changing the value of this parameter
      is the most useful in cases when an administrator wants to disable
      certain method, e.g. if the administrator trusts the network infrastructure
      more than the information provided by the clients themselves, the
      administrator may prefer information provided by the relays over that
      provided by the clients. The format of this parameter is as follows:
        </p><pre class="screen">
"Dhcp6": {
    <strong class="userinput"><code>"mac-sources": [ "method1", "method2", "method3", ... ]</code></strong>,

    "subnet6": [ ... ],

    ...
}
</pre><p>

    When not specified, a special value of <span class="emphasis"><em>any</em></span> is used, which
    instructs the server to attempt to use all the methods in sequence and use
    value returned by the first one that succeeds.</p><p>Supported methods are:
    </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="command"><strong>any</strong></span> - not an actual method, just a keyword that
        instructs Kea to try all other methods and use the first one that succeeds.
        This is the default operation if no <span class="command"><strong>mac-sources</strong></span> are defined.
        </li><li class="listitem"><span class="command"><strong>raw</strong></span> - In principle, a DHCPv6 server could use raw
        sockets to receive incoming traffic and extract MAC/hardware address
        information. This is currently not implemented for DHCPv6 and this value has
        no effect.
        </li><li class="listitem"><span class="command"><strong>duid</strong></span> - DHCPv6 uses DUID identifiers instead of
        MAC addresses. There are currently four DUID types defined, with two of them
        (DUID-LLT, which is the default one and DUID-LL) convey MAC address information.
        Although RFC 3315 forbids it, it is possible to parse those DUIDs and extract
        necessary information from them. This method is not completely reliable, as
        clients may use other DUID types, namely DUID-EN or DUID-UUID.
        </li><li class="listitem"><span class="command"><strong>ipv6-link-local</strong></span> - Another possible acquisition
        method comes from the source IPv6 address. In typical usage, clients are
        sending their packets from IPv6 link-local addresses. There's a good chance
        that those addresses are based on EUI-64, which contains MAC address. This
        method is not completely reliable, as clients may use other link-local address
        types.  In particular, privacy extensions, defined in RFC 4941, do not use
        MAC addresses.  Also note that successful extraction requires that the
        address's u-bit must be set to 1 and its g-bit set to 0, indicating that it
        is an interface identifier as per
        <a class="ulink" href="http://tools.ietf.org/html/rfc2373#section-2.5.1" target="_top">
        RFC 2373, section 2.5.1</a>.
        </li><li class="listitem"><span class="command"><strong>client-link-addr-option</strong></span> - One extension defined
        to alleviate missing MAC issues is client link-layer address option, defined
        in <a class="ulink" href="http://tools.ietf.org/html/rfc6939" target="_top">RFC 6939</a>. This is
        an option that is inserted by a relay and contains information about client's
        MAC address. This method requires a relay agent that supports the option and
        is configured to insert it. This method is useless for directly connected
        clients. This parameter can also be specified as <span class="command"><strong>rfc6939</strong></span>,
        which is an alias for <span class="command"><strong>client-link-addr-option</strong></span>.
        </li><li class="listitem"><span class="command"><strong>remote-id</strong></span> - <a class="ulink" href="http://tools.ietf.org/html/rfc4649" target="_top">RFC 4649</a>
        defines remote-id option that is inserted by a relay agent. Depending
        on the relay agent configuration, the inserted option may convey client's
        MAC address information. This parameter can also be specified as
        <span class="command"><strong>rfc4649</strong></span>, which is an alias for <span class="command"><strong>remote-id</strong></span>.
        </li><li class="listitem"><span class="command"><strong>subscriber-id</strong></span> - Another option
        that is somewhat similar to the previous one is subscriber-id,
        defined in <a class="ulink" href="http://tools.ietf.org/html/rfc4580" target="_top">RFC
        4580</a>. It is, too, inserted by a relay agent that is
        configured to insert it. This parameter can also be specified
        as <span class="command"><strong>rfc4580</strong></span>, which is an alias for
        <span class="command"><strong>subscriber-id</strong></span>. This method is currently not
        implemented.
        </li><li class="listitem"><span class="command"><strong>docsis-cmts</strong></span> - Yet another possible source of MAC
        address information are DOCSIS options inserted by a CMTS that acts
        as a DHCPv6 relay agent in cable networks. This method attempts to extract
        MAC address information from suboption 1026 (cm mac) of the vendor specific option
        with vendor-id=4491. This vendor option is extracted from the relay-forward message,
        not the original client's message.
        </li><li class="listitem"><span class="command"><strong>docsis-modem</strong></span> - Yet another possible source of MAC
        address information are DOCSIS options inserted by the cable modem itself.
        This method attempts to extract MAC address information from suboption 36 (device id)
        of the vendor specific option with vendor-id=4491. This vendor option is extracted from
        the original client's message, not from any relay options.
        </li></ul></div><p>
    </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp6-decline"></a>8.10. Duplicate Addresses (DECLINE support)</h2></div></div></div><p>The DHCPv6 server is configured with a certain pool of
      addresses that it is expected to hand out to the DHCPv6 clients.
      It is assumed that the server is authoritative and has complete
      jurisdiction over those addresses. However, due to various
      reasons, such as misconfiguration or a faulty client implementation
      that retains its address beyond the valid lifetime, there may be
      devices connected that use those addresses without the server's
      approval or knowledge.</p><p>Such an unwelcome event can be detected
      by legitimate clients (using Duplicate Address Detection) and
      reported to the DHCPv6 server using a DECLINE message. The server
      will do a sanity check (if the client declining an address really
      was supposed to use it), then will a conduct clean up operation
      and confirm it by sending back a REPLY message. Any DNS entries
      related to that address will be removed, the fact will be logged
      and hooks will be triggered. After that is done, the address
      will be marked as declined (which indicates that it is used by
      an unknown entity and thus not available for assignment to
      anyone) and a probation time will be set on it. Unless otherwise
      configured, the probation period lasts 24 hours. After that
      period, the server will recover the lease, i.e. put it back into
      the available state. The address will be available for assignment
      again. It should be noted that if the underlying issue of a
      misconfigured device is not resolved, the duplicate address
      scenario will repeat. On the other hand, it provides an
      opportunity to recover from such an event automatically, without
      any sysadmin intervention.</p><p>To configure the decline probation period to a value different
      than the default, the following syntax can be used:
</p><pre class="screen">
  "Dhcp6": {
    <strong class="userinput"><code>"decline-probation-period": 3600</code></strong>,
    "subnet6": [ ... ],
    ...
}
</pre><p>
      The parameter is expressed in seconds, so the example above will instruct
      the server to recycle declined leases after an hour.</p><p>There are several statistics and hook points associated with the
      Decline handling procedure. The lease6_decline hook is triggered after the
      incoming Decline message has been sanitized and the server is about to decline
      the lease. The declined-addresses statistic is increased after the hook
      returns (both global and subnet specific variants).</p><p>Once the probation time elapses, the declined lease is recovered
      using the standard expired lease reclamation procedure, with several
      additional steps. In particular, both declined-addresses statistics
      (global and subnet specific) are decreased. At the same time,
      reclaimed-declined-addresses statistics (again in two variants, global and
      subnet specific) are increased.</p><p>Note about statistics: The server does not decrease
      assigned-addresses statistics when a DECLINE message is received and
      processed successfully. While technically a declined address is no longer
      assigned, the primary usage of the assigned-addresses statistic is to
      monitor pool utilization. Most people would forget to include
      declined-addresses in the calculation, and simply do
      assigned-addresses/total-addresses. This would have a bias towards
      under-representing pool utilization. As this has a potential for major
      issues, we decided not to decrease assigned addresses immediately after
      receiving Decline, but to do it later when we recover the address back to
      the available pool.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp6-stats"></a>8.11. Statistics in DHCPv6 server</h2></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This section describes DHCPv6-specific statistics. For a general
        overview and usage of statistics, see <a class="xref" href="#stats" title="Chapter 14. Statistics">Chapter 14, <i>Statistics</i></a>.</p></div><p>
        The DHCPv6 server supports the following statistics:
      </p><div class="table"><a name="dhcp6-statistics"></a><p class="title"><b>Table 8.4. DHCPv6 Statistics</b></p><div class="table-contents"><table summary="DHCPv6 Statistics" border="1"><colgroup><col align="center" class="statistic"><col align="center" class="type"><col align="left" class="description"></colgroup><thead><tr><th align="center">Statistic</th><th align="center">Data Type</th><th align="left">Description</th></tr></thead><tbody><tr><td align="center">pkt6-received</td><td align="center">integer</td><td align="left">Number of DHCPv6 packets received. This includes all packets:
              valid, bogus, corrupted, rejected etc. This statistic is expected
              to grow rapidly.</td></tr><tr><td align="center">pkt6-receive-drop</td><td align="center">integer</td><td align="left">Number of incoming packets that were dropped. Exact reason
              for dropping packets is logged, but the most common reasons may
              be: an unacceptable or not supported packet type, direct responses
              are forbidden, the server-id sent by the client does not match the
              server's server-id or the packet is malformed.</td></tr><tr><td align="center">pkt6-parse-failed</td><td align="center">integer</td><td align="left">Number of incoming packets that could not be parsed.
              A non-zero value of this statistic indicates that the server
              received a malformed or truncated packet. This may indicate problems
              in your network, faulty clients, faulty relay agents or server
              code bug.</td></tr><tr><td align="center">pkt6-solicit-received</td><td align="center">integer</td><td align="left">
                Number of SOLICIT packets received. This statistic is expected
                to grow.  Its increase means that clients that just booted
                started their configuration process and their initial packets
                reached your server.
              </td></tr><tr><td align="center">pkt6-advertise-received</td><td align="center">integer</td><td align="left">
                Number of ADVERTISE packets received. Advertise packets are sent
                by the server and the server is never expected to receive them. A non-zero
                value of this statistic indicates an error occurring in the network.
                One likely cause would be a misbehaving relay agent that incorrectly
                forwards ADVERTISE messages towards the server, rather back to the
                clients.
              </td></tr><tr><td align="center">pkt6-request-received</td><td align="center">integer</td><td align="left">Number of REQUEST packets received. This statistic
                is expected to grow. Its increase means that clients that just booted
                received the server's response (ADVERTISE), accepted it and are now
                requesting an address (REQUEST).
              </td></tr><tr><td align="center">pkt6-reply-received</td><td align="center">integer</td><td align="left">Number of REPLY packets received. This statistic is
              expected to remain zero at all times, as REPLY packets are sent by
              the server and the server is never expected to receive
              them. A non-zero value indicates an error. One likely cause would be
              a misbehaving relay agent that incorrectly forwards REPLY messages
              towards the server, rather back to the clients.
              </td></tr><tr><td align="center">pkt6-renew-received</td><td align="center">integer</td><td align="left">Number of RENEW packets received. This statistic
                is expected to grow. Its increase means that clients received their
                addresses and prefixes and are trying to renew them.
              </td></tr><tr><td align="center">pkt6-rebind-received</td><td align="center">integer</td><td align="left">Number of REBIND packets received. A non-zero value
              indicates that clients didn't receive responses to their RENEW messages
              (regular lease renewal mechanism) and are attempting to find any server
              that is able to take over their leases. It may mean that some server's
              REPLY messages never reached the clients.
              </td></tr><tr><td align="center">pkt6-release-received</td><td align="center">integer</td><td align="left">Number of RELEASE packets received. This statistic is expected
              to grow when a device is being shut down in the network. It
              indicates that the address or prefix assigned is reported as no longer
              needed. Note that many devices, especially wireless, do not send RELEASE,
              because of design choice or due to moving out of range.
              </td></tr><tr><td align="center">pkt6-decline-received</td><td align="center">integer</td><td align="left">
              Number of DECLINE packets received. This statistic is expected to
              remain close to zero. Its increase means that a client leased an
              address, but discovered that the address is currently used by an
              unknown device in your network. If this statistic is growing, it
              may indicate misconfigured server or devices that have statically
              assigned conflicting addresses.
            </td></tr><tr><td align="center">pkt6-infrequest-received</td><td align="center">integer</td><td align="left">
                Number of INFORMATION-REQUEST packets received. This statistic
                is expected to grow if there are devices that are using
                stateless DHCPv6. INFORMATION-REQUEST messages are used by
                clients that request stateless configuration, i.e. options
                and parameters other than addresses or prefixes.
              </td></tr><tr><td align="center">pkt6-unknown-received</td><td align="center">integer</td><td align="left">Number of packets received of an unknown type. Non-zero
              value of this statistic indicates that the server received a
              packet that it wasn't able to recognize: either with unsupported
              type or possibly malformed.</td></tr><tr><td align="center">pkt6-sent</td><td align="center">integer</td><td align="left">Number of DHCPv6 packets sent. This statistic is expected
              to grow every time the server transmits a packet. In general, it
              should roughly match pkt6-received, as most incoming packets cause
              the server to respond. There are exceptions (e.g. server receiving a
              REQUEST with server-id matching other server), so do not worry, if
              it is lesser than pkt6-received.</td></tr><tr><td align="center">pkt6-advertise-sent</td><td align="center">integer</td><td align="left">Number of ADVERTISE packets sent. This statistic is
              expected to grow in most cases after a SOLICIT is processed. There
              are certain uncommon, but valid cases where incoming SOLICIT is
              dropped, but in general this statistic is expected to be close to
              pkt6-solicit-received.</td></tr><tr><td align="center">pkt6-reply-sent</td><td align="center">integer</td><td align="left">Number of REPLY packets sent. This statistic is expected to
              grow in most cases after a SOLICIT (with rapid-commit), REQUEST,
              RENEW, REBIND, RELEASE, DECLINE or INFORMATION-REQUEST is
              processed. There are certain cases where there is no response.
              </td></tr><tr><td align="center">subnet[id].total-nas</td><td align="center">integer</td><td align="left">
            This statistic shows the total number of NA addresses available for
            DHCPv6 management for a given subnet. In other words, this is the sum
            of all addresses in all configured pools. This statistic changes only
            during configuration changes. Note it does not take into account any
            addresses that may be reserved due to host reservation. The
            <span class="emphasis"><em>id</em></span> is the subnet-id of a given subnet. This
            statistic is exposed for each subnet separately. This statistic is
            reset during a reconfiguration event.
            </td></tr><tr><td align="center">subnet[id].assigned-nas</td><td align="center">integer</td><td align="left">
            This statistic shows the number of NA addresses in a given subnet that
            are assigned. This statistic increases every time a new lease is allocated
            (as a result of receiving a REQUEST message) and is decreased every time a
            lease is released (a RELEASE message is received) or expires. The
            <span class="emphasis"><em>id</em></span> is the subnet-id of a given subnet. This
            statistic is exposed for each subnet separately. This statistic is
            reset during a reconfiguration event.
            </td></tr><tr><td align="center">subnet[id].total-pds</td><td align="center">integer</td><td align="left">
            This statistic shows the total number of PD prefixes available for
            DHCPv6 management for a given subnet. In other words, this is the sum
            of all prefixes in all configured pools. This statistic changes only
            during configuration changes. Note it does not take into account any
            prefixes that may be reserved due to host reservation. The
            <span class="emphasis"><em>id</em></span> is the subnet-id of a given subnet. This
            statistic is exposed for each subnet separately. This statistic is
            reset during a reconfiguration event.
            </td></tr><tr><td align="center">subnet[id].assigned-pds</td><td align="center">integer</td><td align="left">
            This statistic shows the number of PD prefixes in a given subnet that
            are assigned. This statistic increases every time a new lease is allocated
            (as a result of receiving a REQUEST message) and is decreased every time a
            lease is released (a RELEASE message is received) or expires. The
            <span class="emphasis"><em>id</em></span> is the subnet-id of a given subnet. This statistic
            is exposed for each subnet separately. This statistic is reset during a
            reconfiguration event.
            </td></tr><tr><td align="center">declined-addresses</td><td align="center">integer</td><td align="left">
              This statistic shows the number of IPv6 addresses that are
              currently declined. This statistic counts the number of leases
              currently unavailable. Once a lease is recovered, this
              statistic will be decreased. Ideally, this statistic should be
              zero. If this statistic is non-zero (or worse increasing),
              a network administrator should investigate if there is
              a misbehaving device in his network. This is a global statistic
              that covers all subnets.
            </td></tr><tr><td align="center">subnet[id].declined-addresses</td><td align="center">integer</td><td align="left">
              This statistic shows the number of IPv6 addresses that are
              currently declined in a given subnet. This statistic counts the
              number of leases currently unavailable. Once a lease is
              recovered, this statistic will be decreased. Ideally, this
              statistic should be zero. If this statistic is
              non-zero (or worse increasing), a network administrator should
              investigate if there is a misbehaving device in his network. The
              <span class="emphasis"><em>id</em></span> is the subnet-id of a given subnet. This
              statistic is exposed for each subnet separately.
            </td></tr><tr><td align="center">reclaimed-declined-addresses</td><td align="center">integer</td><td align="left">
              This statistic shows the number of IPv6 addresses that were
              declined, but have now been recovered. Unlike
              declined-addresses, this statistic never decreases. It can be used
              as a long term indicator of how many actual valid Declines were
              processed and recovered from. This is a global statistic that
              covers all subnets.
            </td></tr><tr><td align="center">subnet[id].reclaimed-declined-addresses</td><td align="center">integer</td><td align="left">
              This statistic shows the number of IPv6 addresses that were
              declined, but have now been recovered. Unlike
              declined-addresses, this statistic never decreases. It can be used
              as a long term indicator of how many actual valid Declines were
              processed and recovered from. The
              <span class="emphasis"><em>id</em></span> is the subnet-id of a given subnet. This
              statistic is exposed for each subnet separately.
            </td></tr></tbody></table></div></div><br class="table-break"></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp6-ctrl-channel"></a>8.12. Management API for the DHCPv6 server</h2></div></div></div><p>
        Management API has been introduced in Kea 0.9.2-beta. It allows issuing specific
        management commands, like statistics retrieval, reconfiguration or shutdown.
        For more details, see <a class="xref" href="#ctrl-channel" title="Chapter 15. Management API">Chapter 15, <i>Management API</i></a>. Currently the only
        supported communication channel type is UNIX stream socket. By default there
        are no sockets open. To instruct Kea to open a socket, the following entry
        in the configuration file can be used:
</p><pre class="screen">
"Dhcp6": {
    "control-socket": {
        "socket-type": "unix",
        "socket-name": <strong class="userinput"><code>"/path/to/the/unix/socket"</code></strong>
    },

    "subnet6": [
        ...
    ],
    ...
}
</pre><p>
      </p><p>
        The length of the path specified by the <span class="command"><strong>socket-name</strong></span>
        parameter is restricted by the maximum length for the unix socket name
        on your operating system, i.e. the size of the <span class="command"><strong>sun_path</strong></span>
        field in the <span class="command"><strong>sockaddr_un</strong></span> structure, decreased by 1.
        This value varies on different operating systems between 91 and 107
        characters. The typical values are 107 on Linux and 103 on FreeBSD.
      </p><p>
        Communication over control channel is conducted using JSON structures.
        See the Control Channel section in the Kea Developer's Guide for more details.
      </p><p>DHCPv6 server supports <span class="command"><strong>statistic-get</strong></span>,
      <span class="command"><strong>statistic-reset</strong></span>, <span class="command"><strong>statistic-remove</strong></span>,
      <span class="command"><strong>statistic-get-all</strong></span>, <span class="command"><strong>statistic-reset-all</strong></span>
      and <span class="command"><strong>statistic-remove-all</strong></span>, specified in
      <a class="xref" href="#command-stats" title="14.3. Commands for Manipulating Statistics">Section 14.3, “Commands for Manipulating Statistics”</a>. It also supports
      <span class="command"><strong>list-commands</strong></span> and <span class="command"><strong>shutdown</strong></span>,
      specified in <a class="xref" href="#command-list-commands" title="15.3.2. list-commands command">Section 15.3.2, “list-commands command”</a> and
      <a class="xref" href="#command-shutdown" title="15.3.3. shutdown command">Section 15.3.3, “shutdown command”</a>, respectively.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp6-std"></a>8.13. Supported DHCPv6 Standards</h2></div></div></div><p>The following standards are currently
      supported:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="emphasis"><em>Dynamic Host Configuration Protocol for IPv6</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc3315" target="_top">RFC 3315</a>:
            Supported messages are SOLICIT,
            ADVERTISE, REQUEST, RELEASE, RENEW, REBIND, INFORMATION-REQUEST,
            CONFIRM and REPLY.</li><li class="listitem"><span class="emphasis"><em>IPv6 Prefix Options for
            Dynamic Host Configuration Protocol (DHCP) version 6</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc3633" target="_top">RFC 3633</a>:
            Supported options are IA_PD and
            IA_PREFIX. Also supported is the status code NoPrefixAvail.</li><li class="listitem"><span class="emphasis"><em>DNS Configuration options for Dynamic Host
            Configuration Protocol for IPv6 (DHCPv6)</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc3646" target="_top">RFC 3646</a>:
            Supported option is DNS_SERVERS.</li><li class="listitem"><span class="emphasis"><em>The Dynamic Host Configuration Protocol for IPv6 (DHCPv6)
            Relay Agent Remote-ID Option</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc4649" target="_top">RFC 4649</a>:
            REMOTE-ID option is supported.</li><li class="listitem"><span class="emphasis"><em>The Dynamic Host Configuration Protocol for IPv6 (DHCPv6) Client
            Fully Qualified Domain Name (FQDN) Option</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc4704" target="_top">RFC 4704</a>:
            Supported option is CLIENT_FQDN.</li><li class="listitem"><span class="emphasis"><em>Relay-Supplied DHCP Options</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc6422" target="_top">RFC 6422</a>:
            Full functionality is supported: OPTION_RSOO, ability of the server
            to echo back the options, checks whether an option is RSOO-enabled,
            ability to mark additional options as RSOO-enabled.</li><li class="listitem"><span class="emphasis"><em>Client Link-Layer Address Option in
            DHCPv6</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc6939" target="_top">RFC
            6939</a>: Supported option is client link-layer
            address option.</li><li class="listitem"><span class="emphasis"><em>Issues and Recommendations with Multiple
            Stateful DHCPv6 Options</em></span>,
            <a class="ulink" href="http://tools.ietf.org/html/rfc7550" target="_top">RFC
            7550</a>: All recommendations related to the DHCPv6 server
            operation are supported.</li></ul></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp6-limit"></a>8.14. DHCPv6 Server Limitations</h2></div></div></div><p> These are the current limitations and known problems
      with the DHCPv6 server
      software. Most of them are reflections of the early stage of
      development and should be treated as <span class="quote"><span class="quote">not implemented
      yet</span></span>, rather than actual limitations.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
              On-line configuration has some limitations. Adding new subnets or
              modifying existing ones work, as is removing the last subnet from
              the list. However, removing non-last (e.g. removing subnet 1,2 or 3 if
              there are 4 subnets configured) will cause issues. The problem is
              caused by simplistic subnet-id assignment. The subnets are always
              numbered, starting from 1. That subnet-id is then used in leases
              that are stored in the lease database. Removing non-last subnet will
              cause the configuration information to mismatch data in the lease
              database. It is possible to manually update subnet-id fields in
              MySQL or PostgreSQL database, but it is awkward and error prone
              process. A better reconfiguration support is planned.
            </p></li><li class="listitem">
            The server will allocate, renew or rebind a maximum of one lease
            for a particular IA option (IA_NA or IA_PD) sent by a client.
            <a class="ulink" href="http://tools.ietf.org/html/rfc3315" target="_top">RFC 3315</a> and
            <a class="ulink" href="http://tools.ietf.org/html/rfc3633" target="_top">RFC 3633</a> allow
            for multiple addresses or prefixes to be allocated for a single IA.
          </li><li class="listitem">Temporary addresses are not supported.</li><li class="listitem">
            Duplication report (DECLINE) and client reconfiguration (RECONFIGURE) are
            not yet supported.
          </li></ul></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="lease-expiration"></a>Chapter 9. Lease Expiration in DHCPv4 and DHCPv6</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#lease-reclamation">9.1. Lease Reclamation</a></span></dt><dt><span class="section"><a href="#lease-reclaim-config">9.2. Configuring Leases Reclamation</a></span></dt><dt><span class="section"><a href="#lease-affinity">9.3. Configuring Lease Affinity</a></span></dt><dt><span class="section"><a href="#lease-reclamation-defaults">9.4. Default Configuration Values for Leases Reclamation</a></span></dt><dt><span class="section"><a href="#leases-reclamation-using-command">9.5. Reclaiming Expired Leases with Command</a></span></dt></dl></div><p>The primary role of the DHCP server is to assign addresses and/or
  delegate prefixes to DHCP clients. These addresses and prefixes are
  often referred to as 'leases'. Leases are typically assigned to clients
  for a finite amount of time, known as 'valid lifetime'. DHCP clients who
  wish to continue using their assigned leases, will periodically renew them
  by sending the appropriate message to the DHCP server. The DHCP server records
  the time when these leases are renewed and calculates new expiration times
  for them.
  </p><p>If the client does not renew a lease before its valid lifetime
  elapses, the lease is considered expired. There are many situations
  when the client may cease lease renewals.  A common scenario is when
  the machine running the client shuts down for an extended period of
  time.</p><p> The process through which the DHCP server makes expired leases
  available for reassignment is referred to as "lease reclamation" and expired
  leases returned to availability through this process are referred to as
  "reclaimed".

  The DHCP server should reclaim an expired lease as soon as it detects
  that it has expired. One way in which the server may detect expiration
  is when it is trying to allocate a lease to a client and finds this
  lease already present in the database but expired.  Another way the
  server detects expired leases is by periodically querying the lease
  database for them.  Regardless of how an expired lease is detected, before
  it my assigned to a client, it must be reclaimed.

  This chapter explains how to configure the server to periodically query
  for the expired leases and how to minimize the impact of the periodic leases
  reclamation process on the server's responsiveness. Finally, 'lease affinity',
  which provides the means to assign the same lease to the returning client
  after its lease has expired, is explained.
  </p><p>Although, all configuration examples in this section are provided
  for the DHCPv4 server, the same parameters may be used for the
  DHCPv6 server configuration.
  </p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="lease-reclamation"></a>9.1. Lease Reclamation</h2></div></div></div><p>Lease reclamation is the process through which an expired lease
    becomes available for assignment to the same or a different client.
    This process involves the following steps for each reclaimed lease:
    </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">Invoke callouts for the <span class="command"><strong>lease4_expire</strong></span> or
        <span class="command"><strong>lease6_expire</strong></span> hook points, if hook libraries
        supporting those callouts are currently loaded.</li><li class="listitem">Update DNS, i.e. remove any DNS entries associated with
        the expired lease.</li><li class="listitem">Update lease information in the lease database to
        indicate that the lease is now available for re-assignment.</li><li class="listitem">Update statistics of the server, which includes
        increasing the number of reclaimed leases and decreasing the
        number of assigned addresses or delegated prefixes etc.</li></ul></div><p>Please refer to <a class="xref" href="#dhcp-ddns-server" title="Chapter 10. The DHCP-DDNS Server">Chapter 10, <i>The DHCP-DDNS Server</i></a> to see
    how to configure DNS updates in Kea, and to
    <a class="xref" href="#hooks-libraries" title="Chapter 13. Hooks Libraries">Chapter 13, <i>Hooks Libraries</i></a> for information about using
    hooks libraries.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="lease-reclaim-config"></a>9.2. Configuring Leases Reclamation</h2></div></div></div><p>Kea can be configured to periodically detect and reclaim expired
    leases. During this process the lease entries in the database are
    modified or removed. Therefore the server will not process incoming DHCP
    messages to avoid issues with concurrent access to database information.
    As a result, the server will be unresponsive while lease reclamation
    is performed. DHCP queries will accumulate and responses will be
    sent once the leases reclamation cycle is complete.</p><p>In deployments where response time is critical, administrators may
    wish to minimize the interruptions in service caused by lease reclamation.
    Toward this end, Kea provides configuration parameters to control: the
    frequency of lease reclamation cycles, the maximum number of leases
    processed in a single reclamation cycle, and the maximum amount of time a
    single reclamation cycle is allowed to run before being interrupted. The
    following examples demonstrate how these parameters can be used:

</p><pre class="screen">
"Dhcp4": {
    ...

    "expired-leases-processing": {
        "reclaim-timer-wait-time": 5,
        "max-reclaim-leases": 0,
        "max-reclaim-time": 0,
        "flush-reclaimed-timer-wait-time": 0,
    },

    ...
}
</pre><p>
    </p><p>The first parameter is expressed in seconds and specifies an
    interval between the two consecutive lease reclamation cycles. This
    is explained on the following diagram.

</p><pre class="screen">

|  c1  |            | c2 |            |c3|            | c4 |
|&lt;----&gt;|&lt;----------&gt;|&lt;--&gt;|&lt;----------&gt;|&lt;&gt;|&lt;----------&gt;|&lt;--&gt;|
----------------------------------------------------------------&gt;
|      |     5s     |    |     5s     |  |     5s     |    | time

</pre><p>

    </p><p>This diagram shows 4 leases reclamation cycles of variable duration.
    Note that the duration of the reclamation cycle depends on the number
    of expired leases detected and processed in the particular cycle. This
    duration is also usually significantly shorter than the interval between
    the cycles.
    </p><p>According to the <span class="command"><strong>reclaim-timer-wait-time</strong></span> the
    server keeps fixed intervals of 5 seconds between the end of one cycle
    and the start of the next cycle. This guarantees the presence of
    5s long periods during which the server remains responsive to DHCP
    queries and does not perform leases reclamation. The
    <span class="command"><strong>max-reclaim-leases</strong></span> and
    <span class="command"><strong>max-reclaim-time</strong></span> are set to 0, which implies that
    there is no restriction on the maximum number of leases reclaimed
    in the particular cycle, or the maximum duration of each cycle.
    </p><p>In deployments with high lease pool utilization, relatively
    short valid lifetimes, and frequently disconnecting clients which
    allow leases to expire; the number of expired leases requiring reclamation
    at any given time may rise significantly. In this case it is often
    desirable to apply restrictions on the maximum duration of a reclamation
    cycle or the maximum number of leases reclaimed in a cycle. The following
    configuration demonstrates how this can be done:

</p><pre class="screen">
"Dhcp4": {
    ...

    "expired-leases-processing": {
        "reclaim-timer-wait-time": 3,
        "max-reclaim-leases": 100,
        "max-reclaim-time": 50,
        "unwarned-reclaim-cycles": 10,
        "flush-reclaimed-timer-wait-time": 0,
    },

    ...
}

</pre><p>

    </p><p>The <span class="command"><strong>max-reclaim-leases</strong></span> parameter limits the number
    of leases reclaimed in a single cycle to 100. The
    <span class="command"><strong>max-reclaim-time</strong></span> limits the maximum duration of each
    cycle to 50ms. The lease reclamation cycle will be interrupted if either
    of these limitations is reached. The reclamation of all unreclaimed
    leases will be attempted in subsequent cycles.</p><p>The following diagram illustrates the behavior of the system in the
    presence of many expired leases, when the limits are applied for the
    reclamation cycles.

</p><pre class="screen">

| c1 |                | c2 |                | c3 |                | c4 |
|&lt;--&gt;|&lt;--------------&gt;|&lt;--&gt;|&lt;--------------&gt;|&lt;--&gt;|&lt;--------------&gt;|&lt;--&gt;|&lt;--
------------------------------------------------------------------------------&gt;
|50ms|       3s       |50ms|       3s       |50ms|       3s       |50ms|  time

</pre><p>

    </p><p>The diagram demonstrates the case when each reclamation cycle would take
    more than 50ms, and thus is interrupted according to the value of the
    <span class="command"><strong>max-reclaim-time</strong></span>. This results in equal durations of
    all reclamation cycles over time. Note that in this example the limitation
    of maximum 100 leases is not reached. This may be the case when database
    transactions are slow or callouts in the hook libraries attached to
    the server are slow.  Regardless, the choosing values for either the
    maximum number of leases or a maximum cycle time strongly depends on the
    particular deployment, lease database backend being used, and any hooks
    libraries etc.  Administrators may need to experiment to tune the system
    to suit the dynamics of their deployment.</p><p>It is important to realize that with the use of these limits, there
    is a risk that expired leases will accumulate faster than the server can
    reclaim them.  This should not be the problem if the server is dealing
    with a temporary burst of expirations, because it should be able to
    eventually deal with them over time. However, if leases expire at the high
    rate for a longer period of time, the unreclaimed leases will pile up in
    the database. In order to notify the administrator that the current
    configuration does not satisfy the needs for reclamation of expired
    leases, the server issues a warning message in the log, if it was unable
    to reclaim all leases within the last couple of reclamation cycles. The
    number of cycles after which such warning is issued is specified with the
    <span class="command"><strong>unwarned-reclaim-cycles</strong></span> configuration parameter.
    </p><p>Setting the <span class="command"><strong>reclaim-timer-wait-time</strong></span> to 0 disables
    periodic reclamation of the expired leases.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="lease-affinity"></a>9.3. Configuring Lease Affinity</h2></div></div></div><p>Suppose that a laptop goes to a sleep mode after a period of user
    inactivity.  While the laptop is in sleep mode, its DHCP client will not
    renew leases obtained from the server and these leases will eventually
    expire.  When the laptop wakes up, it is often desired that it continue
    using its previous assigned IP addresses. In order to facilitate this,
    the server needs to correlate returning clients with their expired leases
    When the client returns, the server will first check for those leases and
    re-assign them if they have not assigned to another client.  The ability
    of the server to re-assign the same lease to a returning client is
    referred to as 'lease affinity'.
    </p><p>When lease affinity is enabled, the server will still
    reclaim leases according to the parameters described in
    <a class="xref" href="#lease-reclaim-config" title="9.2. Configuring Leases Reclamation">Section 9.2, “Configuring Leases Reclamation”</a>, but the reclaimed leases
    will be held in the database (rather than removed) for the specified
    amount of time. When the client returns, the server will first check
    if there are any reclaimed leases associated with this client and
    re-assign them if possible. However, it is important to note that
    any reclaimed lease may be assigned to another client if that client
    specifically asks for it. Therefore, the lease affinity does not
    guarantee that the reclaimed lease will be available for the client
    who used it before. It merely increases the chances for the client to
    be assigned the same lease. If the lease pool is small (mostly applies
    to DHCPv4 for which address space is small), there is an increased
    likelihood that the expired lease will be hijacked by another client.
    </p><p>Consider the following configuration:

</p><pre class="screen">
"Dhcp4": {
    ...

    "expired-leases-processing": {
        "reclaim-timer-wait-time": 3,
        "hold-reclaimed-time": 1800,
        "flush-reclaimed-timer-wait-time": 5
    },

    ...
}
</pre><p>

    </p><p>The <span class="command"><strong>hold-reclaim-time</strong></span> specifies how many seconds
    after an expiration a reclaimed lease should be held in the database
    for re-assignment to the same client. In the example given above,
    reclaimed leases will be held for 30 minutes (1800s) after their
    expiration. During this time, the server will likely be able to
    re-assign the same lease to the returning client, unless another client
    requests this lease and the server assigns it.</p><p>The server must periodically remove reclaimed leases for which the
    time indicated by <span class="command"><strong>hold-reclaim-time</strong></span> has elapsed. The
    <span class="command"><strong>flush-reclaimed-timer-wait-time</strong></span> controls how
    often the server removes such leases. In the example provided
    above, the server will initiate removal of such leases 5 seconds after
    the previous removal attempt was completed. Setting this value to 0
    disables lease affinity, in which case leases will be removed from the
    lease database when they are reclaimed.  If lease affinity is enabled, it
    is recommended that hold-reclaim-time be set to a value significantly
    higher than the <span class="command"><strong>reclaim-timer-wait-time</strong></span>, as timely
    removal of expired-reclaimed leases is less critical while the removal
    process may impact server responsiveness.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="lease-reclamation-defaults"></a>9.4. Default Configuration Values for Leases Reclamation</h2></div></div></div><p>The following list presents all configuration parameters
    pertaining to processing expired leases with their default values:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="command"><strong>reclaim-timer-wait-time</strong></span> = 10 [seconds]</li><li class="listitem"><span class="command"><strong>flush-reclaimed-timer-wait-time</strong></span> = 25 [seconds]</li><li class="listitem"><span class="command"><strong>hold-reclaimed-time</strong></span> = 3600 [seconds]</li><li class="listitem"><span class="command"><strong>max-reclaim-leases</strong></span> = 100 </li><li class="listitem"><span class="command"><strong>max-reclaim-time</strong></span> = 250 [milliseconds]</li><li class="listitem"><span class="command"><strong>unwarned-reclaim-cycles</strong></span> = 5</li></ul></div><p>The default value for any parameter is used when this parameter not
    explicitly specified in the configuration. Also, the
    <span class="command"><strong>expired-leases-processing</strong></span> map may be omitted entirely
    in the configuration, in which case the default values are used for all
    parameters listed above.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="leases-reclamation-using-command"></a>9.5. Reclaiming Expired Leases with Command</h2></div></div></div><p>The <span class="emphasis"><em>leases-reclaim</em></span> command can be used to trigger
    leases reclamation at any time. Please consult the
    <a class="xref" href="#command-leases-reclaim" title="15.3.1. leases-reclaim command">Section 15.3.1, “leases-reclaim command”</a> for the details about using this
    command.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="dhcp-ddns-server"></a>Chapter 10. The DHCP-DDNS Server</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#dhcp-ddns-server-start-stop">10.1. Starting and Stopping the DHCP-DDNS Server</a></span></dt><dt><span class="section"><a href="#d2-configuration">10.2. Configuring the DHCP-DDNS Server</a></span></dt><dd><dl><dt><span class="section"><a href="#d2-server-parameter-config">10.2.1. Global Server Parameters</a></span></dt><dt><span class="section"><a href="#d2-tsig-key-list-config">10.2.2. TSIG Key List</a></span></dt><dt><span class="section"><a href="#d2-forward-ddns-config">10.2.3. Forward DDNS</a></span></dt><dt><span class="section"><a href="#d2-reverse-ddns-config">10.2.4. Reverse DDNS</a></span></dt><dt><span class="section"><a href="#d2-exmaple-config">10.2.5. Example DHCP-DDNS Server Configuration</a></span></dt></dl></dd><dt><span class="section"><a href="#idp55495520">10.3. DHCP-DDNS Server Limitations</a></span></dt></dl></div><p>
    The DHCP-DDNS Server (kea-dhcp-ddns, known informally as D2) conducts the client side of
    the DDNS protocol (defined in RFC 2136) on behalf of the DHCPv4 and DHCPv6
    servers (kea-dhcp4 and kea-dhcp6 respectively). The DHCP servers construct
    DDNS update requests, known as NameChangeRequests (NCRs), based upon DHCP
    lease change events and then post these to D2. D2 attempts to match
    each such request to the appropriate DNS server(s) and carry out the
    necessary conversation with those servers to update the DNS data.
    </p><p>
    In order to match a request to the appropriate DNS servers, D2 must have a
    catalog of servers from which to select. In fact, D2 has two such catalogs,
    one for forward DNS and one for reverse DNS; these catalogs are referred
    to as DDNS Domain Lists.  Each list consists of one or more named DDNS
    Domains. Further, each DDNS Domain has a list of one or more DNS
    servers that publish the DNS data for that domain.
    </p><p>
    When conducting forward domain matching, D2 will compare the FQDN in
    the request against the name of each forward DDNS Domain. The domain
    whose name matches the longest portion of the FQDN is considered the
    best match.  For example, if the FQDN is "myhost.sample.example.com.",
    and there are two forward domains in the catalog: "sample.example.com."
    and "example.com.", the former is regarded as the best match.  In some
    cases, it may not be possible to find a suitable match. Given the same two
    forward domains there would be no match for the FQDN, "bogus.net", so the
    request would be rejected.   Finally, if there are no forward DDNS Domains
    defined, D2 will simply disregard the forward update portion of requests.
    </p><p>
    When conducting reverse domain matching, D2 constructs a reverse
    FQDN from the lease address in the request and compare that against
    the name of each reverse DDNS Domain. Again, the domain whose name matches
    the longest portion of the FQDN is considered the best match. For instance,
    if the lease address is "172.16.1.40" and there are two reverse domains in
    the catalog: "1.16.172.in-addr.arpa." and "16.172.in-addr.arpa", the
    former is the best match.  As with forward matching, it is possible to not
    find a suitable match.  Given the same two domains, there would be no
    match for the lease address, "192.168.1.50", and the request would be
    rejected. Finally, if there are no reverse DDNS Domains defined, D2 will
    simply disregard the reverse update portion of requests.
    </p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dhcp-ddns-server-start-stop"></a>10.1. Starting and Stopping the DHCP-DDNS Server</h2></div></div></div><p>
      <span class="command"><strong>kea-dhcp-ddns</strong></span> is the Kea DHCP-DDNS server
      and, due to the nature of DDNS, it is run alongside either the
      DHCPv4 or DHCPv6 components (or both).  Like other parts of
      Kea, it is a separate binary that can be run on its own or through
      <span class="command"><strong>keactrl</strong></span> (see <a class="xref" href="#keactrl" title="Chapter 6. Managing Kea with keactrl">Chapter 6, <i>Managing Kea with keactrl</i></a>). In
      normal operation, controlling <span class="command"><strong>kea-dhcp-ddns</strong></span>
      with <span class="command"><strong>keactrl</strong></span> is recommended. However, it is also
      possible to run the DHCP-DDNS server directly. It accepts the
      following command-line switches:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
            <span class="command"><strong>-c <em class="replaceable"><code>file</code></em></strong></span> -
            specifies the configuration file. This is the only mandatory
            switch.</li><li class="listitem">
            <span class="command"><strong>-d</strong></span> - specifies whether the server
            logging should be switched to debug/verbose mode. In verbose mode,
            the logging severity and debuglevel specified in the configuration
            file are ignored and "debug" severity and the maximum debuglevel
            (99) are assumed. The flag is convenient, for temporarily
            switching the server into maximum verbosity, e.g. when
            debugging.</li><li class="listitem">
              <span class="command"><strong>-v</strong></span> - prints out Kea version and exits.
            </li><li class="listitem">
              <span class="command"><strong>-V</strong></span> - prints out Kea extended version with
              additional parameters and exits.
            </li><li class="listitem">
              <span class="command"><strong>-W</strong></span> - prints out Kea configuration report
              and exits.
            </li></ul></div><p>
            The <span class="command"><strong>-V</strong></span> command returns the versions of the
            external libraries dynamically linked.
      </p><p>
            The <span class="command"><strong>-W</strong></span> command describes the environment used
            to build Kea.  This command displays a copy of the
            <code class="filename">config.report</code> file produced by
            <strong class="userinput"><code>./configure</code></strong> that is embedded in the
            executable binary.
      </p><p>
            The <code class="filename">config.report</code> may also be accessed more
            directly.  The following command may be used to extract this
            information.  The binary <strong class="userinput"><code>path</code></strong> may be found
            in the install directory or in the <code class="filename">.libs</code>
            subdirectory in the source tree. For example
            <code class="filename">kea/src/bin/d2/.libs/kea-dhcp-ddns</code>.
</p><pre class="screen">
strings <strong class="userinput"><code>path</code></strong>/kea-dhcp-ddns | sed -n 's/;;;; //p'
</pre><p>
      </p><p>
      Upon start up the module will load its configuration and begin listening
      for NCRs based on that configuration.
      </p><p>
        During startup the server will attempt to create a PID file of the
        form: [localstatedir]/[conf name].kea-dhcp-ddns.pid
        where:
        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="command"><strong>localstatedir</strong></span>: The value as passed into the
            build configure script. It defaults to "/usr/local/var".  Note
            that this value may be overridden at run time by setting the environment
            variable KEA_PIDFILE_DIR.  This is intended primarily for testing purposes.
            </li><li class="listitem"><span class="command"><strong>conf name</strong></span>: The configuration file name
            used to start the server, minus all preceding path and file extension.
            For example, given a pathname of "/usr/local/etc/kea/myconf.txt", the
            portion used would be "myconf".
            </li></ul></div><p>
        If the file already exists and contains the PID of a live process,
        the server will issue a DHCP_DDNS_ALREADY_RUNNING log message and exit. It
        is possible, though unlikely, that the file is a remnant of a system crash
        and the process to which the PID belongs is unrelated to Kea.  In such a
        case it would be necessary to manually delete the PID file.
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d2-configuration"></a>10.2. Configuring the DHCP-DDNS Server</h2></div></div></div><p>
	Before starting <span class="command"><strong>kea-dhcp-ddns</strong></span> module for the
	first time, a configuration file needs to be created. The following default
	configuration is a template that can be customised to your requirements.
</p><pre class="screen">
<strong class="userinput"><code>"DhcpDdns": {
    "ip-address": "127.0.0.1",
    "port": 53001,
    "dns-server-timeout": 100,
    "ncr-protocol": "UDP",
    "ncr-format": "JSON",
    "tsig-keys": [ ],
    "forward-ddns": {
	"ddns-domains": [ ]
    },
    "reverse-ddns": {
	"ddns-domains": [ ]
    }
}</code></strong>
</pre><p>
      </p><p>
      The configuration can be divided as follows, each of which is described
      in its own section:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <span class="command"><strong>Global Server Parameters</strong></span> -
	      values which control connectivity and global server behavior
	    </li><li class="listitem">
	      <span class="command"><strong>TSIG Key Info</strong></span> -
	      defines the TSIG keys used for secure traffic with DNS servers
	    </li><li class="listitem">
	      <span class="command"><strong>Forward DDNS</strong></span> -
	      defines the catalog of Forward DDNS Domains
	    </li><li class="listitem">
	      <span class="command"><strong>Reverse DDNS</strong></span> -
	      defines the catalog of Forward DDNS Domains
	    </li></ul></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="d2-server-parameter-config"></a>10.2.1. Global Server Parameters</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
      <span class="command"><strong>ip-address</strong></span> - IP address on which D2
      listens for requests. The default is the local loopback interface at
      address 127.0.0.1. You may specify either an IPv4 or IPv6 address.
      </li><li class="listitem">
      <span class="command"><strong>port</strong></span> - Port on which D2 listens for requests.  The default value
      is 53001.
      </li><li class="listitem">
      <span class="command"><strong>dns-server-timeout</strong></span> - The maximum amount
      of time in milliseconds, that D2 will wait for a response from a
      DNS server to a single DNS update message.
      </li><li class="listitem">
      <span class="command"><strong>ncr-protocol</strong></span> - Socket protocol to use when sending requests to D2.
      Currently only UDP is supported.  TCP may be available in an upcoming
      release.
      </li><li class="listitem">
      <span class="command"><strong>ncr-format</strong></span> - Packet format to use when sending requests to D2.
      Currently only JSON format is supported.  Other formats may be available
      in future releases.
      </li></ul></div><p>
	D2 must listen for change requests on a known address and port.  By
	default it listens at 127.0.0.1 on port 53001. The following example
	illustrates how to change D2's global parameters so it will listen
	at 192.168.1.10 port 900:
</p><pre class="screen">
"DhcpDdns": {
    <strong class="userinput"><code>"ip-address": "192.168.1.10",
    "port": 900,</code></strong>
    ...
    }
}</pre><p>
	</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
	    It is possible for a malicious attacker to send bogus
	    NameChangeRequests to the DHCP-DDNS server.  Addresses
	    other than the IPv4 or IPv6 loopback addresses (127.0.0.1
	    or ::1) should only be used for testing purposes, but
	    note that local users may still communicate with the
	    DHCP-DDNS server.  A future version of Kea will implement
	    authentication to guard against such attacks.
	  </p></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
If the ip-address and port are changed, it will be necessary to change the
corresponding values in the DHCP servers' "dhcp-ddns" configuration section.
</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="d2-tsig-key-list-config"></a>10.2.2. TSIG Key List</h3></div></div></div><p>
	A DDNS protocol exchange can be conducted with or without TSIG
	(defined in <a class="ulink" href="http://tools.ietf/org/html/rfc2845" target="_top">RFC
	2845</a>). This configuration section allows the administrator
	to define the set of TSIG keys that may be used in such
	exchanges.</p><p>To use TSIG when updating entries in a DNS Domain,
	a key must be defined in the TSIG Key List and referenced by
	name in that domain's configuration entry.  When D2 matches a
	change request to a domain, it checks whether the domain has
	a TSIG key associated with it.  If so, D2 will use that key to
	sign DNS update messages sent to and verify responses received
	from the domain's DNS server(s). For each TSIG key required by
	the DNS servers that D2 will be working with there must be a
	corresponding TSIG key in the TSIG Key list.</p><p>
	As one might gather from the name, the tsig-key section of the
	D2 configuration lists the TSIG keys.  Each entry describes a
	TSIG key used by one or more DNS servers to authenticate requests
	and sign responses.  Every entry in the list has three parameters:
	</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <span class="command"><strong>name</strong></span> -
	      a unique text label used to identify this key within the
	      list.  This value is used to specify which key (if any) should be
	      used when updating a specific domain. So long as it is unique its
	      content is arbitrary, although for clarity and ease of maintenance
	      it is recommended that it match the name used on the DNS server(s).
	      It cannot be blank.
	    </li><li class="listitem">
	      <span class="command"><strong>algorithm</strong></span> -
	      specifies which hashing algorithm should be used with this
	      key.  This value must specify the same algorithm used for the
	      key on the DNS server(s). The supported algorithms are listed below:
	      <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: circle; "><li class="listitem"><span class="command"><strong>HMAC-MD5</strong></span></li><li class="listitem"><span class="command"><strong>HMAC-SHA1</strong></span></li><li class="listitem"><span class="command"><strong>HMAC-SHA224</strong></span></li><li class="listitem"><span class="command"><strong>HMAC-SHA256</strong></span></li><li class="listitem"><span class="command"><strong>HMAC-SHA384</strong></span></li><li class="listitem"><span class="command"><strong>HMAC-SHA512</strong></span></li></ul></div>
	      This value is not case sensitive.
	    </li><li class="listitem">
	      <span class="command"><strong>digest-bits</strong></span> -
	      is used to specify the minimum truncated length in bits.
	      The default value 0 means truncation is forbidden, not 0
	      values must be an integral number of octets, be greater
	      than 80 and the half of the full length. Note in BIND9
	      this parameter is appended after a dash to the algorithm
	      name.
	    </li><li class="listitem">
	      <span class="command"><strong>secret</strong></span> -
	      is used to specify the shared secret key code for this key.  This value is
	      case sensitive and must exactly match the value specified on the DNS server(s).
	      It is a base64-encoded text value.
	    </li></ul></div><p>
	</p><p>
	As an example, suppose that a domain D2 will be updating is
	maintained by a BIND9 DNS server which requires dynamic updates
	to be secured with TSIG.  Suppose further that the entry for
	the TSIG key in BIND9's named.conf file looks like this:
</p><pre class="screen">
   :
   key "key.four.example.com." {
       algorithm hmac-sha224;
       secret "bZEG7Ow8OgAUPfLWV3aAUQ==";
   };
   :
</pre><p>
	By default, the TSIG Key list is empty:
</p><pre class="screen">
"DhcpDdns": {
   <strong class="userinput"><code>"tsig-keys": [ ]</code></strong>,
   ...
}
</pre><p>

	We must extend the list with a new key:
</p><pre class="screen">
"DhcpDdns": {
    "tsig-keys": [
    <strong class="userinput"><code>    {
	    "name": "key.four.example.com.",
	    "algorithm": "HMAC-SHA224",
	    "secret": "bZEG7Ow8OgAUPfLWV3aAUQ=="
	}</code></strong>
    ],
    ...
}
</pre><p>
	</p><p>These steps would be repeated for each TSIG key needed.  Note that
	the same TSIG key can be used with more than one domain.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="d2-forward-ddns-config"></a>10.2.3. Forward DDNS</h3></div></div></div><p>
	The Forward DDNS section is used to configure D2's forward update
	behavior. Currently it contains a single parameter, the catalog of
	forward DDNS Domains, which is a list of structures.
</p><pre class="screen">
"DhcpDdns": {
    <strong class="userinput"><code>"forward-ddns": {
	"ddns-domains": [ ]
    }</code></strong>,
    ...
}
</pre><p>

	By default, this list is empty, which will cause the server to ignore
	the forward update portions of requests.
	</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="add-forward-ddns-domain"></a>10.2.3.1. Adding Forward DDNS Domains</h4></div></div></div><p>
	  A forward DDNS Domain maps a forward DNS zone to a set of
	  DNS servers which maintain the forward DNS data (i.e. name to
	  address mapping) for that zone.  You will need one forward DDNS
	  Domain for each zone you wish to service.  It may very well
	  be that some or all of your zones are maintained by the same
	  servers. You will still need one DDNS Domain per zone. Remember
	  that matching a request to the appropriate server(s) is done
	  by zone and a DDNS Domain only defines a single zone.
	  </p><p>
	  This section describes how to add Forward DDNS Domains. Repeat these
	  steps for each Forward DDNS Domain desired.  Each Forward DDNS Domain
	  has the following parameters:
	  </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <span class="command"><strong>name</strong></span> -
	      The fully qualified domain name (or zone) that this DDNS Domain
	      can update.  This is value used to compare against the request
	      FQDN during forward matching.  It must be unique within the
	      catalog.
	      </li><li class="listitem">
	      <span class="command"><strong>key-name</strong></span> -
	      If TSIG is used with this domain's servers, this
	      value should be the name of the key from within the TSIG Key List
	      to use.  If the value is blank (the default), TSIG will not be
	      used in DDNS conversations with this domain's servers.
	      </li><li class="listitem">
	      <span class="command"><strong>dns-servers</strong></span> -
	      A list of one or more DNS servers which can conduct the server
	      side of the DDNS protocol for this domain.  The servers
	      are used in a first to last preference. In other words, when D2
	      begins to process a request for this domain it will pick the
	      first server in this list and attempt to communicate with it.
	      If that attempt fails, it will move to next one in the list and
	      so on until the it achieves success or the list is exhausted.
	      </li></ul></div><p>
	To create a new forward DDNS Domain, one must add a new domain
	element and set its parameters:
</p><pre class="screen">
"DhcpDdns": {
    "forward-ddns": {
	"ddns-domains": [
	    <strong class="userinput"><code>{
		"name": "other.example.com.",
		"key-name": "",
		"dns-servers": [
		]
	    }</code></strong>
	]
    }
}
</pre><p>

	It is permissible to add a domain without any servers. If that domain
	should be matched to a request, however, the request will fail.  In
	order to make the domain useful though, we must add at least one DNS
	server to it.
	</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="add-forward-dns-servers"></a>10.2.3.1.1. Adding Forward DNS Servers</h5></div></div></div><p>
	  This section describes how to add DNS servers to a Forward DDNS Domain.
	  Repeat them for as many servers as desired for a each domain.
	  </p><p>
	  Forward DNS Server entries represent actual DNS servers which
	  support the server side of the DDNS protocol. Each Forward DNS Server
	  has the following parameters:
	  </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <span class="command"><strong>hostname</strong></span> -
	      The resolvable host name of the DNS server. This value is not
	      yet implemented.
	      </li><li class="listitem">
	      <span class="command"><strong>ip-address</strong></span> -
	      The IP address at which the server listens for DDNS requests.
	      This may be either an IPv4 or an IPv6 address.
	      </li><li class="listitem">
	      <span class="command"><strong>port</strong></span> -
	      The port on which the server listens for DDNS requests. It
	      defaults to the standard DNS service port of 53.
	      </li></ul></div><p>
	  To create a new forward DNS Server, one must add a new server
	  element to the domain and fill in its parameters.  If for
	example the service is running at "172.88.99.10", then set it as
	follows:
</p><pre class="screen">
"DhcpDdns": {
    "forward-ddns": {
	"ddns-domains": [
	    {
		"name": "other.example.com.",
		"key-name": "",
		"dns-servers": [
		    <strong class="userinput"><code>{
			"hostname": "",
			"ip-address": "172.88.99.10",
			"port": 53
		    }</code></strong>
		]
	    }
	]
    }
}
</pre><p>
	  </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
	As stated earlier, "hostname" is not yet supported so, the parameter
	"ip-address" must be set to the address of the DNS server.
    </p></div></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="d2-reverse-ddns-config"></a>10.2.4. Reverse DDNS</h3></div></div></div><p>
	The Reverse DDNS section is used to configure D2's reverse update
	behavior, and the concepts are the same as for the forward DDNS
	section. Currently it contains a single parameter, the catalog of
	reverse DDNS Domains, which is a list of structures.
</p><pre class="screen">
"DhcpDdns": {
    <strong class="userinput"><code>"reverse-ddns": {
	"ddns-domains": [ ]
    }</code></strong>
    ...
}
</pre><p>
	By default, this list is empty, which will cause the server to ignore
	the reverse update portions of requests.
	</p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="add-reverse-ddns-domain"></a>10.2.4.1. Adding Reverse DDNS Domains</h4></div></div></div><p>
	  A reverse DDNS Domain maps a reverse DNS zone to a set of DNS
	  servers which maintain the reverse DNS data (address to name
	  mapping) for that zone.  You will need one reverse DDNS Domain
	  for each zone you wish to service.  It may very well be that
	  some or all of your zones are maintained by the same servers;
	  even then, you will still need one DDNS Domain entry for each
	  zone. Remember that matching a request to the appropriate
	  server(s) is done by zone and a DDNS Domain only defines a
	  single zone.
	  </p><p>
	  This section describes how to add Reverse DDNS Domains. Repeat these
	  steps for each Reverse DDNS Domain desired.  Each Reverse DDNS Domain
	  has the following parameters:
	  </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <span class="command"><strong>name</strong></span> -
	      The fully qualified reverse zone that this DDNS Domain
	      can update.  This is the value used during reverse matching
	      which will compare it with a reversed version of the request's
	      lease address. The zone name should follow the appropriate
	      standards: for example, to to support the IPv4 subnet 172.16.1,
	      the name should be. "1.16.172.in-addr.arpa.".  Similarly,
	      to support an IPv6 subnet of 2001:db8:1, the name should be
	      "1.0.0.0.8.B.D.0.1.0.0.2.ip6.arpa."
	      Whatever the name, it must be unique within the catalog.
	      </li><li class="listitem">
	      <span class="command"><strong>key-name</strong></span> -
	      If TSIG should be used with this domain's servers, then this
	      value should be the name of that key from the TSIG Key List.
	      If the value is blank (the default), TSIG will not be
	      used in DDNS conversations with this domain's servers.  Currently
	      this value is not used as TSIG has not been implemented.
	      </li><li class="listitem">
	      <span class="command"><strong>dns-servers</strong></span> -
	      a list of one or more DNS servers which can conduct the server
	      side of the DDNS protocol for this domain.  Currently the servers
	      are used in a first to last preference. In other words, when D2
	      begins to process a request for this domain it will pick the
	      first server in this list and attempt to communicate with it.
	      If that attempt fails, it will move to next one in the list and
	      so on until the it achieves success or the list is exhausted.
	      </li></ul></div><p>
	To create a new reverse DDNS Domain, one must add a new domain element
	and set its parameters. For example, to support subnet 2001:db8:1::,
	the following configuration could be used:
</p><pre class="screen">
"DhcpDdns": {
    "reverse-ddns": {
	"ddns-domains": [
	    <strong class="userinput"><code>{
		"name": "1.0.0.0.8.B.D.0.1.0.0.2.ip6.arpa.",
		"key-name": "",
		"dns-servers": [
		]
	    }</code></strong>
	]
    }
}
</pre><p>

	It is permissible to add a domain without any servers. If that domain
	should be matched to a request, however, the request will fail.  In
	order to make the domain useful though, we must add at least one DNS
	server to it.
	</p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="add-reverse-dns-servers"></a>10.2.4.1.1. Adding Reverse DNS Servers</h5></div></div></div><p>
	  This section describes how to add DNS servers to a Reverse DDNS Domain.
	  Repeat them for as many servers as desired for each domain.
	  </p><p>
	  Reverse DNS Server entries represents a actual DNS servers which
	  support the server side of the DDNS protocol. Each Reverse DNS Server
	  has the following parameters:
	  </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	      <span class="command"><strong>hostname</strong></span> -
	      The resolvable host name of the DNS server. This value is
	      currently ignored.
	      </li><li class="listitem">
	      <span class="command"><strong>ip-address</strong></span> -
	      The IP address at which the server listens for DDNS requests.
	      </li><li class="listitem">
	      <span class="command"><strong>port</strong></span> -
	      The port on which the server listens for DDNS requests. It
	      defaults to the standard DNS service port of 53.
	      </li></ul></div><p>
	  To create a new reverse DNS Server, one must first add a new server
	  element to the domain and fill in its parameters.  If for
	example the service is running at "172.88.99.10", then set it as
	follows:
</p><pre class="screen">
"DhcpDdns": {
    "reverse-ddns": {
	"ddns-domains": [
	    {
		"name": "1.0.0.0.8.B.D.0.1.0.0.2.ip6.arpa.",
		"key-name": "",
		"dns-servers": [
		    <strong class="userinput"><code>{
			"hostname": "",
			"ip-address": "172.88.99.10",
			"port": 53
		    }</code></strong>
		]
	    }
	]
    }
}
</pre><p>
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
    As stated earlier, "hostname" is not yet supported so, the parameter
    "ip-address" must be set to the address of the DNS server.
    </p></div></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="d2-exmaple-config"></a>10.2.5. Example DHCP-DDNS Server Configuration</h3></div></div></div><p>
	This section provides an example DHCP-DDNS server configuration based
	on a small example network.  Let's suppose our example network has
	three domains, each with their own subnet.

	</p><div class="table"><a name="idp55451472"></a><p class="title"><b>Table 10.1. Our example network</b></p><div class="table-contents"><table summary="Our example network" border="1"><colgroup><col align="left" class="domain"><col align="left" class="subnet"><col align="left" class="fservers"><col align="left" class="rservers"></colgroup><thead><tr><th align="left">Domain</th><th align="left">Subnet</th><th align="left">Forward DNS Servers</th><th align="left">Reverse DNS Servers</th></tr></thead><tbody><tr><td align="left">four.example.com</td><td align="left">192.0.2.0/24</td><td align="left">172.16.1.5, 172.16.2.5</td><td align="left">172.16.1.5, 172.16.2.5</td></tr><tr><td align="left">six.example.com</td><td align="left">2001:db8:1::/64</td><td align="left">3001:1::50</td><td align="left">3001:1::51</td></tr><tr><td align="left">example.com</td><td align="left">192.0.0.0/16</td><td align="left">172.16.2.5</td><td align="left">172.16.2.5</td></tr></tbody></table></div></div><p><br class="table-break">
	</p><p>
	We need to construct three forward DDNS Domains:
	</p><div class="table"><a name="idp55465872"></a><p class="title"><b>Table 10.2. Forward DDNS Domains Needed</b></p><div class="table-contents"><table summary="Forward DDNS Domains Needed" border="1"><colgroup><col align="left" class="num"><col align="left" class="name"><col align="left" class="servers"></colgroup><thead><tr><th align="left">#</th><th align="left">DDNS Domain Name</th><th align="left">DNS Servers</th></tr></thead><tbody><tr><td align="left">1.</td><td align="left">four.example.com.</td><td align="left">172.16.1.5, 172.16.2.5</td></tr><tr><td align="left">2.</td><td align="left">six.example.com.</td><td align="left">3001:1::50</td></tr><tr><td align="left">3.</td><td align="left">example.com.</td><td align="left">172.16.2.5</td></tr></tbody></table></div></div><p><br class="table-break">
	As discussed earlier, FQDN to domain matching is based on the longest
	match. The FQDN, "myhost.four.example.com.", will match the first
	domain ("four.example.com") while "admin.example.com." will match the
	third domain ("example.com"). The
	FQDN, "other.example.net." will fail to match any domain and would
	be rejected.
	</p><p>
	The following example configuration specified the Forward DDNS Domains.
</p><pre class="screen"><strong class="userinput"><code>
"DhcpDdns": {
    "forward-ddns": {
	"ddns-domains": [
	    {
		"name": "four.example.com.",
		"key-name": "",
		"dns-servers": [
		    { "ip-address": "172.16.1.5" },
		    { "ip-address": "172.16.2.5" }
		]
	    },
	    {
		"name": "six.example.com.",
		"key-name": "",
		"dns-servers": [
		    { "ip-address": "2001:db8::1" }
		]
	    },
	    {
		"name": "example.com.",
		"key-name": "",
		"dns-servers": [
		    { "ip-address": "172.16.2.5" }
		]
	    },

	]
    }
}</code></strong>
</pre><p>

	</p><p>
	Similarly, we need to construct the three reverse DDNS Domains:
	</p><div class="table"><a name="idp55480416"></a><p class="title"><b>Table 10.3. Reverse DDNS Domains Needed</b></p><div class="table-contents"><table summary="Reverse DDNS Domains Needed" border="1"><colgroup><col align="left" class="num"><col align="left" class="DDNS Domain name"><col align="left" class="DDNS Domain DNS Servers"></colgroup><thead><tr><th align="left">#</th><th align="left">DDNS Domain Name</th><th align="left">DNS Servers</th></tr></thead><tbody><tr><td align="left">1.</td><td align="left">2.0.192.in-addr.arpa.</td><td align="left">172.16.1.5, 172.16.2.5</td></tr><tr><td align="left">2.</td><td align="left">1.0.0.0.8.d.b.0.1.0.0.2.ip6.arpa.</td><td align="left">3001:1::50</td></tr><tr><td align="left">3.</td><td align="left">0.182.in-addr.arpa.</td><td align="left">172.16.2.5</td></tr></tbody></table></div></div><p><br class="table-break">
	An address of "192.0.2.150" will match the first domain,
	"2001:db8:1::10" will match the second domain, and "192.0.50.77"
	the third domain.
	</p><p>
	These Reverse DDNS Domains are specified as follows:

</p><pre class="screen"><strong class="userinput"><code>
"DhcpDdns": {
    "reverse-ddns": {
	"ddns-domains": [
	    {
		"name": "2.0.192.in-addr.arpa.",
		"key-name": "",
		"dns-servers": [
		    { "ip-address": "172.16.1.5" },
		    { "ip-address": "172.16.2.5" }
		]
	    }
	    {
		"name": "1.0.0.0.8.B.D.0.1.0.0.2.ip6.arpa.",
		"key-name": "",
		"dns-servers": [
		    { "ip-address": "2001:db8::1" }
		]
	    }
	    {
		"name": "0.192.in-addr.arpa.",
		"key-name": "",
		"dns-servers": [
		    { "ip-address": "172.16.2.5" }
		]
	    }
	]
    }
}</code></strong>
</pre><p>

	</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp55495520"></a>10.3. DHCP-DDNS Server Limitations</h2></div></div></div><p>The following are the current limitations of the DHCP-DDNS Server.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
	    Requests received from the DHCP servers are placed in a
	    queue until they are processed.  Currently all queued requests
	    are lost when the server shuts down.
	  </li></ul></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="kea-lfc"></a>Chapter 11. The LFC process</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#kea-lfc-overview">11.1. Overview</a></span></dt><dt><span class="section"><a href="#kea-lfc-usage">11.2. Command Line Options</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kea-lfc-overview"></a>11.1. Overview</h2></div></div></div><p><span class="command"><strong>kea-lfc</strong></span> is a service process that removes
      redundant information from the files used to provide persistent storage
      for the memfile data base backend. This service is written to run as a
      stand alone process.  
      </p><p>While <span class="command"><strong>kea-lfc</strong></span> can be started externally, there is
      usually no need to do this.  <span class="command"><strong>kea-lfc</strong></span> is run on a periodic
      basis by the Kea DHCP servers.
      </p><p>The process operates on a set of files, using them for input and output
      of the lease entries and to indicate where it is in the process in case of an
      interruption.  Currently the caller must supply names for all of the files, in
      the future this requirement may be relaxed with the process getting the names
      from either the config file or from defaults.
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="kea-lfc-usage"></a>11.2. Command Line Options</h2></div></div></div><p><span class="command"><strong>kea-lfc</strong></span> is run as follows:
</p><pre class="screen">
kea-lfc [-4 | -6] -c config-file -p pid-file -x previous-file -i copy-file -o output-file -f finish-file
</pre><p>
      </p><p>The argument <span class="command"><strong>-4</strong></span> or <span class="command"><strong>-6</strong></span> selects the protocol
      version of the lease files.
      </p><p>The <span class="command"><strong>-c</strong></span> argument specifies the configuration file.  This is
      required, but not currently used by the process.
      </p><p>The <span class="command"><strong>-p</strong></span> argument specifies the PID file. When the
      <span class="command"><strong>kea-lfc</strong></span> process starts it attempts to determine if another
      instance of the process is already running by examining the pid file.  If one
      is already running the new process is terminated.  If one isn't running it writes
      its pid into the pid file.
      </p><p>The other filenames specify where the <span class="command"><strong>kea-lfc</strong></span> process
      should look for input, write its output and use for bookkeeping.

        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
            <span class="command"><strong>previous</strong></span> —
            When <span class="command"><strong>kea-lfc</strong></span> starts this
            is the result of any previous run of <span class="command"><strong>kea-lfc</strong></span>.
            When <span class="command"><strong>kea-lfc</strong></span> finishes it is the result of this run.
            If <span class="command"><strong>kea-lfc</strong></span> is interrupted before completing,
            this file may not exist.
          </li><li class="listitem">
            <span class="command"><strong>input</strong></span> —
            Before the DHCP server invokes <span class="command"><strong>kea-lfc</strong></span> it will
            move the current lease file here and then call <span class="command"><strong>kea-lfc</strong></span>
            with this file.
          </li><li class="listitem">
            <span class="command"><strong>output</strong></span> —
            The temporary file <span class="command"><strong>kea-lfc</strong></span> should use to write the leases.
            Upon completion of writing this file, it will be moved to the finish file
           (see below).
          </li><li class="listitem">
            <span class="command"><strong>finish</strong></span> —
            Another temporary file <span class="command"><strong>kea-lfc</strong></span> uses for bookkeeping.  When
            <span class="command"><strong>kea-lfc</strong></span> completes writing the outputfile it moves it to this
            file name.  After <span class="command"><strong>kea-lfc</strong></span> finishes deleting the other files
            (previous and input) it moves this file to previous lease file.  By moving the
            files in this fashion the <span class="command"><strong>kea-lfc</strong></span> and the DHCP server
            processes can determine the correct file to use even if one of the
            processes was interrupted before completing its task.
          </li></ul></div><p>
      </p><p>There are several additional arguments mostly for debugging purposes.
      <span class="command"><strong>-d</strong></span> Sets the logging level to debug. <span class="command"><strong>-v</strong></span> and
      <span class="command"><strong>-V</strong></span> print out version stamps with <span class="command"><strong>-V</strong></span> providing
      a longer form.  <span class="command"><strong>-h</strong></span> prints out the usage string.
      </p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="classify"></a>Chapter 12. Client Classification</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#idp49591728">12.1. Client Classification Overview</a></span></dt><dt><span class="section"><a href="#classification-using-vendor">12.2. Using Vendor Class Information In Classification</a></span></dt><dt><span class="section"><a href="#classification-using-expressions">12.3. Using Expressions In Classification</a></span></dt><dd><dl><dt><span class="section"><a href="#idp55587760">12.3.1. Substring</a></span></dt></dl></dd><dt><span class="section"><a href="#classification-configuring">12.4. Configuring Classes</a></span></dt><dt><span class="section"><a href="#classification-subnets">12.5. Configuring Subnets With Class Information</a></span></dt><dt><span class="section"><a href="#idp55504128">12.6. Using Classes</a></span></dt><dt><span class="section"><a href="#idp55506384">12.7. Classes and Hooks</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp49591728"></a>12.1. Client Classification Overview</h2></div></div></div><p>
      In certain cases it is useful to differentiate between different
      types of clients and treat them accordingly. Common reasons include:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
      The clients represent different pieces of topology, e.g. a cable
      modem is different to the clients behind that modem.
      </p></li><li class="listitem"><p>
      The clients have different behavior, e.g. a smart phone behaves
      differently to a laptop.
      </p></li><li class="listitem"><p>
      The clients require different values for some options, e.g. a docsis3.0
      cable modem requires different settings to docsis2.0 cable modem.
      </p></li></ul></div><p>
      </p><p>
      It is envisaged that client classification will be used for changing the
      behavior of almost any part of the DHCP message processing, including the assignment of
      leases from different pools, the assignment of different options (or different values of
      the same options) etc. In the current release of the software however, there are
      only three mechanisms that take
      advantage of client classification: subnet selection, assignment of different
      options and, for DHCPv4 cable modems, the setting of specific options for use with
      the TFTP server address and the boot file field.
      </p><p>
      The process of doing classification is conducted in three steps:
      </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
      Assess an incoming packet and assign it to zero or more classes.
      </p></li><li class="listitem"><p>
      Choose a subnet, possibly based on the class information.
      </p></li><li class="listitem"><p>
      Assign options, again possibly based on the class information.
      </p></li></ol></div><p>
      </p><p>
      When determining which options to include in the response the server will examine
      the union of options from all of the assigned classes. In the case two or more
      classes include the same option, the value from the first class examined will
      be used.  When choosing a subnet the server will iterate over all of the
      subnets that are feasible given the information found in the packet (client address,
      relay address etc). It will use the first subnet it finds that either doesn't
      have a class associated with it or that has a class which matches one of
      the packet's classes. In the future the processing order of the
      various classes may be specified but for now it is being left unspecified and
      may change in future releases.
      </p><p>
      As an example, imagine two classes.  Class "foo" defines values for an NTP server
      (option 42 in DHCPv4) and an SMTP server (option 69 in DHCPv4) while class
      "bar" defines values for an NTP server and a POP3 server (option 70 in DHCPv4).
      The server will examine the three options NTP, SMTP and POP3 and return any
      of them that the client requested.  As the NTP server was defined twice the
      server will choose only one of the values for the reply: the class from which the
      value is obtained is unspecified.
      </p><p>
      There are two methods of doing classification. The first is automatic and relies
      on examining the values in the vendor class options. Information from these
      options is extracted and a class name is constructed from it and added to
      the class list for the packet. The second allows you to specify an expression
      that is evaluated for each packet. If the result is true, the packet is
      a member of the class.
      </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
        Care should be taken with client classification as it is easy for
        clients that do not meet class criteria to be denied any service altogether.
      </p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="classification-using-vendor"></a>12.2. Using Vendor Class Information In Classification</h2></div></div></div><p>
      The server checks whether an incoming DHCPv4 packet includes
      the vendor class identifier option (60) or an incoming DHCPv6 packet
      includes the vendor class option (16). If it does, the content of that
      option is prepended with "VENDOR_CLASS_" and the result is interpreted
      as a class. For example, modern cable modems will send this option with
      value "docsis3.0" and so the packet will belong to
      class "VENDOR_CLASS_docsis3.0".
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="classification-using-expressions"></a>12.3. Using Expressions In Classification</h2></div></div></div><p>
      The expression portion of classification contains operators and values.
      All values are currently strings and operators take a string or strings and
      return another string. When all the operations have completed
      the result should be a value of "true" or "false".
      The packet belongs to
      the class (and the class name is added to the list of classes) if the result
      is "true". Expressions are written in standard format and can be nested.
      </p><p>
      Expressions are pre-processed during the parsing of the configuration file
      and converted to an internal representation. This allows certain types of
      errors to be caught and logged during parsing.  Examples of these errors
      include incorrect number or types of arguments to an operator.  The
      evaluation code will also check for this class of error and generally
      throw an exception, though they should not occur in a normally functioning
      system.
      </p><p>
      Other issues, for example the starting position of a substring being
      outside of the substring or an option not existing in the packet, result
      in the operator returning an empty string.
      </p><p>
      Expressions are a work in progress and the supported operators and
      values are limited. The expectation is that additional operators and values
      will be added over time, however it is expected the basic mechanisms will
      remain the same.
      </p><p>
        </p><div class="table"><a name="classification-values-list"></a><p class="title"><b>Table 12.1. List of Classification Values</b></p><div class="table-contents"><table summary="List of Classification Values" border="1"><colgroup><col class="name"><col class="example"><col class="description"></colgroup><thead><tr><th>Name</th><th>Example</th><th>Description</th></tr></thead><tbody><tr><td>String</td><td>'example'</td><td>A string</td></tr><tr><td>Hex String</td><td>0XABCD</td><td>A hexadecimal string</td></tr><tr><td>Integer</td><td>123</td><td>An integer value</td></tr><tr><td>Option Hex</td><td>option[code].hex</td><td>The value of the option with code "code" from the packet as hex</td></tr></tbody></table></div></div><p><br class="table-break">
      Hex Strings are converted into a string as expected.  The starting "0X" or
      "0x" is removed and if the string is an odd number of characters a
      "0" is prepended to it.
      </p><p>
      Integers in the expression are converted to strings
      when the expression is read into Kea.
      </p><p>
      "option[code].hex" extracts the value of the option with the given code
      from the incoming packet. If the packet doesn't contain the option, it
      returns the empty string. The string is presented as a byte string of
      the option payload without the type code or length fields.
      </p><p>
        </p><div class="table"><a name="classification-expressions-list"></a><p class="title"><b>Table 12.2. List of Classification Expressions</b></p><div class="table-contents"><table summary="List of Classification Expressions" border="1"><colgroup><col class="name"><col class="example"><col class="description"></colgroup><thead><tr><th>Name</th><th>Example</th><th>Description</th></tr></thead><tbody><tr><td>Equal</td><td>'foo' == 'bar'</td><td>Compare the two values and return "true" or "false"</td></tr><tr><td>Substring</td><td>substring('foobar',0,3)</td><td>Return the requested substring</td></tr></tbody></table></div></div><p><br class="table-break">
      </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp55587760"></a>12.3.1. Substring</h3></div></div></div>
        The substring operator "substring(value, start, length)" accepts both positive and
        negative values for the starting position and the length.  For "start", a value of
        0 is the first byte in the string while -1 is the last byte.  If the starting
        point is outside of the original string an empty string is returned.  "length"
        is the number of bytes to extract.  A negative number means to count towards
        the beginning of the string but doesn't include the byte pointed to by "start".
        The special value "all" means to return all bytes from start to the end of the
        string.  If length is longer than the remaining portion of the string then
        the entire remaining portion is returned.  Some examples may be helpful:

          <pre class="screen">
        substring('foobar', 0, 6) == 'foobar'
        substring('foobar', 3, 3) == 'bar'
        substring('foobar', 3, all) == 'bar'
        substring('foobar', 1, 4) == 'ooba'
        substring('foobar', -5, 4) == 'ooba'
        substring('foobar', -1, -3) == 'oba'
        substring('foobar', 4, -2) == 'ob'
        substring('foobar', 10, 2) == ''
          </pre></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
    The expression for each class is executed on each packet received.
    If the expressions are overly complex, the time taken to execute
    them may impact the performance of the server. If you need
    complex or time consuming expressions you should write a <a class="link" href="#hooks-libraries" title="Chapter 13. Hooks Libraries">hook</a> to perform the necessary work.
  </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="classification-configuring"></a>12.4. Configuring Classes</h2></div></div></div><p>
      A class contains three items: a name, a test expression and option data.
      The name must exist and must be unique amongst all classes. The test
      expression and option data are optional.
      </p><p>
      The test expression is a string containing the logical expression used to
      determine membership in the class.  The entire expression is in double
      quotes.
      </p><p>
      The option data is a list which defines any options that should be assigned
      to members of this class.
      </p><p>
      In the following example the class named "Client_foo" is defined.
      It is comprised of all clients who's client ids (option 61) start with the
      string "foo". Members of this class will be given 192.0.2.1 and
      192.0.2.2 as their domain name servers.

        </p><pre class="screen">
"Dhcp4": {
    "client-classes": [<strong class="userinput"><code>
        {
            "name": "Client_foo",
            "test": "substring(option[61].hex,0,3) == 'foo'",
            "option-data": [
                {
                    "name": "domain-name-servers",
                    "code": 6,
                    "space": "dhcp4",
                    "csv-format": true,
                    "data": "192.0.2.1, 192.0.2.2"
                }
            ]
        },
        ...
    ],</code></strong>
    ...
}</pre><p>
      </p><p>
      This example shows a client class being defined for use by the DHCPv6 server.
      In it the class named "Client_enterprise" is defined.  It is comprised
      of all clients who's client identifiers start with the given hex string (which
      would indicate a DUID based on an enterprise id of 0xAABBCCDD). Members of this
      class will be given an 2001:db8:0::1 and 2001:db8:2::1 as their domain name servers.
        </p><pre class="screen">
"Dhcp6": {
    "client-classes": [<strong class="userinput"><code>
        {
            "name": "Client_enterprise",
            "test": "substring(option[1].hex,0,6) == 0x0002AABBCCDD'",
            "option-data": [
                {
                    "name": "dns-servers",
                    "code": 23,
                    "space": "dhcp6",
                    "csv-format": true,
                    "data": "2001:db8:0::1, 2001:db8:2::1"
                }
            ]
        },
        ...
    ],</code></strong>
    ...
}</pre><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="classification-subnets"></a>12.5. Configuring Subnets With Class Information</h2></div></div></div><p>
        In certain cases it beneficial to restrict access to certain subnets
        only to clients that belong to a given class using the "client-class"
        keyword when defining the subnet.
      </p><p>
        Let's assume that the server is connected to a network segment that uses
        the 192.0.2.0/24 prefix. The Administrator of that network has decided
        that addresses from range 192.0.2.10 to 192.0.2.20 are going to be
        managed by the DHCP4 server. Only clients belonging to client class
        Client_foo  are allowed to use this subnet. Such a
        configuration can be achieved in the following way:
        </p><pre class="screen">
"Dhcp4": {
    "client-classes": [
        {
            "name": "Client_foo",
            "test": "substring(option[61].hex,0,3) == 'foo'",
            "option-data": [
                {
                    "name": "domain-name-servers",
                    "code": 6,
                    "space": "dhcp4",
                    "csv-format": true,
                    "data": "192.0.2.1, 192.0.2.2"
                }
            ]
        },
        ...
    ],<strong class="userinput"><code>
    "subnet4": [
        {
            "subnet": "192.0.2.0/24",
            "pools": [ { "pool": "192.0.2.10 - 192.0.2.20" } ],
            "client-class": "Client_foo"
        },
        ...
    ],</code></strong>,
    ...
}</pre><p>
      </p><p>
     	The following example shows restricting access to a DHCPv6 subnet.  This
        configuration will restrict use of the addresses 2001:db8:1::1 to
        2001:db8:1::FFFF to members of the "Client_enterprise" class.

        </p><pre class="screen">
"Dhcp6": {
    "client-classes": [
        {
            "name": "Client_enterprise",
            "test": "substring(option[1].hex,0,6) == 0x0002AABBCCDD'",
            "option-data": [
                {
                    "name": "dns-servers",
                    "code": 23,
                    "space": "dhcp6",
                    "csv-format": true,
                    "data": "2001:db8:0::1, 2001:db8:2::1"
                }
            ]
        },
        ...
    ], <strong class="userinput"><code>
    "subnet6": [
        {
            "subnet": "2001:db8:1::/64",
            "pools": [ { "pool": "2001:db8:1::-2001:db8:1::ffff" } ],
            "client-class": "Client_enterprise"
        }
    ],</code></strong>
    ...
}</pre><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp55504128"></a>12.6. Using Classes</h2></div></div></div><p>
      Currently classes can be used for two functions.  They can supply options
      to the members of the class and they can be used to choose a subnet from which an
      address will be assigned to the class member.
      </p><p>
      When supplying options, options defined as part of the class definition
      are considered "class globals".  They will override any global options that
      may be defined and in turn will be overridden by any options defined for an
      individual subnet.
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp55506384"></a>12.7. Classes and Hooks</h2></div></div></div><p>
      You may use a hook to classify your packets. This may be useful if the
      expression would either be complex or time consuming and be easier or
      better to write as code.  Once the hook has added the proper class name
      to the packet the rest of the classification system will work as normal
      in choosing a subnet and selecting options.  For a description of the
      hooks see <a class="xref" href="#hooks-libraries" title="Chapter 13. Hooks Libraries">Chapter 13, <i>Hooks Libraries</i></a>, for a description on
      configuring he classes see <a class="xref" href="#classification-configuring" title="12.4. Configuring Classes">Section 12.4, “Configuring Classes”</a>
      and <a class="xref" href="#classification-subnets" title="12.5. Configuring Subnets With Class Information">Section 12.5, “Configuring Subnets With Class Information”</a>.
      </p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="hooks-libraries"></a>Chapter 13. Hooks Libraries</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#hooks-libraries-introduction">13.1. Introduction</a></span></dt><dt><span class="section"><a href="#idp52289920">13.2. Configuring Hooks Libraries</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="hooks-libraries-introduction"></a>13.1. Introduction</h2></div></div></div><p>
      Although Kea offers a lot of flexibility, there may be cases where
      its behavior needs customisation.  To accommodate this possibility,
      Kea includes the idea of "Hooks".  This feature lets Kea load one
      or more dynamically-linked libraries (known as "hooks libraries")
      and, at various points in its processing ("hook points"), call
      functions in them.  Those functions perform whatever custom
      processing is required.
      </p><p>
      Hooks libraries are attached to individual Kea processes, not to
      Kea as a whole.  This means (for example) that it is possible
      to associate one set of libraries with the DHCP4 server and a
      different set to the DHCP6 server.
      </p><p>
      Another point to note is that it is possible for a process to
      load multiple libraries.  When processing reaches a hook point,
      Kea calls the hooks library functions attached to it.  If multiple
      libraries have attached a function to a given hook point, Kea calls
      all of them, in the order in which the libraries are specified in
      the configuration file. The order may be important: consult the
      documentation of the libraries to see if this is the case.
      </p><p>
      The next section describes how to configure hooks libraries. If you
      are interested in writing your own hooks library, information can be
      found in the <a class="ulink" href="http://git.kea.isc.org/~tester/kea/doxygen" target="_top">Kea
      Developer's Guide</a>.
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp52289920"></a>13.2. Configuring Hooks Libraries</h2></div></div></div><p>
      The hooks libraries for a given process are configured using the
      <span class="command"><strong>hooks-libraries</strong></span> keyword in the
      configuration for that process. (Note that
      the word "hooks" is plural).  The value of the keyword
      is an array of map structures, each structure corresponding to a hooks
      library.  For example, to set up two hooks libraries for the DHCPv4
      server, the configuration would be:
</p><pre class="screen">
<strong class="userinput"><code>"Dhcp4": {
    :
    "hooks-libraries": [
        {
            "library": "/opt/charging.so"
        },
        {
            "library": "/opt/local/notification.so"
        }
    ]
    :
}</code></strong>
</pre><p>
      </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
        This is a change to the syntax used in Kea 0.9.2 and earlier, where
        hooks-libraries was a list of strings, each string being the name of
        a library.  The change has been made in Kea 1.0 to facilitate the
        specification of library-specific parameters, a feature that will be
        added to a future version of Kea.
      </p></div><p>
      Notes:
        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: bullet; "><li class="listitem" style="list-style-type: disc"><p>
          The full path to each library should be given.
          </p></li><li class="listitem" style="list-style-type: disc"><p>
          As noted above, order may be important - consult the documentation for
          each library.
          </p></li><li class="listitem" style="list-style-type: disc"><p>
          An empty list has the same effect as omitting the
          <span class="command"><strong>hooks-libraries</strong></span> configuration element all together.
          </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
          There is one case where this is not true: if Kea
          is running with a configuration that contains a
          <span class="command"><strong>hooks-libraries</strong></span> item, and that item is
          removed and the configuration reloaded, the removal will be
          ignored and the libraries remain loaded.  As a workaround,
          instead of removing the <span class="command"><strong>hooks-libraries</strong></span>
          item, change it to an empty list.  This will be fixed in a
          future version of Kea.
          </p></div></li></ul></div><p>
      </p><p>
      At the present time, only the kea-dhcp4 and kea-dhcp6 processes support
      hooks libraries.
      </p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="stats"></a>Chapter 14. Statistics</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#idp54285232">14.1. Statistics Overview</a></span></dt><dt><span class="section"><a href="#stats-lifecycle">14.2. Statistics Lifecycle</a></span></dt><dt><span class="section"><a href="#command-stats">14.3. Commands for Manipulating Statistics</a></span></dt><dd><dl><dt><span class="section"><a href="#command-statistic-get">14.3.1. statistic-get command</a></span></dt><dt><span class="section"><a href="#command-statistic-reset">14.3.2. statistic-reset command</a></span></dt><dt><span class="section"><a href="#command-statistic-remove">14.3.3. statistic-remove command</a></span></dt><dt><span class="section"><a href="#command-statistic-get-all">14.3.4. statistic-get-all command</a></span></dt><dt><span class="section"><a href="#command-statistic-reset-all">14.3.5. statistic-reset-all command</a></span></dt><dt><span class="section"><a href="#command-statistic-remove-all">14.3.6. statistic-remove-all command</a></span></dt></dl></dd></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp54285232"></a>14.1. Statistics Overview</h2></div></div></div><p>Both Kea DHCP servers support statistics gathering since
    0.9.2-beta version. A working DHCP server encounters various events
    that can cause certain statistics to be collected. For
    example, a DHCPv4 server may receive a packet (pkt4-received
    statistic increases by one) that after parsing was identifier as
    DHCPDISCOVER (pkt4-discover-received). The Server processed it and
    decided to send DHCPOFFER representing its answer (pkt4-offer-sent
    and pkt4-sent statistics increase by one). Such events happen
    frequently, so it is not uncommon for the statistics to have
    values in high thousands. They can serve as an easy and powerful
    tool for observing a server's and network's health. For example,
    if pkt4-received statistic stops growing, it means that the
    clients' packets are not reaching the server.</p><p>There are four types of statistics:
    </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="emphasis"><em>integer</em></span> - this is the most common type.  It
        is implemented as 64 bit integer (int64_t in C++), so it can hold any
        value between -2^63 to 2^63 -1.</li><li class="listitem"><span class="emphasis"><em>floating point</em></span> - this type is intended to
        store floating point precision. It is implemented as double C++ type.
        </li><li class="listitem"><span class="emphasis"><em>duration</em></span> - this type is intended for
        recording time periods. It uses boost::posix_time::time_duration type,
        which stores hours, minutes, seconds and microseconds.</li><li class="listitem"><span class="emphasis"><em>string</em></span> - this type is intended for
        recording statistics in textual form. It uses std::string C++ type.
        </li></ul></div><p>
    </p><p>
      During normal operation, DHCPv4 and DHCPv6 servers gather statistics.
      For a list of DHCPv4 and DHCPv6 statistics, see <a class="xref" href="#dhcp4-stats" title="7.7. Statistics in DHCPv4 server">Section 7.7, “Statistics in DHCPv4 server”</a> and <a class="xref" href="#dhcp6-stats" title="8.11. Statistics in DHCPv6 server">Section 8.11, “Statistics in DHCPv6 server”</a>, respectively.
    </p><p>
      To extract data from the statistics module, the control channel can be
      used. See <a class="xref" href="#ctrl-channel" title="Chapter 15. Management API">Chapter 15, <i>Management API</i></a> for details. It is possible to
      retrieve a single or all statistics, reset statistics (i.e. set to neutral
      value, typically zero) or even remove completely a single or all
      statistics. See section <a class="xref" href="#command-stats" title="14.3. Commands for Manipulating Statistics">Section 14.3, “Commands for Manipulating Statistics”</a> for a list of
      statistic oriented commands.
    </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="stats-lifecycle"></a>14.2. Statistics Lifecycle</h2></div></div></div><p>
      It is useful to understand how the Statistics Manager module works. When
      the server starts operation, the manager is empty and does not have any
      statistics. When <span class="command"><strong>statistic-get-all</strong></span> is executed, an
      empty list is returned. Once the server performs an operation that causes
      a statistic to change, the related statistic will be created. In the general
      case once a statistic is recorded even once, it is kept in the manager, until
      explicitly removed, by <span class="command"><strong>statistic-remove</strong></span> or
       <span class="command"><strong>statistic-remove-all</strong></span> being called or the server is shut
      down. Per subnet statistics are explicitly removed when reconfiguration
      takes place.
    </p><p>
      Statistics are considered run-time properties, so they are not retained
      after server restart.
    </p><p>
      Removing a statistic that is updated frequently makes little sense as it
      will be re-added when the server code next records that statistic.
      The <span class="command"><strong>statistic-remove</strong></span> and
      <span class="command"><strong>statistic-remove-all</strong></span> commands are intended to remove
      statistics that are not expected to be observed in the near future. For
      example, a misconfigured device in a network may cause clients to report
      duplicate addresses, so the server will report increasing values of
      pkt4-decline-received. Once the problem is found and the device is
      removed, the system administrator may want to remove the
      pkt4-decline-received statistic, so it won't be reported anymore. If a
      duplicate address is detected ever again, the server will add this
      statistic back.
    </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="command-stats"></a>14.3. Commands for Manipulating Statistics</h2></div></div></div><p>
      There are several commands defined that can be used for accessing (-get),
      resetting to zero or neutral value (-reset) or even removing a statistic
      completely (-remove). The difference between reset and remove is somewhat
      subtle.  The reset command sets the value of the statistic to zero or neutral
      value. After this operation, the statistic will have a value of 0 (integer),
      0.0 (float), 0h0m0s0us (duration) or "" (string). When asked for, a statistic
      with the values mentioned will be returned. <span class="command"><strong>Remove</strong></span> removes
      a statistic completely, so the statistic will not be reported anymore. Please
      note that the server code may add it back if there's a reason to record
      it.
    </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="command-statistic-get"></a>14.3.1. statistic-get command</h3></div></div></div><p>
        <span class="emphasis"><em>statistic-get</em></span> command retrieves a single
        statistic. It takes a single string parameter called
        <span class="command"><strong>name</strong></span> that specifies the statistic name.  An example
        command may look like this:
</p><pre class="screen">
{
    "command": "statistic-get",
    "arguments": {
        "name": "<strong class="userinput"><code>pkt4-received</code></strong>"
    }
}
</pre><p>
      </p><p>
        The server will respond with details of the requested statistic, with result
        set to 0 indicating success and the specified statistic as the value of
        "arguments" parameter. If the requested statistic is not found, the response
        will contain an empty map, i.e. only { } as argument, but the status
        code will still be set to success (0).
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="command-statistic-reset"></a>14.3.2. statistic-reset command</h3></div></div></div><p>
        <span class="emphasis"><em>statistic-reset</em></span> command sets the specified statistic
        to its neutral value: 0 for integer, 0.0 for float, 0h0m0s0us for time
        duration and "" for string type. It takes a single string parameter
        called <span class="command"><strong>name</strong></span> that specifies the statistic name.  An
        example command may look like this:
</p><pre class="screen">
{
    "command": "statistic-reset",
    "arguments": {
        "name": "<strong class="userinput"><code>pkt4-received</code></strong>"
    }
}
</pre><p>
      </p><p>
        If the specific statistic is found and reset was successful, the
        server will respond with a status of 0, indicating success and an empty
        parameters field. If an error is encountered (e.g. requested statistic
        was not found), the server will return a status code of 1 (error)
        and the text field will contain the error description.
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="command-statistic-remove"></a>14.3.3. statistic-remove command</h3></div></div></div><p>
        <span class="emphasis"><em>statistic-remove</em></span> command attempts to delete a single
        statistic. It takes a single string parameter called
        <span class="command"><strong>name</strong></span> that specifies the statistic name.  An example
        command may look like this:
</p><pre class="screen">
{
    "command": "statistic-remove",
    "arguments": {
        "name": "<strong class="userinput"><code>pkt4-received</code></strong>"
    }
}
</pre><p>
      </p><p>
        If the specific statistic is found and its removal was successful, the
        server will respond with a status of 0, indicating success and an empty
        parameters field. If an error is encountered (e.g. requested statistic
        was not found), the server will return a status code of 1 (error)
        and the text field will contain the error description.
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="command-statistic-get-all"></a>14.3.4. statistic-get-all command</h3></div></div></div><p>
        <span class="emphasis"><em>statistic-get-all</em></span> command retrieves all statistics
        recorded. An example command may look like this:
</p><pre class="screen">
{
    "command": "statistic-get-all",
    "arguments": { }
}
</pre><p>
      </p><p>
        The server will respond with details of all recorded statistics, with result
        set to 0 indicating that it iterated over all statistics (even when
        the total number of statistics is zero).
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="command-statistic-reset-all"></a>14.3.5. statistic-reset-all command</h3></div></div></div><p>
        <span class="emphasis"><em>statistic-reset</em></span> command sets all statistics to
        their neutral values: 0 for integer, 0.0 for float, 0h0m0s0us for time
        duration and "" for string type. An example command may look like this:
</p><pre class="screen">
{
    "command": "statistic-reset-all",
    "arguments": { }
}
</pre><p>
      </p><p>
        If the operation is successful, the server will respond with a status of
        0, indicating success and an empty parameters field. If an error is
        encountered, the server will return a status code of 1 (error) and the text
        field will contain the error description.
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="command-statistic-remove-all"></a>14.3.6. statistic-remove-all command</h3></div></div></div><p>
        <span class="emphasis"><em>statistic-remove-all</em></span> command attempts to delete all
        statistics. An example command may look like this:
</p><pre class="screen">
{
    "command": "statistic-remove-all",
    "arguments": { }
}
</pre><p>
      </p><p>
        If the removal of all statistics was successful, the server will respond
        with a status of 0, indicating success and an empty parameters field. If
        an error is encountered, the server will return a status code of 1 (error)
        and the text field will contain the error description.
      </p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="ctrl-channel"></a>Chapter 15. Management API</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#ctrl-channel-syntax">15.1. Data syntax</a></span></dt><dt><span class="section"><a href="#ctrl-channel-client">15.2. Using control channel</a></span></dt><dt><span class="section"><a href="#commands-common">15.3. Commands supported by both DHCPv4 and DHCPv6 servers</a></span></dt><dd><dl><dt><span class="section"><a href="#command-leases-reclaim">15.3.1. leases-reclaim command</a></span></dt><dt><span class="section"><a href="#command-list-commands">15.3.2. list-commands command</a></span></dt><dt><span class="section"><a href="#command-shutdown">15.3.3. shutdown command</a></span></dt></dl></dd></dl></div><p>A classic approach to daemon configuration assumes that
    the server's configuration is stored in the configuration files
    and when the configuration is changed, the daemon is restarted.
    This approach has the significant disadvantage of introducing periods
    of downtime, when client traffic is not handled. Another risk
    is that if the new configuration is invalid for whatever reason,
    the server may refuse to start, which will further extend the
    downtime period, until the issue is resolved.</p><p>To avoid such problems, both DHCPv4 and DHCPv6 servers
    introduced support for a mechanism that will allow
    on-line reconfiguration, without requiring server shutdown.
    Both servers can be instructed to open control sockets, which
    is a communication channel. The server is able to receive
    commands on that channel, act on them and report back status.
    While the set of commands supported in Kea 0.9.2 is limited,
    the number is expected to grow over time.</p><p>Currently the only supported type of control channel
    is UNIX stream socket. For details how to configure it, see
    <a class="xref" href="#dhcp4-ctrl-channel" title="7.8. Management API for the DHCPv4 server">Section 7.8, “Management API for the DHCPv4 server”</a> and <a class="xref" href="#dhcp6-ctrl-channel" title="8.12. Management API for the DHCPv6 server">Section 8.12, “Management API for the DHCPv6 server”</a>. It is likely that support
    for other control channel types will be added in the future.
    </p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ctrl-channel-syntax"></a>15.1. Data syntax</h2></div></div></div><p>Communication over control channel is conducted using JSON
    structures. If configured, Kea will open a socket and will listen
    for any incoming connections. A process connecting to this socket
    is expected to send JSON commands structured as follows:

</p><pre class="screen">
{
    "command": "foo",
    "arguments": {
	"param1": "value1",
	"param2": "value2",
	...
    }
}
</pre><p>

    <span class="command"><strong>command</strong></span> is the name of command to execute and
    is mandatory. <span class="command"><strong>arguments</strong></span> is a map of parameters
    required to carry out the given command.  The exact content and
    format is command specific.</p><p>The server will process the incoming command and then send a
    response of the form:
</p><pre class="screen">
{
    "result": 0|1,
    "text": "textual description",
    "arguments": {
	"argument1": "value1",
	"argument2": "value2",
	...
    }
}
</pre><p>
    <span class="command"><strong>result</strong></span> indicates the outcome of the command. A value of 0
    means success while any non-zero value designates an error. Currently 1 is
    used as a generic error, but additional error codes may be added in the
    future. <span class="command"><strong>text</strong></span> field typically appears when result is
    non-zero and contains a description of the error encountered, but it may
    also appear for successful results. That's command specific.
    <span class="command"><strong>arguments</strong></span> is a map of additional data values returned by
    the server, specific to the command issued. The map is always present, even
    if it contains no data values.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="ctrl-channel-client"></a>15.2. Using control channel</h2></div></div></div><p>ISC does not provide a client for using control channel.  The primary
    reason for that is the expectation is that the entity using control channel
    is typically an IPAM or similar network management/monitoring software which
    may have quite varied expectations regarding the client and is even likely to
    be written in languages different than C or C++. Therefore we only provide
    examples how one can take advantage of the API.</p><p>The easiest way is to use a tool called <span class="command"><strong>socat</strong></span>,
    a tool available from <a class="ulink" href="http://www.dest-unreach.org/socat/" target="_top">socat
    homepage</a>, but it is also widely available in Linux and BSD
    distributions. Once Kea is started, one could connect to the control
    interface using the following command:
</p><pre class="screen">
$ socat UNIX:/path/to/the/kea/socket -
</pre><p>
where <span class="command"><strong>/path/to/the/kea/socket</strong></span> is the path specified in the
<span class="command"><strong>Dhcp4/control-socket/socket-name</strong></span> parameter in the Kea
configuration file.</p><p>It is also easy to open UNIX socket programmatically. An example of
    such a simplistic client written in C is available in the Kea Developer's
    Guide, chapter Control Channel Overview, section Using Control Channel.</p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="commands-common"></a>15.3. Commands supported by both DHCPv4 and DHCPv6 servers</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="command-leases-reclaim"></a>15.3.1. leases-reclaim command</h3></div></div></div><p>
          <span class="emphasis"><em>leases-reclaim</em></span> command instructs the server to
          reclaim all expired leases immediately. The command has the following
          JSON syntax:
</p><pre class="screen">
{
    "command": "leases-reclaim",
    "arguments": {
        "remove": true
    }
}
</pre><p>
        </p><p>The <span class="emphasis"><em>remove</em></span> boolean parameter is mandatory
        and it indicates whether the reclaimed leases should be removed from
        the lease database (if true), or they should be left in the
        <span class="emphasis"><em>expired-reclaimed</em></span> state (if false). The latter
        facilitates lease affinity, i.e. ability to re-assign expired lease to
        the same client which used this lease before. See
        <a class="xref" href="#lease-affinity" title="9.3. Configuring Lease Affinity">Section 9.3, “Configuring Lease Affinity”</a> for the details. Also, see
        <a class="xref" href="#lease-reclamation" title="9.1. Lease Reclamation">Section 9.1, “Lease Reclamation”</a> for the general information
        about the processing of expired leases (leases reclamation).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="command-list-commands"></a>15.3.2. list-commands command</h3></div></div></div><p>
	<span class="emphasis"><em>list-commands</em></span> command retrieves a list of all
	commands supported by the server. It does not take any arguments.
	An example command may look like this:
</p><pre class="screen">
{
    "command": "list-commands",
    "arguments": { }
}
</pre><p>
      </p><p>
	The server will respond with a list of all supported commands. The
	arguments element will be a list of strings. Each string will convey
	one supported command.
      </p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="command-shutdown"></a>15.3.3. shutdown command</h3></div></div></div><p>
	<span class="emphasis"><em>shutdown</em></span> command instructs the server to initiate
	its shutdown procedure. It is the equivalent of sending a SIGTERM signal
	to the process. This command does not take any arguments.  An example
	command may look like this:
</p><pre class="screen">
{
    "command": "shutdown",
    "arguments": { }
}
</pre><p>
      </p><p>
	The server will respond with a confirmation that the shutdown procedure
	has been initiated.
      </p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="libdhcp"></a>Chapter 16. libdhcp++ library</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#iface-detect">16.1. Interface detection and Socket handling</a></span></dt></dl></div><p>
      libdhcp++ is a common library written in C++ that handles
      many DHCP-related tasks, including:
      </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">DHCPv4 and DHCPv6 packets parsing, manipulation and assembly</li><li class="listitem">Option parsing, manipulation and assembly</li><li class="listitem">Network interface detection</li><li class="listitem">Socket operations such as creation, data transmission and reception and socket closing.</li></ul></div><p>
    </p><p>
    While this library is currently used by Kea, it is designed to
    be a portable, universal library, useful for any kind of DHCP-related software.
    </p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="iface-detect"></a>16.1. Interface detection and Socket handling</h2></div></div></div><p>Both the DHCPv4 and DHCPv6 components share network
      interface detection routines. Interface detection is
      currently supported on Linux, all BSD family (FreeBSD, NetBSD,
      OpenBSD), Mac OS X and Solaris 11 systems.</p><p>DHCPv4 requires special raw socket processing to send and receive
      packets from hosts that do not have IPv4 address assigned yet. Support
      for this operation is implemented on Linux, FreeBSD, NetBSD and OpenBSD.
      It is likely that DHCPv4 component will not work in certain cases on
      other systems.</p></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="logging"></a>Chapter 17. Logging</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#idp54587936">17.1. Logging Configuration</a></span></dt><dd><dl><dt><span class="section"><a href="#idp50497936">17.1.1. Loggers</a></span></dt><dt><span class="section"><a href="#idp54763552">17.1.2. Output Options</a></span></dt><dt><span class="section"><a href="#idp54783056">17.1.3. Example Logger Configurations</a></span></dt></dl></dd><dt><span class="section"><a href="#logging-message-format">17.2. Logging Message Format</a></span></dt><dt><span class="section"><a href="#idp52337216">17.3. Logging During Kea Startup</a></span></dt></dl></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp54587936"></a>17.1. Logging Configuration</h2></div></div></div><p>
        During its operation Kea may produce many messages. They differ in
        severity (some are more important than others) and source (some are
        produced by specific components, e.g. hooks). It is useful to understand
        which log messages are needed and which are not and configure your
        logging appropriately. For example, debug level messages can be safely
        ignored in a typical deployment. They are, however, very useful when
        debugging a problem.
      </p><p>
        The logging system in Kea is configured through the
        <em class="replaceable"><code>Logging</code></em> structure in your configuration
        file. All daemons (e.g. DHCPv4 and DHCPv6 servers) will use the
        configuration in the <em class="replaceable"><code>Logging</code></em> structure to see
        what should be logged and to where. This allows for sharing identical
        logging configuration between daemons.
      </p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp50497936"></a>17.1.1. Loggers</h3></div></div></div><p>
          Within Kea, a message is logged through an entity called a
          "logger". Different components log messages through different
          loggers, and each logger can be configured independently of
          one another. Some components, in particular the DHCP server
          processes, may use multiple loggers to log messages pertaining
          to different logical functions of the component. For example,
          the DHCPv4 server is using one logger for messages
          pertaining to packet reception and transmission, another
          logger for messages related to lease allocation and so on.
          Some of the libraries used by the Kea servers, e.g. libdhcpsrv
          or libhooks library, use their own loggers.
        </p><p>
          Users implementing hooks libraries (code attached to the server at
          runtime) are responsible for creating the loggers used by those
          libraries. Such loggers should have unique names, different
          from the logger names used by Kea. In this way the
          messages emitted from the hooks library can be distingued from
          messages issued by the core Kea code. Unique names also allow
          the loggers to be configured independently of loggers used
          by Kea.  Whenever it makes sense, a hook library can use multiple
          loggers to log messages pertaining to different logical parts
          of the library.
        </p><p>
          In the <span class="quote"><span class="quote">Logging</span></span> structure of a configuration file
          you can specify the configuration for zero or more loggers
          (including loggers used by the proprietary hooks libraries). If
          there are no loggers specified, the code will use default values which
          cause Kea to log messages on at least INFO severity to standard
          output.
          
        </p><p>
          The three most important elements of a logger configuration
          are the <code class="option">name</code> (the component that is
          generating the messages), the <code class="option">severity</code>
          (what to log), and the <code class="option">output_options</code>
          (where to log).
        </p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="idp54842496"></a>17.1.1.1. name (string)</h4></div></div></div><p>
            Each logger in the system has a name, the name being that of the
            component binary file using it to log messages. For instance, if you
            want to configure logging for the DHCPv4 server, you add an entry
            for a logger named <span class="quote"><span class="quote">kea-dhcp4</span></span>. This configuration will
            then be used by the loggers in the DHCPv4 server, and all the
            libraries used by it (unless a library defines its own logger and
            there is specific logger configuration that applies to that logger).
          </p><p>
            When diagnosing the problem with the server's operation, it is often
            desired to use the DEBUG logging level to obtain the verbose output
            from the server and libraries it uses. However, high verbosity may
            be an overkill for the logging system in cases when the server
            is processing high volume traffic. To mitigate this problem, Kea
            is using multiple loggers, which can be configured independently
            and which are responsible for logging messages from different
            functional parts of the server. If the user, trying to diagnose the
            problem, has a reasonably high confidence that the problem origins
            in a specific function of the server, or the problem is related
            to the specific type of operation, he may enable high verbosity
            only for the relevant logger, thus limiting the debug messages
            to the required minimum.
          </p><p>
            The loggers are associated with a particular library or binary
            of Kea. However, each library or binary may (and usually does)
            include multiple loggers. For example, the DHCPv4 server binary
            contains separate loggers for: packet parsing, for dropped packets,
            for callouts etc. Each logger "derives" its configuration from the
            root logger. In the typical case, the root logger configuration
            is the only logging configuration specified in the configuration
            file. Creating a specific configuration for the selected logger,
            thus overriding the configuration settings specified in the
            root logger configuration, requires putting its configuration
            aside of the root logger's configuration with some of the
            parameters modified.
          </p><p>
            To illustrate this, suppose you are using the DHCPv4 server
            with the root logger <span class="quote"><span class="quote">kea-dhcp4</span></span> logging at the
            INFO level. In order to enable DEBUG verbosity for the DHCPv4
            packet drops, you must create configuration entry for the
            logger called <span class="quote"><span class="quote">kea-dhcp4.bad-packets</span></span> and specify
            severity DEBUG for this logger. All other configuration
            parameters may be omited for this logger if the logger should
            use the default values specified in the root logger's
            configuration.
          </p><p>
            If there are multiple logger specifications in the configuration
            that might match a particular logger, the specification with the
            more specific logger name takes precedence. For example, if there
            are entries for both <span class="quote"><span class="quote">kea-dhcp4</span></span> and
            <span class="quote"><span class="quote">kea-dhcp4.dhcpsrv</span></span>, the DHCPv4 server — and all
            libraries it uses that are not dhcpsrv — will log messages
            according to the configuration in the first entry
            (<span class="quote"><span class="quote">kea-dhcp4</span></span>).
          </p><p>
            Currently defined loggers are:
          </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><span class="command"><strong>kea-dhcp4</strong></span> - this is the root logger for
            the DHCPv4 server. All components used by the DHCPv4 server inherit
            the settings from this logger if there is no specialized logger
            provided.</li><li class="listitem"><span class="command"><strong>kea-dhcp4.alloc-engine</strong></span> - this is the
            logger used by the lease allocation engine, which is responsible
            for managing leases in the lease database, i.e. create, modify
            and remove DHCPv4 leases as a result of processing messages from
            the clients.</li><li class="listitem"><span class="command"><strong>kea-dhcp4.bad-packets</strong></span> - this is the
            logger used by the DHCPv4 server daemon for logging inbound client
            packets that were dropped or to which the server responded with a
            DHCPNAK. The allows administrators to configure a separate log
            output that contains only packet drop and reject entries.</li><li class="listitem"><span class="command"><strong>kea-dhcp4.callouts</strong></span> - this logger is used
            to log messages pertaining to the callouts registration and execution
            for the particular hook point.
            </li><li class="listitem"><span class="command"><strong>kea-dhcp4.commands</strong></span> - this logger is used
            to log messages relating to the handling of commands received by the
            the DHCPv4 server over the command channel.
            </li><li class="listitem"><span class="command"><strong>kea-dhcp4.ddns</strong></span> - this logger is used by
            the DHCPv4 server to log messages related to the Client FQDN and
            Hostname option processing. It also includes log messages
            related to the relevant DNS updates.</li><li class="listitem"><span class="command"><strong>kea-dhcp4.dhcp4</strong></span> - this is the logger
            by the DHCPv4 server daemon to log basic operations.</li><li class="listitem"><span class="command"><strong>kea-dhcp4.dhcpsrv</strong></span> - this is a base
            logger for the libdhcpsrv library.</li><li class="listitem"><span class="command"><strong>kea-dhcp4.eval</strong></span> - this logger is used
            to log messages relating to the client classification expression
            evaluation code.</li><li class="listitem"><span class="command"><strong>kea-dhcp4.hooks</strong></span> - this logger is used
            to log messages related to management of hooks libraries, e.g.
            registration and deregistration of the libraries, and to the
            initialization of the callouts execution for various hook points
            within the DHCPv4 server.</li><li class="listitem"><span class="command"><strong>kea-dhcp4.hosts</strong></span> - this logger is used
            within the libdhcpsrv and it logs messages related to the management
            of the DHCPv4 host reservations, i.e. retrieval of the reservations
            and adding new reservations.</li><li class="listitem"><span class="command"><strong>kea-dhcp4.leases</strong></span> - this logger is used
            by the DHCPv4 server to log messages related to the lease allocation.
            The messages include detailed information about the allocated or
            offered leases, errors during the lease allocation etc.
            </li><li class="listitem"><span class="command"><strong>kea-dhcp4.options</strong></span> - this logger is
            used by the DHCPv4 server to log messages related to processing
            of the options in the DHCPv4 messages, i.e. parsing options,
            encoding options into on-wire format and packet classification
            using options contained in the received packets.</li><li class="listitem"><span class="command"><strong>kea-dhcp4.packets</strong></span> - this logger
            is mostly used to log messages related to transmission of the DHCPv4
            packets, i.e. packet reception and sending a response. Such messages
            include the information about the source and destination IP addresses
            and interfaces used to transmit packets. This logger is also used
            to log messages related to subnet selection, as this selection is
            usually based on the IP addresses and/or interface names, which can
            be retrieved from the received packet, even before the DHCPv4 message
            carried in the packet is parsed.
            </li><li class="listitem"><span class="command"><strong>kea-dhcp6</strong></span> - this is the root logger for
            the DHCPv6 server. All components used by the DHCPv6 server inherit
            the settings from this logger if there is no specialized logger
            provided.</li><li class="listitem"><span class="command"><strong>kea-dhcp6.alloc-engine</strong></span> - this is the
            logger used by the lease allocation engine, which is responsible
            for managing leases in the lease database, i.e. create, modify
            and remove DHCPv6 leases as a result of processing messages from
            the clients.</li><li class="listitem"><span class="command"><strong>kea-dhcp6.bad-packets</strong></span> - this is the
            logger used by the DHCPv6 server daemon for logging inbound client
            packets that were dropped.</li><li class="listitem"><span class="command"><strong>kea-dhcp6.callouts</strong></span> - this logger is used
            to log messages pertaining to the callouts registration and execution
            for the particular hook point.
            </li><li class="listitem"><span class="command"><strong>kea-dhcp6.commands</strong></span> - this logger is used
            to log messages relating to the handling of commands received by the
            the DHCPv6 server over the command channel.
            </li><li class="listitem"><span class="command"><strong>kea-dhcp6.ddns</strong></span> - this logger is used by
            the DHCPv6 server to log messages related to the Client FQDN option
            processing. It also includes log messages related to the relevant
            DNS updates.</li><li class="listitem"><span class="command"><strong>kea-dhcp6.dhcp6</strong></span> - this is the logger
            used DHCPv6 server daemon to log basic operations.</li><li class="listitem"><span class="command"><strong>kea-dhcp6.dhcpsrv</strong></span> - this is a base
            logger for the libdhcpsrv library.</li><li class="listitem"><span class="command"><strong>kea-dhcp6.eval</strong></span> - this logger is used
            to log messages relating to the client classification expression
            evaluation code.</li><li class="listitem"><span class="command"><strong>kea-dhcp6.hooks</strong></span> - this logger is used
            to log messages related to management of hooks libraries, e.g.
            registration and deregistration of the libraries, and to the
            initialization of the callouts execution for various hook points
            within the DHCPv6 server.</li><li class="listitem"><span class="command"><strong>kea-dhcp6.hosts</strong></span> - this logger is used
            within the libdhcpsrv and it logs messages related to the management
            of the DHCPv6 host reservations, i.e. retrieval of the reservations
            and adding new reservations.</li><li class="listitem"><span class="command"><strong>kea-dhcp6.leases</strong></span> - this logger is used
            by the DHCPv6 server to log messages related to the lease allocation.
            The messages include detailed information about the allocated or
            offered leases, errors during the lease allocation etc.
            </li><li class="listitem"><span class="command"><strong>kea-dhcp6.options</strong></span> - this logger is
            used by the DHCPv6 server to log messages related to processing
            of the options in the DHCPv6 messages, i.e. parsing options,
            encoding options into on-wire format and packet classification
            using options contained in the received packets.</li><li class="listitem"><span class="command"><strong>kea-dhcp6.packets</strong></span> - this logger
            is mostly used to log messages related to transmission of the DHCPv6
            packets, i.e. packet reception and sending a response. Such messages
            include the information about the source and destination IP addresses
            and interfaces used to transmit packets. This logger is also used
            to log messages related to subnet selection, as this selection is
            usually based on the IP addresses and/or interface names, which can
            be retrieved from the received packet, even before the DHCPv6 message
            carried in the packet is parsed.
            </li><li class="listitem"><span class="command"><strong>kea-dhcp-ddns</strong></span> - this is the root logger for
            the kea-dhcp-ddns daemon. All components used by this daemon inherit
            the settings from this logger if there is no specialized logger
            provided.</li><li class="listitem"><span class="command"><strong>kea-dhcp-ddns.dhcpddns</strong></span> - this is the logger
            used by the kea-dhcp-ddns daemon for logging configuration and global
            event information.  This logger does not specify logging settings
            for libraries used by the daemon.</li><li class="listitem"><span class="command"><strong>kea-dhcp-ddns.dhcp-to-d2</strong></span> - this is the logger
            used by the kea-dhcp-ddns daemon for logging information about events
            dealing with receiving messages from the DHCP servers and adding them
            to the queue for processing.</li><li class="listitem"><span class="command"><strong>kea-dhcp-ddns.d2-to-dns</strong></span> - this is the logger
            used by the kea-dhcp-ddns daemon for logging information about events
            dealing with sending and receiving messages with the DNS servers.
            </li></ul></div><p>
          Note that user-defined hook libraries should not use any of those
          loggers, and should define new loggers with names that correspond to
          the libraries using them. Suppose that the user created the library called
          <span class="quote"><span class="quote">libpacket-capture</span></span> to dump packets received and
          transmitted by the server to the file. The appropriate name for the
          logger could be <span class="command"><strong>kea-dhcp4.packet-capture</strong></span>. Note
          that the hook library implementor only specifies the second part
          of this name, i.e. <span class="quote"><span class="quote">packet-capture</span></span>. The first part is
          a root logger name and is prepended by the Kea logging system.
          It is also important to note that since this new logger is a child
          of a root logger, it inherits the configuration from the root logger,
          unless there is a separate configuration entry for the child logger
          which overrides the default configuration.
        </p><p>
          The list of loggers above excludes any loggers implemented in hooks
          libraries. Please consult the documentation of the specific hooks
          libraries for the names of loggers they define.
        </p><p>Additional loggers may be defined in the future. The easiest
        way to find out the logger name is to configure all logging to go
        to a single destination and look for specific logger names. See
        <a class="xref" href="#logging-message-format" title="17.2. Logging Message Format">Section 17.2, “Logging Message Format”</a> for details.</p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="idp54751136"></a>17.1.1.2. severity (string)</h4></div></div></div><p>
          This specifies the category of messages logged.
          Each message is logged with an associated severity which
          may be one of the following (in descending order of
          severity):
        </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> FATAL </li><li class="listitem"> ERROR </li><li class="listitem"> WARN </li><li class="listitem"> INFO </li><li class="listitem"> DEBUG </li></ul></div><p>

          When the severity of a logger is set to one of these
          values, it will only log messages of that severity, and
          the severities above it. The severity may also be set to
          NONE, in which case all messages from that logger are
          inhibited.



        </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="idp54758736"></a>17.1.1.3. output_options (list)</h4></div></div></div><p>

          Each logger can have zero or more
          <code class="option">output_options</code>. These specify where log
          messages are sent. These are explained in detail below.

        </p><p>

          The other options for a logger are:

        </p></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="idp54760992"></a>17.1.1.4. debuglevel (integer)</h4></div></div></div><p>

          When a logger's severity is set to DEBUG, this value
          specifies what debug messages should be printed. It ranges
          from 0 (least verbose) to 99 (most verbose).
        </p><p>

          If severity for the logger is not DEBUG, this value is ignored.

        </p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp54763552"></a>17.1.2. Output Options</h3></div></div></div><p>

          The main settings for an output option are the
          <code class="option">destination</code> and a value called
          <code class="option">output</code>, the meaning of which depends on
          the destination that is set.

        </p><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="idp54765584"></a>17.1.2.1. destination (string)</h4></div></div></div><p>

            The destination is the type of output. It can be one of:

          </p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"> console </li><li class="listitem"> file </li><li class="listitem"> syslog </li></ul></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="idp54770032"></a>17.1.2.2. output (string)</h4></div></div></div><p>
          This value determines the type of output. There are several
          special values allowed here: <span class="command"><strong>stdout</strong></span> (messages
          are printed on standard output), <span class="command"><strong>stderr</strong></span>
          (messages are printed on stderr), <span class="command"><strong>syslog</strong></span> (messages
          are logged to syslog using default name, <span class="command"><strong>syslog:name</strong></span>
          (messages are logged to syslog using specified name). Any other
          value is interpreted as a filename that the logs should be written to.
        </p><p>

          The other options for <code class="option">output_options</code> are:

        </p><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="idp54775152"></a>17.1.2.2.1. flush (true of false)</h5></div></div></div><p>
            Flush buffers after each log message. Doing this will
            reduce performance but will ensure that if the program
            terminates abnormally, all messages up to the point of
            termination are output. Default is true.
          </p></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="idp54776752"></a>17.1.2.2.2. maxsize (integer)</h5></div></div></div><p>
            Only relevant when destination is file, this is maximum
            file size of output files in bytes. When the maximum
            size is reached, the file is renamed and a new file opened.
            (For example, a ".1" is appended to the name —
            if a ".1" file exists, it is renamed ".2",
            etc.)
          </p><p>
            If this is 0, no maximum file size is used.
          </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
	      Due to a limitation of the underlying logging library
	      (log4cplus), rolling over the log files (from ".1" to
	      ".2", etc) may show odd results: There can be
	      multiple small files at the timing of roll over.  This
	      can happen when multiple processes try to roll
	      over the files simultaneously.
	      Version 1.1.0 of log4cplus solved this problem, so if
	      this or higher version of log4cplus is used to build
	      Kea, it shouldn't happen.  Even for older versions
	      it is normally expected to happen rarely unless the log
	      messages are produced very frequently by multiple
	      different processes.
	    </p></div></div><div class="section"><div class="titlepage"><div><div><h5 class="title"><a name="idp54780384"></a>17.1.2.2.3. maxver (integer)</h5></div></div></div><p>
            Maximum number of old log files to keep around when
            rolling the output file. Only relevant when
            <code class="option">output</code> is <span class="quote"><span class="quote">file</span></span>.
          </p></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp54783056"></a>17.1.3. Example Logger Configurations</h3></div></div></div><p>
          In this example we want to set the global logging to
          write to the console using standard output.
        </p><pre class="screen"><strong class="userinput"><code>
"Logging": {
    "loggers": [
        {
            "name": "kea-dhcp4",
            "output_options": [
                {
                    "output": "stdout"
                }
            ],
            "severity": "WARN"
        }
    ]
}
</code></strong>
</pre><p>In this second example, we want to store debug log messages
in a file that is at most 2MB and keep up to 8 copies of old logfiles.
Once the logfile grows to 2MB, it will be renamed and a new file
file be created.</p><pre class="screen"><strong class="userinput"><code>
"Logging": {
    "loggers": [
        {
            "name": "kea-dhcp6",
            "output_options": [
                {
                    "output": "/var/log/kea-debug.log",
                    "maxver": 8,
                    "maxsize": 204800,
                    "flush": true
                }
            ],
            "severity": "DEBUG",
            "debuglevel": 99
        }
   ]
}</code></strong></pre></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="logging-message-format"></a>17.2. Logging Message Format</h2></div></div></div><p>
          Each message written  to the configured logging
          destinations comprises a number of components that identify
          the origin of the message and, if the message indicates
          a problem, information about the problem that may be
          useful in fixing it.
      </p><p>
          Consider the message below logged to a file:
          </p><pre class="screen">2014-04-11 12:58:01.005 INFO  [kea-dhcp4.dhcpsrv/27456]
    DHCPSRV_MEMFILE_DB opening memory file lease database: type=memfile universe=4</pre><p>
      </p><p>
        Note: the layout of messages written to the system logging
        file (syslog) may be slightly different.  This message has
        been split across two lines here for display reasons; in the
        logging file, it will appear on one line.
      </p><p>
        The log message comprises a number of components:

          </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">2014-04-11 12:58:01.005</span></dt><dd><p>
              The date and time at which the message was generated.
          </p></dd><dt><span class="term">INFO</span></dt><dd><p>
              The severity of the message.
          </p></dd><dt><span class="term">[kea-dhcp4.dhcpsrv/27456]</span></dt><dd><p>
            The source of the message.  This comprises two elements:
            the Kea process generating the message (in this
            case, <span class="command"><strong>kea-dhcp4</strong></span>) and the component
            within the program from which the message originated
            (which is the name of the common library used by DHCP server
            implementations). The number after the slash is a process id
            (pid).
          </p></dd><dt><span class="term">DHCPSRV_MEMFILE_DB</span></dt><dd><p>
            The message identification.  Every message in Kea
            has a unique identification, which can be used as an
            index into the <a class="ulink" href="kea-messages.html" target="_top"><em class="citetitle">Kea Messages
            Manual</em></a> (<a class="ulink" href="http://kea.isc.org/docs/kea-messages.html" target="_top">http://kea.isc.org/docs/kea-messages.html</a>) from which more information can be obtained.
          </p></dd><dt><span class="term">opening memory file lease database: type=memfile universe=4</span></dt><dd><p>
              A brief description.
              Within this text, information relating to the condition
              that caused the message to be logged will be included.
              In this example, the information is logged that the in-memory
              lease database backend will be used to store DHCP leases.
          </p></dd></dl></div><p>
      </p></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="idp52337216"></a>17.3. Logging During Kea Startup</h2></div></div></div><p>
        The logging configuration is specified in the configuration file.
        However, when Kea starts, the file is not read until some way into the
        initialization process.  Prior to that, the logging settings are
        set to default values, although it is possible to modify some
        aspects of the settings by means of environment variables. Note
        that in the absence of any logging configuration in the configuration
        file, the settings of (possibly modified) default configuration will
        persist while the program is running.
      </p><p>
        The following environment variables can be used to control the
        behavior of logging during startup:
      </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">KEA_LOCKFILE_DIR</span></dt><dd><p>
              Specifies a directory where the logging system should create its
              lock file. If not specified, it is
              <em class="replaceable"><code>prefix</code></em>/var/run/kea, where
              <em class="replaceable"><code>prefix</code></em> defaults to /usr/local.
              This variable must not end
              with a slash. There is one special value: "none", which
              instructs Kea to not create lock file at all. This may cause
              issues if several processes log to the same file.
          </p></dd><dt><span class="term">KEA_LOGGER_DESTINATION</span></dt><dd><p>
              Specifies logging output. There are several special values.
              </p><div class="variablelist"><dl class="variablelist"><dt><span class="term">stdout</span></dt><dd><p>
                          Log to standard output.
                      </p></dd><dt><span class="term">stderr</span></dt><dd><p>
                          Log to standard error.
                      </p></dd><dt><span class="term">syslog[<span class="optional">:<em class="replaceable"><code>fac</code></em></span>]</span></dt><dd><p>
                          Log via syslog. The optional
                          <em class="replaceable"><code>fac</code></em> (which is
                          separated from the word "syslog" by a colon)
                          specifies the
                          facility to be used for the log messages. Unless
                          specified, messages will be logged using the
                          facility "local0".
                      </p></dd></dl></div><p>
              Any other value is treated as a name
              of the output file. If not specified otherwise, Kea will log to
              standard output.
          </p></dd></dl></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="faq"></a>Chapter 18. Frequently Asked Questions</h1></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl class="toc"><dt><span class="section"><a href="#faq-generic">18.1. Generic Frequently Asked Questions</a></span></dt><dd><dl><dt><span class="section"><a href="#q1-generic">18.1.1. Where did the Kea name came from?</a></span></dt><dt><span class="section"><a href="#q2-generic">18.1.2. Feature X is not supported yet. When/if will it be available?</a></span></dt></dl></dd><dt><span class="section"><a href="#faq-dhcp4">18.2. Frequently Asked Questions about DHCPv4</a></span></dt><dd><dl><dt><span class="section"><a href="#idp51413776">18.2.1. I set up a firewall, but the Kea server still receives the traffic. Why?</a></span></dt></dl></dd><dt><span class="section"><a href="#faq-dhcp6">18.3. Frequently Asked Questions about DHCPv6</a></span></dt><dd><dl><dt><span class="section"><a href="#idp54575072">18.3.1. Kea DHCPv6 doesn't seem to get incoming traffic. I checked with tcpdump (or other traffic
      capture software) that the incoming traffic is reaching the box. What's wrong?</a></span></dt></dl></dd></dl></div><p>This chapter contains a number of frequently asked questions and
  troubleshooting tips. It currently lacks content, but it is expected to grow
  over time.</p><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="faq-generic"></a>18.1. Generic Frequently Asked Questions</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="q1-generic"></a>18.1.1. Where did the Kea name came from?</h3></div></div></div><p>Kea is the name of a high mountain parrot living in New Zealand.
      See this <a class="ulink" href="https://lists.isc.org/pipermail/kea-users/2014-October/000032.html" target="_top">https://lists.isc.org/pipermail/kea-users/2014-October/000032.html</a>
      for an extended answer.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="q2-generic"></a>18.1.2. Feature X is not supported yet. When/if will it be available?</h3></div></div></div><p>Kea is developed by a small team of engineers. Our resources are
      limited, so we need to prioritize requests. The complexity of a new
      feature (how difficult it is to implement a feature and how likely it
      would break something that already works), amount of work required and
      expected popularity (i.e., how many users would actually benefit from it)
      are three leading factors. We sometimes also have contractual obligations.
      </p><p> Simply stating that you'd like feature X is useful. We try to
      implement features that are actively requested first, but the reality
      is that we have more requests than we can handle, so some of them must
      be postponed, at least in the near future. So is your request likely to
      be rejected? Not at all. You can do many things to greatly improve the
      chances of your request being fulfilled. First, it helps to explain why you
      need a feature. If your explanation is reasonable and there are likely
      other users that would benefit from it, the chances for Kea developers
      to put this task on a roadmap is better. Saying that you are willing
      to participate in tests (e.g., test engineering drops when they become
      available) is also helpful.</p><p>Another thing you can do to greatly improve the chances of a feature
      to appear is to actually develop it on your own and submit a patch.
      That's an avenue that people often forget about. Kea is open source
      software and we do accept patches. There are certain requirements, like
      code quality, comments, unit-tests, documentation, etc., but we have
      accepted a significant number of patches in the past, so it's doable.
      Accepted contributions range from minor documentation corrections to
      significant new features, like support for a new database type. Before
      considering writing and submitting a patch, make sure you read
      the Contributor's Guide in <a class="ulink" href="http://git.kea.isc.org/~tester/kea/doxygen/" target="_top">Kea Developer's Guide</a>.
      </p><p>Kea is developed by ISC, which is a non-profit organization.
      You may consider signing a development contract with us. In the past
      we did implement certain features due to contractual obligations.
      With additional funds we are able to put extra engineering efforts
      into Kea development. We can reshuffle our schedule or add extra
      hands to the team if needed. Please keep in mind that Kea is
      open source software and its principle goal is to provide a good DHCP
      solution that can be used by everyone. In other words, we may
      refuse a contract that would tie the solution to specific proprietary
      technology or make it unusable for other users. Also, we strive to
      make Kea a reference implementation, so if your proposal significantly
      violates a RFC, we may have a problem with that. Nevertheless, please
      talk to us and we may be able to find a solution.</p><p>Finally, Kea has a <a class="ulink" href="http://kea.isc.org/roadmap" target="_top">public
      roadmap</a>, with releases happening several times each year. We tend
      to not modify plans for the current milestone, unless there are very good
      reasons to do so. Therefore "I'd like a feature X in 6 months" is much
      better received than "I'd like a feature X now".</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="faq-dhcp4"></a>18.2. Frequently Asked Questions about DHCPv4</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp51413776"></a>18.2.1. I set up a firewall, but the Kea server still receives the traffic. Why?</h3></div></div></div><p>Any DHCPv4 server must be able to receive from and send traffic to
      hosts that don't have an IPv4 address assigned yet. That is typically not
      possible with regular UDP sockets, therefore the Kea DHCPv4 server uses raw
      sockets by default. Raw sockets mean that the incoming packets are received
      as raw Ethernet frames, thus bypassing the whole kernel IP stack, including
      any firewalling rules your kernel may provide.</p><p>If you do not want the server to use raw sockets, it is possible to
      configure the Kea DHCPv4 server to use UDP sockets instead. See <span class="command"><strong>dhcp-socket-type</strong></span>
      described in <a class="xref" href="#dhcp4-interface-configuration" title="7.2.4. Interface configuration">Section 7.2.4, “Interface configuration”</a>. However,
      using UDP sockets has certain limitations. In particular, they may not allow
      for sending responses directly to clients without IPv4 addresses assigned.
      That's ok, if all your traffic is coming through relay agents.</p></div></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="faq-dhcp6"></a>18.3. Frequently Asked Questions about DHCPv6</h2></div></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="idp54575072"></a>18.3.1. Kea DHCPv6 doesn't seem to get incoming traffic. I checked with tcpdump (or other traffic
      capture software) that the incoming traffic is reaching the box. What's wrong?</h3></div></div></div><p>Please check whether your OS has any IPv6 filtering rules. Many
      operating systems are shipped with firewalls that discard incoming IPv6
      traffic by default. In particular, many Linux distributions do that. Please
      check the output of the following command:
  </p><pre class="screen">
# <strong class="userinput"><code>ip6tables -L -n</code></strong></pre><p>
      One common mistake in this area is to use <span class="command"><strong>iptables</strong></span> tool,
      which lists IPv4 firewall rules only.
      </p></div></div></div><div class="chapter"><div class="titlepage"><div><div><h1 class="title"><a name="acknowledgments"></a>Chapter 19. Acknowledgments</h1></div></div></div><p>Kea is primarily designed, developed, and maintained by
      Internet Systems Consortium, Inc. It is an open source project
      and contributions are welcomed.</p><p>Support for the development of the DHCPv4, DHCPv6 and
      DHCP-DDNS  components was provided by
      <a class="ulink" href="http://www.comcast.com/" target="_top">Comcast</a>.</p><p>Kea was initially implemented as a collection of applications
      within the BIND 10 framework. Hence, Kea development would not be
      possible without the generous support of past BIND 10 project sponsors.</p><p><a class="ulink" href="http://jprs.co.jp/" target="_top">JPRS</a> and
      <a class="ulink" href="http://cira.ca/" target="_top">CIRA</a> were Patron Level
      BIND 10 sponsors.</p><p><a class="ulink" href="https://www.afnic.fr/" target="_top">AFNIC</a>,
      <a class="ulink" href="https://www.cnnic.net.cn/" target="_top">CNNIC</a>,
      <a class="ulink" href="https://www.nic.cz/" target="_top">CZ.NIC</a>,
      <a class="ulink" href="http://www.denic.de/" target="_top">DENIC eG</a>,
      <a class="ulink" href="https://www.google.com/" target="_top">Google</a>,
      <a class="ulink" href="https://www.ripe.net/" target="_top">RIPE NCC</a>,
      <a class="ulink" href="https://registro.br/" target="_top">Registro.br</a>,
      <a class="ulink" href="https://nzrs.net.nz/" target="_top">.nz Registry Services</a>, and
      <a class="ulink" href="https://www.tcinet.ru/" target="_top">Technical Center of Internet</a>
      were past BIND 10 sponsors.</p><p><a class="ulink" href="https://www.afilias.info/" target="_top">Afilias</a>,
      <a class="ulink" href="https://www.iis.se/" target="_top">IIS.SE</a>,
      <a class="ulink" href="http://www.nominet.org.uk/" target="_top">Nominet</a>, and
      <a class="ulink" href="https://www.sidn.nl/" target="_top">SIDN</a> were founding
      sponsors of the BIND 10 project.</p></div></div></body></html>