实现私有的时间服务器

配置服务端:

服务端配置:
[root@cent7_yzil ~]# hostname -I
10.0.0.121 

[root@cent7_yzil ~]# yum -y install chrony   


[root@cent7_yzil ~]# vim /etc/chrony.conf
server ntp.aliyun.com iburst
server ntp1.aliyun.com iburst
server ntp2.aliyun.com iburst


# Allow NTP client access from local network.
#allow 192.168.0.0/16
allow 10.0.0.0/24     #加此行,指定允许同步的网段 

# Serve time even if not synchronized to a time source.
local stratum 10      #删除此行注释,当互联网无法连接,仍然可以为客户端提供时间同步服务

[root@cent7_yzil ~]# systemctl restart chronyd
[root@cent7_yzil ~]# chronyc sources -v
210 Number of sources = 2

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 203.107.6.88                  2   6    17    18   +444us[+2371us] +/-   25ms
^- 120.25.115.20                 2   6    17    19  -1082us[-1082us] +/-   27ms
[root@cent7_yzil ~]#

#服务启动后会打开端口123/udp
[root@cent7_yzil ~]# ss -ntlu
Netid State      Recv-Q Send-Q                   Local Address:Port                                  Peer Address:Port              
udp   UNCONN     0      0                            127.0.0.1:323                                              *:*                  
udp   UNCONN     0      0                                    *:5353                                             *:*                                                           *:*                  
udp   UNCONN     0      0                                    *:123                                              *:* 
[root@cent7_yzil ~]# 
  

 客户端配置:

[root@cent8_yzil ~]# vim /etc/chrony.conf
server 10.0.0.121 iburst

[root@cent8_yzil ~]# systemctl restart chronyd

#确认同步成功
[root@cent8_yzil ~]# chronyc sources -v
210 Number of sources = 1

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 10.0.0.121                    2   7   377     1  +4765us[+5003us] +/-   26ms
[root@cent8_yzil ~]# 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

y_zilong

一分钱的肯定

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

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

打赏作者

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

抵扣说明:

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

余额充值