服务器:Centos8 服务:chronyd
系统自带chronyd服务
服务器部署
# 使用systemctl启动服务 systemctl start chronyd # 开启自启 systemctl enable chronyd # 修改配置文件,一般默认在/etc/chrony.conf # 注释掉原有的"pool 2.centos.pool.ntp.org iburst",删除前面#号 server ntp1.aliyun.com iburst server ntp2.aliyun.com iburst # 然后找到allow关键字,填写内网网段,表示指定网段客户端使用这个服务器 # Allow NTP client access from local network. allow 192.168.0.0/24 allow 10.0.0.0/24 # :wq保存 # 重启服务 systemctl restart chronyd # 配置时区 timedatectl set-timezone Asia/Shanghai # 查看时区列表 timedatectl list-timezones # 查看系统时间 date # 检查ntp服务同步状态 timedatectl # 显示如下表示同步正常 time: 四 2024-12-05 10:34:28 CST Universal time:四 2024-12-05 02:34:28 UTC RTC time: 四 2024-12-05 02:30:46 Time zone: Asia/Shanghai (CST, +0800) System clock synchronized: yes NTP service: active RTC in local TZ: no
网络设备配置
H3C设备为例
# 配置时区 clock timezone Beijing add 08:00:00 # 启用NTP协议支持 clock protocol ntp # 开启NTP服务 ntp-service enable # 定义内网ntp服务器 ntp-service unicast-peer 192.168.0.3 # 保存配置 save f