使用ntpdate更新linux时间的时候出现 no server suitable for synchronization found解决办法
2022/1/29 7:06:02
本文主要是介绍使用ntpdate更新linux时间的时候出现 no server suitable for synchronization found解决办法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
问题
在linux下执行/usr/sbin/ntpdate time.nist.gov
出现错误提示no server suitable for synchronization found
分析
可能是防火墙造成的
可以先关闭防火墙,然后在执行时间同步的命令,如果时间同步成功则证实是防火墙的题目,须要更改iptables的设置。
关闭防火墙,尝试同步时间
# 关闭防火墙 service iptables stop # 同步时间 /usr/sbin/ntpdate time.nist.gov
如果上面执行后能正常进行时间的同步,那么证实了是防火墙的设置问题,则开放服务器的tcp和udp协议的123端口。
防火墙设置
# 进栈的udp设置 iptables -s 源地址 -I INPUT -m udp -p udp --dport 123 -j ACCEPT # 进栈的tcp设置 iptables -A INPUT -s 源地址 -p tcp -m tcp --dport 123 -j ACCEPT # 出栈的udp设置 iptables -d 目标地址 -I OUTPUT -m udp -p udp --dport 123 -j ACCEPT # 出栈的tcp设置 iptables -A OUTPUT -d 目的IP -p tcp -m tcp --dport 123 -j ACCEPT # 保存策略,并重启iptables service iptables save service iptables restart # 查询iptables是否设置成功 iptables -nvL INPUT |grep "IP地址" iptables -nvL OUTPUT |grep "IP地址"
检查一下ntpd的服务
检查是否开启,如果已经开启的需要关闭ntpd服务,如不关闭则会报the NTP socket is in use, exiting
service ntpd stop
这篇关于使用ntpdate更新linux时间的时候出现 no server suitable for synchronization found解决办法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-06-0600-macOS和Linux安装和管理多个Python版本
- 2024-03-30[译]漫画SELinux概念
- 2024-03-29linux 移动文件
- 2024-03-28linux .so file
- 2024-03-28Linux 磁盘管理
- 2024-03-28Linux学习笔记(十三)磁盘管理(一):磁盘分区
- 2024-03-26linux 创建 文件
- 2024-03-25使用SecureCRT对Linux vim进行颜色设置
- 2024-03-202019-2020-12 20199317 《Linux内核原理与分析》 第十二周作业
- 2024-03-20Linux运维的第二周总结