centos7 内网时间同步

1、安装 ntp

yum install ntpdate -y

2、选中一台机器(10.10.171.158)作为同步服务器,修改/etc/ntp.conf配置文件

vi /etc/ntp.conf

#注释掉这几行
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst

#添加
server 127.127.1.0 iburst

3、启动ntp服务,设置开机自动启动

systemctl start ntpd
systemctl enable ntpd

4、其他服务器,同样修改/etc/ntp.conf

#注释掉其他上游时间服务器
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
#配置上游时间服务器为本地的ntpd Server服务器
server 10.10.171.158
#配置允许上游时间服务器主动修改本机的时间
restrict 10.10.171.158 nomodify notrap noquery

5、同步时间

ntpdate -u 192.168.0.163

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值