123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
- <!ENTITY mdash "—" >
- ]>
- <chapter id="keactrl">
- <title>Managing Kea with keactrl</title>
- <section id="keactrl-overview">
- <title>Overview</title>
- <para>keactrl is a shell script which controls the startup, shutdown
- and reconfiguration of the Kea servers (<command>kea-dhcp4</command>,
- <command>kea-dhcp6</command> and <command>kea-dhcp-ddns</command>). It
- also provides the means for checking the current status of the servers
- and determining the configuration files in use.
- </para>
- </section>
- <section id="keactrl-usage">
- <title>Command Line Options</title>
- <para><command>keactrl</command> is run as follows:
- <screen>
- keactrl <command> [-c keactrl-config-file] [-s server[,server,..]]
- </screen>
- </para>
- <para>
- <command><command></command> is the one of the commands
- described in <xref linkend="keactrl-commands"/>.
- </para>
- <para>
- The optional <command>-c keactrl-config-file</command> switch
- allows specification of an alternate <command>keactrl</command>
- configuration file. (<command>--ctrl-config</command> is a synonym for
- <command>-c</command>.) In the absence of <command>-c</command>,
- <command>keactrl</command> will use the default configuration
- file <filename>[kea-install-dir]/etc/kea/keactrl.conf</filename>.
- </para>
- <para>
- The optional <command>-s server[,server ...]</command> switch selects
- the servers to which the command is issued.
- (<command>--server</command> is a synonym for <command>-s</command>.)
- 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.
- </para>
- </section>
- <section id="keactrl-config-file">
- <title>The keactrl Configuration File</title>
- <para>
- 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 <filename>[kea-install-dir]/etc/kea/keactrl.conf</filename>,
- but this can be overridden on a per-command basis using the
- <command>-c</command> switch.
- </para>
- <para>
- The contents of <filename>keactrl.conf</filename> are:
- <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
- </screen>
- </para>
- <para>
- The <parameter>dhcp4</parameter>, <parameter>dhcp6</parameter> and
- <parameter>dhcp_ddns</parameter> parameters set to "yes" configure
- <command>keactrl</command> to manage (start, reconfigure) all servers,
- i.e. <command>kea-dhcp4</command>, <command>kea-dhcp6</command> and
- <command>kea-dhcp-ddns</command>. When any of these parameters is set to
- "no" the <command>keactrl</command> will ignore
- the corresponding server when starting or reconfiguring Kea.
- </para>
- <para>
- By default, Kea servers managed by <command>keactrl</command> are
- located in <filename>[kea-install-dir]/sbin</filename>. This
- should work for most installations. If the default
- location needs to be altered for any reason, the paths
- specified with the <parameter>dhcp4_srv</parameter>,
- <parameter>dhcp6_srv</parameter> and <parameter>dhcp_ddns_srv</parameter>
- parameters should be modified.
- </para>
- <para>
- The <parameter>kea_verbose</parameter> parameter specifies the verbosity
- of the servers being started. When <parameter>kea_verbose</parameter>
- is set to "yes" the logging level of the server is set to DEBUG.
- Otherwise, the default logging level is used.
- </para>
- <note>
- <para>
- 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
- <parameter>kea_verbose</parameter> parameter.
- </para>
- </note>
- </section>
- <section id="keactrl-commands">
- <title>Commands</title>
- <para>The following commands are supported by <command>keactrl</command>
- to perform specific operations on the Kea servers:
- <itemizedlist>
- <listitem><simpara>
- <command>start</command> - starts selected servers.
- </simpara></listitem>
- <listitem><simpara>
- <command>stop</command> - stops all running servers.
- </simpara></listitem>
- <listitem><simpara>
- <command>reload</command> - triggers reconfiguration of the
- selected servers by sending the SIGHUP signal to them.
- </simpara></listitem>
- <listitem><simpara>
- <command>status</command> - returns the status of the servers (active
- or inactive) and the names of the configuration files in use.
- </simpara></listitem>
- </itemizedlist>
- </para>
- <para>Typical output from <command>keactrl</command> when starting
- the servers looks similar to the following:
- <screen>
- <userinput>$ keactrl start</userinput>
- 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
- </screen>
- </para>
- <para>Kea's servers create PID files upon startup. These files are used
- by keactrl to deteremine 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 similiar to the following:
- <screen>
- <userinput>$ keactrl start</userinput>
- 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.
- </screen>
- 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.
- </para>
- <para>The following command stops all servers:
- <screen>
- <userinput>$ keactrl stop</userinput>
- INFO/keactrl: Stopping kea-dhcp4...
- INFO/keactrl: Stopping kea-dhcp6...
- INFO/keactrl: Stopping kea-dhcp-ddns...
- </screen>
- Note that the <command>stop</command> will attempt to stop all servers
- regardless of whether they are "enabled" in the <filename>keactrl.conf</filename>.
- If any of the servers are not running, an informational message
- is displayed as in the <command>stop</command> command output below.
- <screen>
- <userinput>$ keactrl stop</userinput>
- INFO/keactrl: kea-dhcp4 isn't running.
- INFO/keactrl: kea-dhcp6 isn't running.
- INFO/keactrl: kea-dhcp-ddns isn't running.
- </screen>
- </para>
- <para>
- As already mentioned, the reconfiguration of each Kea server is
- triggered by the SIGHUP signal. The <command>reload</command>
- command sends the SIGHUP signal to the servers that are enabled in
- the <command>keactrl</command> 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:
- <screen>
- <userinput>$ keactrl reload</userinput>
- INFO/keactrl: Reloading kea-dhcp4...
- INFO/keactrl: Reloading kea-dhcp6...
- INFO/keactrl: Reloading kea-dhcp-ddns...
- </screen>
- If any of the servers are not running, an informational message
- is displayed as in the <command>reload</command> command output below.
- <screen>
- <userinput>$ keactrl stop</userinput>
- INFO/keactrl: kea-dhcp4 isn't running.
- INFO/keactrl: kea-dhcp6 isn't running.
- INFO/keactrl: kea-dhcp-ddns isn't running.
- </screen>
- </para>
- <note>
- <para>
- Currently <command>keactrl</command> 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.
- </para>
- </note>
- <para>
- Sometimes it is useful to check which servers are running. The
- <command>status</command> reports this, typical output looking like:
- <screen>
- <userinput>$ keactrl status</userinput>
- 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
- </screen>
- </para>
- </section>
- <section id="keactrl-overriding-servers">
- <title>Overriding the Server Selection</title>
- <para>
- The optional <command>-s</command> switch allows
- the selection of the servers to which <command>keactrl</command>
- command is issued. For example, the following
- instructs <command>keactrl</command> to stop the
- <command>kea-dhcp4</command> and <command>kea-dhcp6</command> servers
- and leave the <command>kea-dhcp-ddns</command> server running:
- <screen>
- <userinput>$ keactrl stop -s dhcp4,dhcp6</userinput>
- </screen>
- </para>
- <para>
- Similarly, the following
- will only start the <command>kea-dhcp4</command> and
- <command>kea-dhcp-ddns</command> servers and not
- <command>kea-dhcp6</command>.
- <screen>
- <userinput>$ keactrl start -s dhcp4,dhcp_ddns</userinput>
- </screen>
- </para>
- <para>
- Note that the behavior of the <command>-s</command> switch
- with the <command>start</command> and <command>reload</command> commands
- is different to its behavior with the <command>stop</command> command.
- On <command>start</command> and <command>reload</command>,
- <command>keactrl</command> will check if the servers given as
- parameters to the <command>-s</command> switch are
- enabled in the <command>keactrl</command> configuration file:
- if not, the server will be ignored. For <command>stop</command> however,
- this check is not made: the command is applied to all listed servers,
- regardless of whether they have been enabled in the file.
- </para>
- <para>
- The following keywords can be used with the <command>-s</command>
- command line option:
- <itemizedlist>
- <listitem><simpara>
- <command>dhcp4</command> for <command>kea-dhcp4.</command>
- </simpara></listitem>
- <listitem><simpara>
- <command>dhcp6</command> for <command>kea-dhcp6.</command>
- </simpara></listitem>
- <listitem><simpara>
- <command>dhcp_ddns</command> for <command>kea-dhcp-ddns.</command>
- </simpara></listitem>
- <listitem><simpara>
- <command>all</command> for all servers (default).
- </simpara></listitem>
- </itemizedlist>
- </para>
- </section>
- </chapter>
|