// This is an example configuration file for the DHCPv4 server in Kea.
// It demonstrates how to enable Kea Configuration Backend using MySQL.
// It requires that libdhcp_mysql.so library is available and
// optionally libdhcp_cb_cmds.so hook library.

{ "Dhcp6":

{
    // Set the server tag for the configuration backend. This instance will
    // be named server2. Every configuration element that is applicable to
    // either "all" or "server2" will be used by this instance.
    "server-tag": "server2",

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

    // Use memfile lease database backend.
    "lease-database": {
        "type": "memfile",
        "lfc-interval": 3600
    },

    // This parameter controls how the server accesses the configuration
    // database. Currently only two database types are available - "mysql" and
    // "postgresql".
    // Using "mysql" requires that the libdhcp_mysql.so hook library is loaded.
    // If using "postgresql", then loading libdhcp_pgsql.so hook library is
    // required.
    "config-control": {
        // A list of database backends to connect to. Currently, it is limited
        // to a single backend.
        "config-databases": [
            {
                "type": "mysql",
                "reconnect-wait-time": 3000, // expressed in ms
                "max-reconnect-tries": 3,
                "name": "kea",
                "user": "kea",
                "password": "1234",
                "host": "localhost",
                "port": 3306
            }
        ],
        // Controls how often the server polls the database for the
        // configuration updates. The setting below implies that it
        // will take up to approx. 20 seconds for the server to
        // discover and fetch configuration changes.
        "config-fetch-wait-time": 20
    },

    // This defines a control socket. If defined, Kea will open a UNIX socket
    // and will listen for incoming commands. See section 17 of the Kea ARM for
    // details.
    "control-socket": {
        "socket-type": "unix",
        "socket-name": "kea6-ctrl-socket"
    },

    // Hooks libraries that enable configuration backend are loaded.
    "hooks-libraries": [
        // The libdhcp_mysql.so is required to use MySQL Configuration
        // Backend.
        {
            "library": "/usr/local/lib/kea/hooks/libdhcp_mysql.so"
        }
        // If using PostgreSQL Configuration Backend, the "libdhcp_pgsql.so" is
        // required.
        // {
        //    "library": "/usr/local/lib/kea/hooks/libdhcp_pgsql.so"
        // }
        // The libdhcp_cb_cmds.so is optional. It allows for managing the
        // configuration in the database. If this library is not loaded,
        // the configuration can be managed directly using available
        // tools that work directly with the MySQL database.
        // ,{
        //     "library": "/usr/local/lib/kea/hooks/libdhcp_cb_cmds.so"
        // }
    ],

    // The following configures logging. It assumes that messages with at
    // least informational level (info, warn, error and fatal) should be
    // logged to stdout. Alternatively, you can specify stderr here, a filename
    // or 'syslog', which will store output messages via syslog.
    "loggers": [
        {
            "name": "kea-dhcp6",
            "output-options": [
                {
                    "output": "stdout"
                }
            ],
            "debuglevel": 0,
            "severity": "INFO"
        }
    ]
}

}
