Clock Synchronization with NTP

2009-05-13 07:53:49来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

Contributed by Tom Hukins.
Overview
Over time, a computer's clock is prone to drift. The Network Time Protocol (NTP) is one way to ensure your clock stays accurate.
Many Internet services rely on, or greatly benefit from, computers' clocks being accurate. For example, a web server may receive requests to send a file if it has been modified since a certain time. In a local area network environment, it is essential that computers sharing files from the same file server have synchronized clocks so that file timestamps stay consistent. Services such as
cron(8)
also rely on an accurate system clock to run commands at the specified times.
FreeBSD ships with the
ntpd(8)
NTP server which can be used to query other NTP servers to set the clock on your machine or provide time services to others.
Choosing Appropriate NTP Servers
In order to synchronize your clock, you will need to find one or more NTP servers to use. Your network administrator or ISP may have set up an NTP server for this purpose--check their documentation to see if this is the case. There is an
online list of publicly accessible NTP servers
which you can use to find an NTP server near to you. Make sure you are aware of the policy for any servers you choose, and ask for permission if required.
Choosing several unconnected NTP servers is a good idea in case one of the servers you are using becomes unreachable or its clock is unreliable.
ntpd(8)
uses the responses it receives from other servers intelligently--it will favor unreliable servers less than reliable ones.
Configuring Your Machine
Basic Configuration
If you only wish to synchronize your clock when the machine boots up, you can use
ntpdate(8)
. This may be appropriate for some desktop machines which are frequently rebooted and only require infrequent synchronization, but most machines should run
ntpd(8)
.
Using
ntpdate(8)
at boot time is also a good idea for machines that run
ntpd(8)
. The
ntpd(8)
program changes the clock gradually, whereas
ntpdate(8)
sets the clock, no matter how great the difference between a machine's current clock setting and the correct time.
To enable
ntpdate(8)
at boot time, add ntpdate_enable="YES" to /etc/rc.conf. You will also need to specify all servers you wish to synchronize with and any flags to be passed to
ntpdate(8)
in ntpdate_flags.
General Configuration
NTP is configured by the /etc/ntp.conf file in the format described in
ntp.conf(5)

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:从SHELL版淘来的资料。感谢CU。

下一篇:php 列出目录内容