首页 > 其他 > 详细

linux--ntp同步时间

时间:2014-02-28 16:34:37      阅读:515      评论:0      收藏:0      [点我收藏+]

             linux ntp 同步时间



弑神linux机器时间同步方法:


(1) #/etc/init.d/ntpd stop先关闭本机的ntp服务

(2) #vim /etc/crontab 添加计划任务

0 3 ** *root ntpdate 219.238.221.31

(3) #vim /etc/sysconfig/ntpd#执行系统时间与硬件时间同步

SYNC_HWCLOCK=yes

(4) #clock -w将系统时间写入硬件

(5) #ntpq -p查看ntp服务状态信息

synchronised to NTP server(115.182.1.207) at stratum 3

time correct to within 112 ms

polling server every 1024 s

(6) #netstat -tunl|grep 123查看ntp端口

udp00 192.168.60.59:1230.0.0.0:*

udp00 118.26.227.59:1230.0.0.0:*

udp00 127.0.0.1:1230.0.0.0:*

udp00 0.0.0.0:1230.0.0.0:*

udp00 ::1:123:::*

udp00 :::123:::*

(7) #vim /etc/ntp.conf

restrict 127.0.0.1

restrict -6 ::1

restrict default kod nomodify notrapnopeer noquery

restrict -6 default kod nomodifynotrap nopeer noquery

driftfile /var/lib/ntp/drift

server ntp1.gyyx.cn

server ntp2.gyyx.cn

Server 219.238.221.31 prefer


本文出自 “蜗牛的家” 博客,请务必保留此出处http://winters.blog.51cto.com/5617866/1364180

linux--ntp同步时间,布布扣,bubuko.com

linux--ntp同步时间

原文:http://winters.blog.51cto.com/5617866/1364180

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!