About NTP
NTP ( networktime Protocol UTC 0.1ms In most places on the Internet its accuracy can be achieved 1-50ms .
NTP The server is using NTP the protocol provides time synchronization services.
NTP Server Installation
View system comes with NTP
[Email protected] ~]# Rpm-qa ntpntp-4.2.6p5-5.el6.centos.x86_64
If not, install
[[email protected] ~]# yum-y install NTP
Configuring the NTP Service
[[email protected] ~]# vim/etc/ntp.conf# restrict default kod nomodify notrap nopeernoqueryrestrict default nomodify# nom The Odify client can synchronize the # default time synchronization source comment instead to the available source # server 0.centos.pool.ntp.org iburst# server 1.centos.pool.ntp.org iburst# server 2. centos.pool.ntp.org iburst# server 3.centos.pool.ntp.org iburstserver ntp1.aliyun.comserver time.nist.gov
Start the NTP server
If scheduled tasks have time synchronization, commenting first, the two usages will conflict.
[[email protected] ~]# crontab-e# time sync by syaving at 2010-8-8#*/5 * * * */usr/sbin/ntpdate TIME.NIST.GOV>/DEV/NU ll 2>&1
[[email protected] ~]# /etc/init.d/ntpd startstarting ntpd: [ OK ][[email protected] ~]# ntpq -p remote refid st t when poll reach delay offset jitter==============================================================================* Ntp1.aliyun.com 10.137.38.86 2 u 22 64 1 525.885 -42.367 0.000[[email protected] ~ ]# ntpstatsynchronised to ntp server (110.75.186.247) atstratum 3 timecorrect to within 4257 ms pollingserver every 64 s[[email protected] ~]# ntpdate 10.0.0.130 7 Dec18:43:07 ntpdate[26950]: the NTP socket Is in use, exiting
Client time synchronization
The client will wait a few minutes and then start with the new NTP The server makes time synchronization, otherwise it prompts no server suitable for Synchronizationfound error.
[[Email protected] ~]# # ntpdate 10.0.0.130 7 dec18:40:16 ntpdate[1453]: Step time server 10.0.0.130 offset 40.880807 sec
Put the command into a scheduled task.
Note: You need to comment out the previous timer task
[[email protected] ~]# crontab-e# time sync by syaving at 2010-8-8*/5 * * * * ntpdate 10.0.0.130 >/dev/null2>&1
This article comes from "lone man quick!" The walkers are far away! "Blog, be sure to keep this provenance http://syaving.blog.51cto.com/5614476/1869685
Local NTP time server