restrict 0.asia.pool.ntp.org
restrict 1.asia.pool.ntp.org
restrict 2.asia.pool.ntp.org
restrict 3.asia.pool.ntp.org
restrict 127.0.0.1 mask 255.0.0.0
restrict 192.168.1.0 mask 255.255.255.0 nomodify
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
broadcastdelay 0.008
logfile /var/log/ntp.log
3、查看ntp有没有工作
ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
+arteq.com.tw 220.130.158.51 3 u 29 64 377 93.116 38.782 7.695
211.22.55.116 .INIT. 16 u - 64 0 0.000 0.000 0.000
*203.116.5.254 130.207.244.240 2 u 33 64 377 82.320 31.845 11.375
+q037240.ppp.asa 200.23.51.205 2 u 221 64 150 405.989 -117.80 40.170
ntptrace xxx.xxx.xxx.xxx
xxx.xxx.xxx.xxx: stratum 3, offset -0.029005, synch distance 0.365843
203.116.5.254: timed out, nothing received
***Request timed out
4、查看log文件
tail -f /var/log/ntp.log
12 Jul 15:35:35 ntpd[2089]: synchronized to 59.124.71.8, stratum 3
12 Jul 15:35:35 ntpd[2089]: kernel time sync status change 0001
5、启动服务
/etc/init.d/ntpd start|stop|restart
6、注意事项
服务启动之后,大约5分钟左右才能进行时间服务。看到日志文件出现同步信息,基本服务就好了, 如果过了很长时间没有同步信息或者不能提供时间服务,请检查配置文件。
参考文档:
http://linux.vbird.org/linux_server/0440ntp.php#server_ntp.conf
你可以使用这个链接引用该篇文章 http://publishblog.blogchina.com/blog/tb.b?diaryID=6367911