随笔-内网ntps服务器搭建

1、server端修改配置文件

[root@localhost ~]# vim /etc/ntp.conf
# 允许内网的其他机器同步:
restrict 192.168.78.0 mask 255.255.255.0 nomodify notrap

# 外部时间服务器不可用时,以本地时间作为时间服务
server 127.127.1.0  
fudge  127.127.1.0   stratum  5

测试:client端:ntpdate -u 192.168.99.85

2、client端使用ntpd,仍编辑/etc/ntp.conf

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# server 0.centos.pool.ntp.org iburst
# server 1.centos.pool.ntp.org iburst
# server 2.centos.pool.ntp.org iburst
# server 3.centos.pool.ntp.org iburst
server 192.168.99.85
# 允许上层时间服务器主动修改本机时间
restrict 192.168.99.85 nomodify notrap noquery

3、重启ntpd

# 查看服务器是否添加成功:
ntpq -p

# 手动同步时间:
ntpdate -u 192.168.99.85

参考:https://www.jianshu.com/p/4842f079e111

posted @   LiYanbin  阅读(15)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
点击右上角即可分享
微信分享提示