搭建时间同步服务器

搭建时间同步服务器

时间同步服务器

1.安装时间同步服务器的软件chrony

Cent OS7默认安装

yum install -y chrony  

2.修改chrony的配置文件

 vim /etc/chrony.conf
#将下边的server注释掉或删掉,这是本机器使用的时间同步服务器,我们要让本机作为时间同步服务器,因此,不需要同步别人的时间
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

allow 10.0.0/24  #打开这行的注释,且修改运行访问本台时间同步服务器的网段
local stratum 10   #打开这行注释,这台时间同步服务器的优先级别,级别越高,优先同步

3.安装ntpdate命令

yum install -y ntpdate  #ntpdate命令为同步时间命令,本机作为时间同步服务器,首先时间要准确
ntpdate -u ntp1.aliyun.com  #向阿里的时间时间同步服务器同步一下时间

4.开启chrony服务

systemctl start chronyd

时间同步客户端配置

1.安装时间同步服务器的软件chrony

Cent OS7默认安装

2.修改chrony的配置文件

 vim /etc/chrony.conf
 #将下边的server注释掉或删掉,这是本机器使用的时间同步服务器,我们要让本机作为时间同步服务器,因此,不需要同步别人的时间
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

#增加下边这行,时间同步服务器ip
server 10.0.0.143 iburst

allow 10.0.0.139  #打开这行的注释,修改ip为本机ip,意思为允许这个ip访问时间同步服务器

3.开启chrony服务

systemctl start chronyd  #开启后,就会同步时间同步服务器的时间
#如果时间同步服务时间改变,需要重启客户端的时间同步服务,才能同步
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值