rhel7时间服务器chrony

RHEL7中默认使用chrony作为时间服务器,也支持NTP,需要额外安装。
NTP与chrony不能同时存在,只能用其中一个,并将另一个mask掉


实验-设置本地时间服务器
在qin1上
vim /etc/chrony.conf
#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 #注释掉
local stratum 10 #取消注释
allow 192.168.100.0/24
systemctl restart chronyd.service
#chrony不与本地时间同步之前无法对外提供服务,有时需等待几分钟


在qin2上
vim /etc/chrony.conf
#server 0.rhel.pool.ntp.org iburst #注释掉
#server 1.rhel.pool.ntp.org iburst #注释掉
#server 2.rhel.pool.ntp.org iburst #注释掉
server 192.168.100.1 iburst #修改
systemctl restart chronyd.service
timedatectl #NTP synchronized显示为yes说明同步成功


chronyc sources -v #查看时间同步源
chronyc sourcestats -v #查看时间同步源状态
timedatectl list-timezones #列出时区
timedatectl set-timezone Asia/Shanghai #设置时区
timedatectl set-time "2015-01-21 11:50:00"
timedatectl set-time "2015-01-21"
timedatectl set-time "11:50:00"
ntpdate 192.168.100.1


兼容ntp类的命令
date
date -s "2015-01-21 11:50:00"
date -s "2015-01-21"
date -s "11:50:00"
ntpdate 192.168.100.1 #与192.168.100.1同步
hwclock -s #从主板时间同步
hwclock -w #将系统时间写入主板时间
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值