服务器信息 服务端 192.168.1.99 客户端 192.168.1.100-120
yum install ntp -y vim /etc/ntp.conf # 若服务器能出外网则配置阿里云时间 server ntp.aliyun.com iburst # 内网就使用本机时间作为时间同步服务器。 server 127.0.0.1 iburst local stratum 10 # 注释这行,所有主机均可访问 # restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap # 启动并开机自启ntpd服务 systemctl enable --now ntpd
客户端
yum install ntp -y vim /etc/ntp.conf # 注释所有 restrict 开头的配置信息 # 添加一行 填写服务端ip,同步本机时间与服务端一致 server 192.168.1.99 iburst # 启动并开机自启ntpd服务 systemctl enable --now ntpd
# 验证 随便设置一个时间 [root@localhost ~]# date -s "2025-05-20 12:00:00" 2025年 05月 20日 星期二 12:00:00 CST # 查看同步服务器配置信息 [root@localhost ~]# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== *192.168.1.99 .INIT. 16 u - 64 0 0.000 0.000 0.000 # 重启ntp服务器 [root@localhost ~]# systemctl start ntpd # 同步成功 [root@localhost ~]# date 2025年 05月 20日 星期二 10:30:36 CST
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

评论(0)