Rocky|NTP服务

发布时间:2026/10/8 1:23:15
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 --zonepublic --add-port123/udp --permanent对外开放端口firewall-cmd --reload:重载防火墙配置firewall-cmd --list-ports查看当前开放的端口chronyc sources -v查看时间服务器的状态客户端只用将2.pool.ntp.org改为服务端的ipvi /etc/chrony.confpool 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 10systemctl restart chronyd重启服务服务 重启服务名称chronyc sources -v查看时间服务器的状态