1.安装ntp
- yum install ntp -y
2.自动同步时间
- ntpdate cn.ntp.org.cn
3.开启本地ntp服务器
- vi /etc/ntp.conf
#=========权限控制================
restrict default kod nomodify notrap nopeer noquery 拒绝IPV4用户
restrict -6 default kod nomodify notrap nopeer noquery 拒绝IPV6用户
restrict 210.72.145.44 授权国家授时中心服务器访问本地NTP
restrict 133.100.11.8 授权133.100.11.8访问本非NTP
restrict 127.0.0.1
restrict -6 ::1
restrict 192.168.100.100 mask 255.255.255.0 nomodify 本地网段授权访问
#=========源服务器================
server cn.ntp.org.cn prefer 指定上级更新时间服务器,优先使用这个地址
#=========差异分析================
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
4.客户端同步时间
- ntpdate 192.168.100.100
![]()
错误如上图:
方法1:关闭ntp防火墙
方法2:将123/udp端口放行 firewall-cmd --zone=public --add-port=123/udp --permanent
本文档详细介绍了如何在Linux系统中安装和配置NTP服务器,包括设置权限控制、指定上级时间服务器、开启服务,并解决客户端时间同步时遇到的防火墙问题。通过开放123/udp端口,确保了NTP服务的正常运行。
2114

被折叠的 条评论
为什么被折叠?



