linux定时同步时间chrony,Linux基本使用(十七)时间同步chronyd

1. 修改配置文件

yum list chrony

查看相关配置文件路径

rpm -qc chrony

修改配置文件

vim /etc/chrony.conf

修改国内服务器,添加server

# Use public servers from the pool.ntp.org project.

# Please consider joining the pool (http://www.pool.ntp.org/join.html).

# server 0.centos.pool.ntp.org iburst

server cn.ntp.org.cn iburst

server 1.centos.pool.ntp.org iburst

server 2.centos.pool.ntp.org iburst

server 3.centos.pool.ntp.org iburst

重启服务

systemctl restart chronyd.service

2. 通过命令临时同步

前提是chronyd服务未开启。

chronyd -q "server cn.ntp.org.cn iburst"

3. 时间服务器搭建

修改配置文件

vim /etc/chrony.conf

添加如下内容,允许192.168.179网段访问服务器

# Allow NTP client access from local network.

#allow 192.168.0.0/16

allow 192.168.179.0/24

重启服务器

systemctl restart chronyd.service

查看端口监听(123/UDP)

netstat -nlup | grep chronyd

防火墙添加端口

firewall-cmd --permanent --add-port=123/udp

firewall-cmd --reload

之后客户端连接配置的服务器即可

4. 查看信息

查看源信息

root@localhost ~]# chronyc sources

210 Number of sources = 4

MS Name/IP address Stratum Poll Reach LastRx Last sample

===============================================================================

^- 58.220.133.132 3 6 377 54 +245us[ +245us] +/- 103ms

^- amy.chl.la 2 6 377 56 +6694us[+6694us] +/- 118ms

^- stratum2-1.ntp.led01.ru.> 2 6 365 51 +23ms[ +23ms] +/- 104ms

^* 120.25.115.20 2 6 377 56 -1019us[-1188us] +/- 4966us

同步时间

chronyc makestep

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值