Configuring a Kea DHCPv6 Service

Complete the following steps to configure the kea-dhcp6 service.
  1. Make a backup copy of the original configuration file.
    The installed configuration files include comments and example settings that could be helpful as you configure a network. With a backup, you can edit the original copy while preserving the original file contents.
    sudo cp /etc/kea/kea-dhcp6.conf /etc/kea/kea-dhcp6.conf.bak
  2. Open /etc/kea/kea-dhcp6.conf, then replace the contents with the following example text:
    { "Dhcp6": {
    
        "interfaces-config": {
            "interfaces": [ "<interface-name>" ]
        },
    
        "lease-database": {
            "type": "memfile",
            "persist": true,
            "name": "/var/lib/kea/kea-leases6.csv"
        },
    
        "preferred-lifetime": 3000,
        "valid-lifetime": 4000,
        "renew-timer": 1000,
        "rebind-timer": 2000,
    
        "option-data": [
            {
                "name": "dns-servers",
                "data": "<DNS server IP addresses>"
            }
        ],
    
        "subnet6": [
            {
                "id": 1,
                "subnet": "<subnet IP address/netmask>",
                "interface": "<interface-name>",
                "pools": [
                {
                    "pool": "<IP address range>",
                    "user-context": { "charging": true }
                } ]
    
            }
          ],
    
        "loggers": [
            {
                "name": "kea-dhcp6",
                "output-options": [
                    {
                        "output": "stdout"
                    }
                ],
                "debuglevel": 0,
                "severity": "INFO"
            }
        ]
    }
    }
  3. Replace placeholder values with values that apply to your network.
    1. Replace the value of interfaces with names of interfaces on which you want the service to listen for DHCP messages.
      For example:
      "interfaces": [ "eno1" ]
    2. Review the parameters and values in lease-database and make any changes that suit the needs of your network.
      Consider changing any of the following parameters:
      • type—The type of database kea-dhcp4 uses. memfile is the default. In this case, the service keeps lease information in memory and saves the information to a CSV file on disk.

        If you have set up a MySQL or PostgreSQL database for lease database storage, you can change the value to mysql or postgresql. See the Kea Administrator's Reference Manual for more information.

      • persist—Boolean that indicates whether kea-dhcp4 saves lease database information to disk. true is the default. If you set to false, a system restart would cause kea-dhcp4 to lose a record of which IP addresses have been assigned.

      • name—The absolute path to the database file. Kea provides a default CSV file for kea-dhcp6 in /var/lib/kea/kea-leases6.csv, but you can enter a custom value here.

    3. Review the value of valid-lifetime and change the value to suit the needs of your network.
      Enter an integer representing the number of seconds the leases assigned by the server are valid.
    4. In option-data, under dns-servers replace the data value with the IP addresses of name servers you want to use.
      For example:
      "name": "dns-servers",
                  "data": "fc00:1:1::10, fc00:1:1::11"
    5. Replace the subnet value with the subnet IP address on your network.
      For example:
      "subnet": "fc00:0001:0001::/48",
    6. Enter the value of network interfaces that connect to the subnet you defined.
      For example:
      "interfaces": [ "eno1" ]
    7. Replace the pool value with a range of IP addresses within the subnet you have defined.
      For example:
      "pool": "fc00:1:1::20 - fc00:1:1::1000",
    8. Review the values in loggers and change any values to suit the needs of your network.
  4. Save the configuration file.
  5. Check the configuration file for syntax errors.
    kea-dhcp6 -t /etc/kea/kea-dhcp6.conf
  6. Enable and start the DHCP service.
    sudo systemctl enable --now kea-dhcp6