Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

242 lines
6.6 KiB

7 years ago
7 years ago
9 years ago
9 years ago
  1. .\" $OpenBSD: ntpd.conf.5,v 1.38 2019/11/06 13:35:25 otto Exp $
  2. .\"
  3. .\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
  4. .\"
  5. .\" Permission to use, copy, modify, and distribute this software for any
  6. .\" purpose with or without fee is hereby granted, provided that the above
  7. .\" copyright notice and this permission notice appear in all copies.
  8. .\"
  9. .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. .\" WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
  14. .\" AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
  15. .\" OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. .\"
  17. .Dd $Mdocdate: November 6 2019 $
  18. .Dt NTPD.CONF 5
  19. .Os
  20. .Sh NAME
  21. .Nm ntpd.conf
  22. .Nd Network Time Protocol daemon configuration file
  23. .Sh DESCRIPTION
  24. This manual page describes the format of the
  25. .Xr ntpd 8
  26. configuration file.
  27. .Pp
  28. .Nm
  29. has the following format:
  30. .Pp
  31. Empty lines and lines beginning with the
  32. .Sq #
  33. character are ignored.
  34. .Pp
  35. Keywords may be specified multiple times within the configuration file.
  36. The basic configuration options are as follows:
  37. .Bl -tag -width Ds
  38. .It Xo Ic listen on Ar address
  39. .Op Ic rtable Ar table-id
  40. .Xc
  41. Specify a local IP address or a hostname the
  42. .Xr ntpd 8
  43. daemon should listen on.
  44. If it appears multiple times,
  45. .Xr ntpd 8
  46. will listen on each given address.
  47. If
  48. .Sq *
  49. is given as an address,
  50. .Xr ntpd 8
  51. will listen on all local addresses using the specified routing table.
  52. .Xr ntpd 8
  53. does not listen on any address by default.
  54. The optional
  55. .Ic rtable
  56. keyword will specify which routing table to listen on.
  57. By default
  58. .Xr ntpd 8
  59. will listen using the current routing table.
  60. For example:
  61. .Bd -literal -offset indent
  62. listen on *
  63. .Ed
  64. .Pp
  65. or
  66. .Bd -literal -offset indent
  67. listen on 127.0.0.1
  68. listen on ::1
  69. listen on 127.0.0.1 rtable 4
  70. .Ed
  71. .It Ic query from Ar address
  72. Specify a local IP address the
  73. .Xr ntpd 8
  74. daemon should use for outgoing queries to subsequently specified servers.
  75. For example:
  76. .Bd -literal -offset indent
  77. query from 192.0.2.1
  78. query from 2001:db8::1
  79. .Ed
  80. .It Xo Ic sensor Ar device
  81. .Op Ic correction Ar microseconds
  82. .Op Ic weight Ar weight-value
  83. .Op Ic refid Ar string
  84. .Op Ic stratum Ar stratum-value
  85. .Xc
  86. Specify a timedelta sensor device
  87. .Xr ntpd 8
  88. should use.
  89. The sensor can be specified multiple times:
  90. .Xr ntpd 8
  91. will use each given sensor that actually exists.
  92. Non-existent sensors are ignored.
  93. If
  94. .Sq *
  95. is given as device name,
  96. .Xr ntpd 8
  97. will use all timedelta sensors it finds.
  98. .Xr ntpd 8
  99. does not use any timedelta sensor by default.
  100. For example:
  101. .Bd -literal -offset indent
  102. sensor *
  103. sensor nmea0
  104. .Ed
  105. .Pp
  106. An optional correction in microseconds can be given to compensate
  107. for the sensor's offset.
  108. The maximum correction is 127 seconds.
  109. For example, if a DCF77 receiver is lagging 70ms behind
  110. actual time:
  111. .Bd -literal -offset indent
  112. sensor udcf0 correction 70000
  113. .Ed
  114. .Pp
  115. The optional
  116. .Ic weight
  117. keyword permits finer control over the relative importance
  118. of time sources (servers or sensor devices).
  119. Weights are specified in the range 1 to 10;
  120. if no weight is given,
  121. the default is 1.
  122. A server with a weight of 5, for example,
  123. will have five times more influence on time offset calculation
  124. than a server with a weight of 1.
  125. .Pp
  126. An optional reference ID string - up to 4 ASCII characters - can be
  127. given to publish the sensor type to clients.
  128. RFC 2030 suggests some common reference identifiers, but new identifiers
  129. "can be contrived as appropriate."
  130. If an ID string is not given,
  131. .Xr ntpd 8
  132. will use a generic reference ID.
  133. For example:
  134. .Bd -literal -offset indent
  135. sensor nmea0 refid GPS
  136. .Ed
  137. .Pp
  138. A stratum value other than the default of 1 can be assigned using the
  139. .Ic stratum
  140. keyword.
  141. .It Xo Ic server Ar address
  142. .Op Ic weight Ar weight-value
  143. .Xc
  144. Specify the IP address or the hostname of an NTP
  145. server to synchronize to.
  146. If it appears multiple times,
  147. .Xr ntpd 8
  148. will try to synchronize to all of the servers specified.
  149. If a hostname resolves to multiple IPv4 and/or IPv6 addresses,
  150. .Xr ntpd 8
  151. uses the first address.
  152. If it does not get a reply,
  153. .Xr ntpd 8
  154. retries with the next address and continues to do so until a working address
  155. is found.
  156. For example:
  157. .Bd -literal -offset indent
  158. server 10.0.0.2 weight 5
  159. server ntp.example.org weight 1
  160. .Ed
  161. .Pp
  162. To provide redundancy, it is good practice to configure multiple servers.
  163. In general, best accuracy is obtained by using servers that have a low
  164. network latency.
  165. .It Xo Ic servers Ar address
  166. .Op Ic weight Ar weight-value
  167. .Xc
  168. As with
  169. .Cm server ,
  170. specify the IP address or hostname of an NTP server to synchronize to.
  171. If it appears multiple times,
  172. .Xr ntpd 8
  173. will try to synchronize to all of the servers specified.
  174. Should the hostname resolve to multiple IP addresses,
  175. .Xr ntpd 8
  176. will try to synchronize to all of them.
  177. For example:
  178. .Bd -literal -offset indent
  179. servers pool.ntp.org
  180. servers pool.ntp.org weight 5
  181. .Ed
  182. .El
  183. .Sh CONSTRAINTS
  184. .Xr ntpd 8
  185. can be configured to query the
  186. .Sq Date
  187. from trusted HTTPS servers via TLS.
  188. This time information is not used for precision but acts as an
  189. authenticated constraint,
  190. thereby reducing the impact of unauthenticated NTP
  191. man-in-the-middle attacks.
  192. Received NTP packets with time information falling outside of a range
  193. near the constraint will be discarded and such NTP servers
  194. will be marked as invalid.
  195. .Bl -tag -width Ds
  196. .It Ic constraint from Ar url [ip...]
  197. Specify the URL, IP address or the hostname of an HTTPS server to
  198. provide a constraint.
  199. If the url is followed by one or more addresses the url and addresses will be
  200. tried until a working one is found.
  201. The url path and expected certificate name is always taken from the
  202. url specified.
  203. If
  204. .Ic constraint from
  205. is used more than once,
  206. .Xr ntpd 8
  207. will calculate a median constraint from all the servers specified.
  208. .Bd -literal -offset indent
  209. server ntp.example.org
  210. constraint from www.example.com
  211. constraint from "https://9.9.9.9" "2620:fe::9"
  212. .Ed
  213. .It Ic constraints from Ar url
  214. As with
  215. .Ic constraint from ,
  216. specify the URL, IP address or the hostname of an HTTPS server to
  217. provide a constraint.
  218. Should the hostname resolve to multiple IP addresses,
  219. .Xr ntpd 8
  220. will calculate a median constraint from all of them.
  221. For example:
  222. .Bd -literal -offset indent
  223. servers pool.ntp.org
  224. constraints from "https://www.google.com/"
  225. .Ed
  226. .El
  227. .Sh FILES
  228. .Bl -tag -width "/etc/ntpd.confXXX" -compact
  229. .It Pa /etc/ntpd.conf
  230. default
  231. .Xr ntpd 8
  232. configuration file
  233. .El
  234. .Sh SEE ALSO
  235. .Xr ntpctl 8 ,
  236. .Xr ntpd 8 ,
  237. .Xr sysctl 8
  238. .Sh HISTORY
  239. The
  240. .Nm
  241. file format first appeared in
  242. .Ox 3.6 .