linux 时钟同步

查看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服务





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值