LinuxCommandLibrary

knotc

Control and manage Knot DNS server

TLDR

Start editing a zone

$ knotc zone-begin [zone]
copy

Set an A record with TTL of 3600
$ knotc zone-set [zone] [subdomain] 3600 A [ip_address]
copy

Finish editing the zone
$ knotc zone-commit [zone]
copy

Get the current zone data
$ knotc zone-read [zone]
copy

Get the current server configuration
$ knotc conf-read server
copy

SYNOPSIS

knotc [OPTIONS] COMMAND [ARGUMENTS...]

PARAMETERS

-c, --config file
    Specifies the server configuration file to use instead of the default.

-s, --socket file
    Specifies the path to the control socket file for communication with knotd.

-C, --conf-dir directory
    Specifies the directory containing configuration files, overriding the default.

-S, --socket-dir directory
    Specifies the directory where control sockets are created, overriding the default.

-D, --debug level
    Sets the debug level for the command's output, enabling more verbose logging for troubleshooting.

-v, --verbose
    Increases the verbosity of the command's output, providing more detailed information.

-V, --version
    Displays the knotc version information and exits.

-h, --help
    Displays a short help message detailing command usage and options, then exits.

DESCRIPTION

knotc is the command-line interface for the Knot DNS server (knotd). It allows administrators to interact with a running knotd instance, performing various management tasks.

These tasks include checking server status, reloading zone data, adding or deleting zones, managing server configuration, and retrieving operational statistics. It communicates with the knotd daemon via a control socket, offering a powerful way to manage the DNS server's lifecycle and its hosted zones.

CAVEATS

knotc requires a running knotd instance to communicate with, typically via a Unix domain socket. If the knotd server is not running or the socket path is incorrect, knotc commands will fail. Proper file system permissions on the control socket file are also crucial for knotc to establish a connection and operate correctly.

COMMON COMMANDS

knotc offers a wide range of subcommands for both server and zone management. Common actions include status to check the overall server health and state, zone-reload <zone> to apply changes to a specific DNS zone, zone-add <zone> to configure and add new zones to the server, and statistics to view comprehensive server and zone metrics.

INTERACTION WITH KNOTD

knotc primarily communicates with the knotd daemon using a Unix domain socket. The default path for this socket is typically defined within the Knot DNS configuration (knot.conf), or it can be explicitly specified on the command line using the -s or --socket options. This socket serves as the secure and efficient IPC mechanism between the control utility and the running DNS server.

HISTORY

knotc is an integral part of the Knot DNS project, a high-performance authoritative-only DNS server developed by CZ.NIC. It has been a core component since the early versions of Knot DNS, providing a stable and efficient way to manage the server's operations and hosted zones. Its development has consistently focused on robust control and seamless integration with the knotd daemon, evolving alongside the server itself to support new features and management capabilities.

SEE ALSO

knotd(8), knot.conf(5), knsd(8)

Copied to clipboard