Linux NTP服务离线安装及配置

1.安装ntp

rpm -qa | grep ntp  (先查看一下,安装系统可能安装了)

rpm -ivh ntp-4.2.6p5-18.el7.centos.x86_64.rpm

2、服务器配置:(/etc/ntp.conf)

[root@localhost etc]# vi /etc/ntp.conf
  
//然后添加这两行 ,意思是 允许IPV4 IPV6 查询 拒绝修改
restrict -4 default kod notrap nomodify   
restrict -6 default kod notrap nomodify 
//添加修改上层时间服务器,如果能联通外网,则不需要修改,
//server 0.rhel.pool.ntp.org iburst
//server 1.rhel.pool.ntp.org iburst
//server 2.rhel.pool.ntp.org iburst
//server 3.rhel.pool.ntp.org iburst
//如果联不通外网,则把上面几行注释,然后添加下面两行,意思是设置成时间服务器是自己
server 127.127.1.0
fudge 127.127.1.0 stratum 8
 
[root@localhost etc]# /bin/systemctl start ntpd.service

3、客户端配置:(/etc/ntp.conf)

[root@localhost etc]# vi /etc/ntp.conf
 
//然后添加这两行 ,意思是 允许IPV4 IPV6 查询 拒绝修改
restrict -4 default kod notrap nomodify   
restrict -6 default kod notrap nomodify
//允许上层进行修改本机时间
//restrict 10.173.24.27 nomodify notrap noquery
//配置上层server(要同步的),在这里配置的是实际的物理地址
server 192.168.6.171  
fudge 192.168.6.171 stratum 8 
 
//同步主节点ntp服务器
[root@localhost etc]# ntpdate -u master.msxf.hadoop 
[root@localhost etc]# /bin/systemctl start ntpd.service

通过date 查看时间

4.注意

    如果你同步之后,发现时间还是不对,你看看你的两台的机器的时差CST和EDT

解决办法:https://blog.csdn.net/Com_ma/article/details/77987449

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序员s

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值