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.

264 lines
6.9 KiB

7 years ago
7 years ago
9 years ago
9 years ago
  1. .\" $OpenBSD: ntpd.conf.5,v 1.44 2020/02/10 13:18:21 schwarze 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: February 10 2020 $
  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 refid Ar ID-string
  83. .Op Ic stratum Ar stratum-value
  84. .Op Ic trusted
  85. .Op Ic weight Ar weight-value
  86. .Xc
  87. Specify a timedelta sensor device
  88. .Xr ntpd 8
  89. should use.
  90. The sensor can be specified multiple times:
  91. .Xr ntpd 8
  92. will use each given sensor that actually exists.
  93. Non-existent sensors are ignored.
  94. If
  95. .Sq *
  96. is given as device name,
  97. .Xr ntpd 8
  98. will use all timedelta sensors it finds.
  99. .Xr ntpd 8
  100. does not use any timedelta sensor by default.
  101. For example:
  102. .Bd -literal -offset indent
  103. sensor *
  104. sensor nmea0
  105. .Ed
  106. .Pp
  107. A
  108. .Ic correction
  109. in microseconds can be given to compensate
  110. for the sensor's offset.
  111. The maximum correction is 127 seconds.
  112. For example, if a DCF77 receiver is lagging 70ms behind
  113. actual time:
  114. .Bd -literal -offset indent
  115. sensor udcf0 correction 70000
  116. .Ed
  117. .Pp
  118. A
  119. .Ic refid
  120. .Ar ID-string
  121. of up up to 4 ASCII characters can be
  122. given to publish the sensor type to clients.
  123. RFC 2030 suggests some common reference identifiers, but new identifiers
  124. "can be contrived as appropriate."
  125. If an
  126. .Ar ID-string
  127. is not given,
  128. .Xr ntpd 8
  129. will use a generic reference ID.
  130. For example:
  131. .Bd -literal -offset indent
  132. sensor nmea0 refid GPS
  133. .Ed
  134. .Pp
  135. The
  136. .Ic stratum
  137. keyword can be used to change the stratum value from the default of 1.
  138. .Pp
  139. The
  140. .Ic trusted
  141. keyword indicates the time learned is secure, trustworthy,
  142. and not vulnerable to man-in-the-middle attacks, so
  143. .Ic constraints
  144. validation is skipped.
  145. This is useful for boot-time correction in environments where
  146. .Ic constraints
  147. cannot be used.
  148. .Pp
  149. The
  150. .Ic weight
  151. keyword permits finer control over the relative importance
  152. of time sources (servers or sensor devices).
  153. Weights are specified in the range 1 to 10;
  154. if no weight is given,
  155. the default is 1.
  156. A server with a weight of 5, for example,
  157. will have five times more influence on time offset calculation
  158. than a server with a weight of 1.
  159. .It Xo Ic server Ar address
  160. .Op Ic trusted
  161. .Op Ic weight Ar weight-value
  162. .Xc
  163. Specify the IP address or the hostname of an NTP
  164. server to synchronize to.
  165. If it appears multiple times,
  166. .Xr ntpd 8
  167. will try to synchronize to all of the servers specified.
  168. If a hostname resolves to multiple IPv4 and/or IPv6 addresses,
  169. .Xr ntpd 8
  170. uses the first address.
  171. If it does not get a reply,
  172. .Xr ntpd 8
  173. retries with the next address and continues to do so until a working address
  174. is found.
  175. For example:
  176. .Bd -literal -offset indent
  177. server 10.0.0.2 weight 5
  178. server ntp.example.org weight 1
  179. .Ed
  180. .Pp
  181. To provide redundancy, it is good practice to configure multiple servers.
  182. In general, best accuracy is obtained by using servers that have a low
  183. network latency.
  184. .It Xo Ic servers Ar address
  185. .Op Ic trusted
  186. .Op Ic weight Ar weight-value
  187. .Xc
  188. As with
  189. .Cm server ,
  190. specify the IP address or hostname of an NTP server to synchronize to.
  191. If it appears multiple times,
  192. .Xr ntpd 8
  193. will try to synchronize to all of the servers specified.
  194. Should the hostname resolve to multiple IP addresses,
  195. .Xr ntpd 8
  196. will try to synchronize to all of them.
  197. For example:
  198. .Bd -literal -offset indent
  199. servers pool.ntp.org
  200. servers pool.ntp.org weight 5
  201. .Ed
  202. .El
  203. .Sh CONSTRAINTS
  204. .Xr ntpd 8
  205. can be configured to query the
  206. .Sq Date
  207. from trusted HTTPS servers via TLS.
  208. This time information is not used for precision but acts as an
  209. authenticated constraint,
  210. thereby reducing the impact of unauthenticated NTP
  211. man-in-the-middle attacks.
  212. Received NTP packets with time information falling outside of a range
  213. near the constraint will be discarded and such NTP servers
  214. will be marked as invalid.
  215. .Bl -tag -width Ds
  216. .It Ic constraint from Ar url [ip...]
  217. Specify the URL, IP address or the hostname of an HTTPS server to
  218. provide a constraint.
  219. If the url is followed by one or more addresses the url and addresses will be
  220. tried until a working one is found.
  221. The url path and expected certificate name is always taken from the
  222. url specified.
  223. If
  224. .Ic constraint from
  225. is used more than once,
  226. .Xr ntpd 8
  227. will calculate a median constraint from all the servers specified.
  228. .Bd -literal -offset indent
  229. server ntp.example.org
  230. constraint from www.example.com
  231. constraint from "https://9.9.9.9" "2620:fe::9"
  232. .Ed
  233. .It Ic constraints from Ar url
  234. As with
  235. .Ic constraint from ,
  236. specify the URL, IP address or the hostname of an HTTPS server to
  237. provide a constraint.
  238. Should the hostname resolve to multiple IP addresses,
  239. .Xr ntpd 8
  240. will calculate a median constraint from all of them.
  241. For example:
  242. .Bd -literal -offset indent
  243. servers pool.ntp.org
  244. constraints from "https://www.google.com/"
  245. .Ed
  246. .El
  247. .Sh FILES
  248. .Bl -tag -width /etc/examples/ntpd.conf -compact
  249. .It Pa /etc/ntpd.conf
  250. default
  251. .Xr ntpd 8
  252. configuration file
  253. .It Pa /etc/examples/ntpd.conf
  254. example configuration file
  255. .El
  256. .Sh SEE ALSO
  257. .Xr ntpctl 8 ,
  258. .Xr ntpd 8 ,
  259. .Xr sysctl 8
  260. .Sh HISTORY
  261. The
  262. .Nm
  263. file format first appeared in
  264. .Ox 3.6 .