keactrl.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
  4. <!ENTITY mdash "&#x2014;" >
  5. ]>
  6. <chapter id="keactrl">
  7. <title>Managing Kea with keactrl</title>
  8. <section id="keactrl-overview">
  9. <title>Overview</title>
  10. <para>keactrl is a shell script which controls the startup, shutdown
  11. and reconfiguration of the Kea servers (<command>kea-dhcp4</command>,
  12. <command>kea-dhcp6</command> and <command>kea-dhcp-ddns</command>). It
  13. also provides the means for checking the current status of the servers
  14. and determining the configuration files in use.
  15. </para>
  16. </section>
  17. <section id="keactrl-usage">
  18. <title>Command Line Options</title>
  19. <para><command>keactrl</command> is run as follows:
  20. <screen>
  21. keactrl &lt;command&gt; [-c keactrl-config-file] [-s server[,server,..]]
  22. </screen>
  23. </para>
  24. <para>
  25. <command>&lt;command&gt;</command> is the one of the commands
  26. described in <xref linkend="keactrl-commands"/>.
  27. </para>
  28. <para>
  29. The optional <command>-c keactrl-config-file</command> switch
  30. allows specification of an alternate <command>keactrl</command>
  31. configuration file. (<command>--ctrl-config</command> is a synonym for
  32. <command>-c</command>.) In the absence of <command>-c</command>,
  33. <command>keactrl</command> will use the default configuration
  34. file <filename>[kea-install-dir]/etc/kea/keactrl.conf</filename>.
  35. </para>
  36. <para>
  37. The optional <command>-s server[,server ...]</command> switch selects
  38. the servers to which the command is issued. If absent,
  39. the command is sent to all servers enabled in the keactrl
  40. configuration file. (<command>--server</command> is a synonym for
  41. <command>-s</command>.) If multiple servers are specified, they
  42. should be separated by commas with no intervening spaces.
  43. </para>
  44. </section>
  45. <section id="keactrl-config-file">
  46. <title>The keactrl Configuration File</title>
  47. <para>
  48. Depending on requirements, not all of the available servers need
  49. be run. The keactrl configuration file sets which servers are
  50. enabled and which are disabled. The default configuration
  51. file is <filename>[kea-install-dir]/etc/kea/keactrl.conf</filename>,
  52. but this can be overridden on a per-command basis using the
  53. <command>-c</command> switch.
  54. </para>
  55. <para>
  56. The contents of <filename>keactrl.conf</filename> are:
  57. <screen>
  58. # This is a configuration file for keactrl script which controls
  59. # the startup, shutdown, reconfiguration and gathering the status
  60. # of the Kea servers.
  61. # prefix holds the location where the Kea is installed.
  62. prefix=/usr/local
  63. # Location of Kea configuration file.
  64. kea_config_file=${prefix}/etc/kea/kea.conf
  65. # Location of Kea binaries.
  66. exec_prefix=${prefix}
  67. dhcp4_srv=${exec_prefix}/sbin/kea/kea-dhcp4
  68. dhcp6_srv=${exec_prefix}/sbin/kea/kea-dhcp6
  69. dhcp_ddns_srv=${exec_prefix}/sbin/kea/kea-dhcp-ddns
  70. # Start DHCPv4 server?
  71. dhcp4=yes
  72. # Start DHCPv6 server?
  73. dhcp6=yes
  74. # Start DHCP DDNS server?
  75. dhcp_ddns=yes
  76. # Be verbose?
  77. kea_verbose=no
  78. </screen>
  79. </para>
  80. <para>
  81. The <parameter>dhcp4</parameter>, <parameter>dhcp6</parameter> and
  82. <parameter>dhcp_ddns</parameter> parameters set to "yes" configure
  83. <command>keactrl</command> to manage (start, reconfigure) all servers,
  84. i.e. <command>kea-dhcp4</command>, <command>kea-dhcp6</command> and
  85. <command>kea-dhcp-ddns</command>. When any of these parameters is set to
  86. "no" the <command>keactrl</command> will ignore
  87. the corresponding server when starting or reconfiguring Kea.
  88. </para>
  89. <para>
  90. By default, Kea servers managed by <command>keactrl</command> are
  91. located in <filename>[kea-install-dir]/sbin</filename>. This
  92. should work for most of the installations. If the default
  93. location needs to be altered for any reason, the paths
  94. specified with the <parameter>dhcp4_srv</parameter>,
  95. <parameter>dhcp6_srv</parameter> and <parameter>dhcp_ddns_srv</parameter>
  96. parameters should be modified.
  97. </para>
  98. <para>
  99. The <parameter>kea_verbose</parameter> parameter specifies the verbosity
  100. of the servers being started. When <parameter>kea_verbose</parameter>
  101. is set to "yes" the logging level of the server is set to DEBUG.
  102. Otherwise, the default logging level is used.
  103. </para>
  104. <note>
  105. <para>
  106. The verbosity for the server is set when it is started. Once
  107. started, the verbosity can be only changed by stopping the server and
  108. starting it again with the new value of the
  109. <parameter>kea_verbose</parameter> parameter.
  110. </para>
  111. </note>
  112. </section>
  113. <section id="keactrl-commands">
  114. <title>Commands</title>
  115. <para>The following commands are supported by <command>keactrl</command>
  116. to perform specific operations on the Kea servers:
  117. <itemizedlist>
  118. <listitem><simpara>
  119. <command>start</command> - starts selected servers.
  120. </simpara></listitem>
  121. <listitem><simpara>
  122. <command>stop</command> - stops all running servers.
  123. </simpara></listitem>
  124. <listitem><simpara>
  125. <command>reload</command> - triggers reconfiguration of the
  126. selected servers by sending the SIGHUP signal to them.
  127. </simpara></listitem>
  128. <listitem><simpara>
  129. <command>status</command> - returns the status of the servers (active
  130. or inactive) and the names of the configuration files in use.
  131. </simpara></listitem>
  132. </itemizedlist>
  133. </para>
  134. <para>Typical output from <command>keactrl</command> when starting
  135. the servers looks similar to the following:
  136. <screen>
  137. <userinput>$ keactrl start</userinput>
  138. INFO/keactrl: Starting kea-dhcp4 -c /usr/local/etc/kea/kea.conf
  139. INFO/keactrl: Starting kea-dhcp6 -c /usr/local/etc/kea/kea.conf
  140. INFO/keactrl: Starting kea-dhcp-ddns -c /usr/local/etc/kea/kea.conf
  141. </screen>
  142. </para>
  143. <para>The following command stops all servers:
  144. <screen>
  145. <userinput>$ keactrl stop</userinput>
  146. INFO/keactrl: Skip sending signal 15 to process kea-dhcp6: process is not running
  147. </screen>
  148. Note that the <command>stop</command> will attempt to stop all servers
  149. regardless of whether they are "enabled" in the <filename>keactrl.conf</filename>.
  150. If any of the servers is not running, an informational message
  151. is displayed as in the <command>stop</command> command output above.
  152. </para>
  153. <para>
  154. As already mentioned, the reconfiguration of each Kea server is
  155. triggered by the SIGHUP signal. The <command>reload</command>
  156. command sends the SIGHUP signal to the servers that are enabled in
  157. the <command>keactrl</command> configuration file and are
  158. currently running. When a server receives the SIGHUP signal it
  159. re-reads its configuration file and, if the new configuration is
  160. valid, uses the new configuration. A reload is executed as follows:
  161. <screen>
  162. <userinput>$ keactrl reload</userinput>
  163. </screen>
  164. </para>
  165. <note>
  166. <para>
  167. Currently <command>keactrl</command> does not report configuration
  168. failures when the server is started or reconfigured. To check if
  169. the server's configuration succeeded the Kea log must be examined
  170. for errors. By default, this is written to the syslog file.
  171. </para>
  172. </note>
  173. <para>
  174. Sometimes it is useful to check which servers are running. The
  175. <command>status</command> reports this, typical output looking like:
  176. <screen>
  177. <userinput>$ keactrl status</userinput>
  178. DHCPv4 server: active
  179. DHCPv6 server: inactive
  180. DHCP DDNS: active
  181. Kea configuration file: /usr/local/etc/kea/kea.conf
  182. keactrl configuration file: /usr/local/etc/kea/keactrl.conf
  183. </screen>
  184. </para>
  185. </section>
  186. <section id="keactrl-overriding-servers">
  187. <title>Overriding the Server Selection</title>
  188. <para>
  189. The optional <command>-s</command> switch allows
  190. the selection of the servers to which <command>keactrl</command>
  191. command is issued. For example,
  192. <screen>
  193. <userinput>$ keactrl stop -s dhcp4,dhcp6</userinput>
  194. </screen>
  195. ... instructs <command>keactrl</command> to stop the
  196. <command>kea-dhcp4</command> and <command>kea-dhcp6</command> servers
  197. and leave the <command>kea-dhcp-ddns</command> running.
  198. </para>
  199. <para>
  200. Similarly,
  201. <screen>
  202. <userinput>$ keactrl start -s dhcp4,dhcp_ddns</userinput>
  203. </screen>
  204. ... will only start the <command>kea-dhcp4</command> and
  205. <command>kea-dhcp-ddns</command> servers and not
  206. <command>kea-dhcp6</command>.
  207. </para>
  208. <para>
  209. Note that the behavior of the <command>-s</command> switch
  210. with the <command>start</command> and <command>reload</command> commands
  211. is different to its behavior with the <command>stop</command> command.
  212. On <command>start</command> and <command>reload</command>,
  213. <command>keactrl</command> will check if the servers given as
  214. parameters to the <command>-s</command> switch are
  215. enabled in the <command>keactrl</command> configuration file:
  216. if not, the server will be ignored. For <command>stop</command> however,
  217. this check is not made: the command is applied to all listed servers,
  218. regardless of whether they have been enabled in the file.
  219. </para>
  220. <para>
  221. The following keywords can be used with the <command>-s</command>
  222. command line option:
  223. <itemizedlist>
  224. <listitem><simpara>
  225. <command>dhcp4</command> for <command>kea-dhcp4.</command>
  226. </simpara></listitem>
  227. <listitem><simpara>
  228. <command>dhcp6</command> for <command>kea-dhcp6.</command>
  229. </simpara></listitem>
  230. <listitem><simpara>
  231. <command>dhcp_ddns</command> for <command>kea-dhcp-ddns.</command>
  232. </simpara></listitem>
  233. <listitem><simpara>
  234. <command>all</command> for all servers (default).
  235. </simpara></listitem>
  236. </itemizedlist>
  237. </para>
  238. </section>
  239. </chapter>