您的位置:首页 > 运维架构 > Linux

linux 时钟同步

2014-05-25 11:03 411 查看
查看ntp服务是否安装

[root@racdb03 ~]# rpm -qa|grep ntp

chkfontpath-1.10.1-1.1

ntp-4.2.2p1-9.el5_3.2

修改/etc/ntp.conf

vi /etc/ntp.conf

增加以下内容

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

server 203.117.180.36

注释:允许192.168.1.0网段的所有设备使用NTP服务器进行时钟同步;203.117.180.36为NTP服务器IP地址

启动NTP服务

[root@racdb03 ~]# service ntpd start

启动 ntpd:                                                [确定]

开机自动启动

[root@racdb03 ~]# chkconfig ntpd on

检查同步情况

[root@racdb03 ~]# ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter

==============================================================================

 203.117.180.36  .ACTS. 1  u  117  256  337  130.850  15573.9 1334.29

*LOCAL(0)        .LOCL.     10 l   51   64  377    0.000    0.000   0.001

[root@racdb03 ~]# ntpstat

synchronised to local net at stratum 11 

   time correct to within 11 ms

   polling server every 512 s

ntp客户端配置

[root@racdb04 ~]# crontab -l

0 0 * * 6 /usr/sbin/ntpdate 192.168.1.108 

注释:每周六0点进行时钟同步; /usr/sbin/ntpdate为绝对路径,否则可能要报错

           在ntp客户端上不用启动ntpd服务
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: