Rocky|NTP服务

详细可见胡图图

服务端

vi /etc/chrony.conf :编辑指定目录文件


pool 2.pool.ntp.org iburst     《将2.pool.ntp.org改为自己的ip

#Use NTP servers from DHCP.

sourcedir /run/chrony-dhcp

#Record the rate at which the system clock gains/losses time.

driftfile /var/lib/chrony/drift

#Allow the system clock to be stepped in the first three updates

#if its offset is larger than 1 second.

makestep 1.0 3

#Enable kernel synchronization of the real-time clock (RTC).

rtcsync

#Enable hardware timestamping on all interfaces that support it.

#hwtimestamp *

#Increase the minimum number of selectable sources required to adjust

#the system clock.

#minsources 2

#Allow NTP client access from local network.

#allow 192.168.0.0/16        《删掉注释#号

#Serve time even if not synchronized to a time source.

#local stratum 10              《删掉注释#号)


systemctl restart chronyd:重启服务

(服务)       (重启)(服务名称)

systemctl enable chronyd:开启服务的自启动

systemctl start firewalld:启动指定服务

firewall-cmd --zone=public --add-port=123/udp --permanent:对外开放端口

firewall-cmd --reload:重载防火墙配置

firewall-cmd --list-ports:查看当前开放的端口

chronyc sources -v:查看时间服务器的状态

 客户端

只用将2.pool.ntp.org改为服务端的ip

vi /etc/chrony.conf


pool 192.168.204.129 iburst
    
#Use NTP servers from DHCP.

sourcedir /run/chrony-dhcp

#Record the rate at which the system clock gains/losses time.

driftfile /var/lib/chrony/drift

#Allow the system clock to be stepped in the first three updates

#if its offset is larger than 1 second.

makestep 1.0 3

#Enable kernel synchronization of the real-time clock (RTC).

rtcsync

#Enable hardware timestamping on all interfaces that support it.

#hwtimestamp *

#Increase the minimum number of selectable sources required to adjust

#the system clock.

#minsources 2

#Allow NTP client access from local network.

#allow 192.168.0.0/16      

#Serve time even if not synchronized to a time source.

#local stratum 10       

    
systemctl restart chronyd:重启服务

(服务)       (重启)(服务名称)    
chronyc sources -v:查看时间服务器的状态

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值