时间服务器
时间服务器配置: 1 安装软件包: [[email?protected] ~]# yum install ntp –y 2 修改配置文件 [[email?protected] ~]# vim /etc/ntp.conf # 允许内网其他机器同步时间 192.168.1.0该网段 restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap 允许任何ip的客户机都可以进行时间同步 将restrict default kod nomodify notrap nopeer noquery修改为如下行: Restrict default nomodify 参数主要有以下几个: ignore :关闭所有的 NTP 联机服务 nomodify:客户端不能更改服务端的时间参数,但是客户端可以通过服务端进行网络校时。 notrust:客户端除非通过认证,否则该客户端来源将被视为不信任子网 noquery:不提供客户端的时间查询 ?notrap :不提供trap远端登陆:拒绝为匹配的主机提供模式 6 控制消息陷阱服务。陷阱服务是 ntpdq 控制消息协议的子系统,用于远程事件日志记录程序。 ?nopeer :用于阻止主机尝试与服务器对等,并允许欺诈性服务器控制时钟 ?kod : 访问违规时发送 KoD 包。 ? server段 server? IP地址或域名 [prefer]??? perfer优先 server 192.168.1.103 fudge 192.168.1.103 stratum 10 启动服务: [[email?protected] ~]# systemctl start ntpd.service [[email?protected] ~]# systemctl enable ntpd.service 客户端同步: Ntpdate?? 192.168.1.103 报错 20 Oct 16:51:24 ntpdate[2340]: no server suitable for synchronization found ? 错误1:ntpdate -u ip -> ?no server suitable for synchronization found 判断:在ntp客户端用ntpdate –d serverIP查看,发现有“Server dropped: strata too high”的错误,并且显示“stratum 16”。而正常情况下stratum这个值得范围是“0~15”。 原因:NTP server还没有和其自身或者它的server同步上。在ntp server上重新启动ntp服务后,ntp server自身或者与其server的同步的需要一个时间段,这个过程可能是5分钟,在这个时间之内在客户端运行ntpdate命令时会产生no server suitable for synchronization found的错误。 处理:等待几分钟后,重试一般解决。 也可以使用命令 ntpq -p查看情况 ? 查看服务连接和监听 ? ? ? ntpq -p 查看网络中的NTP服务器,同时显示客户端和每个服务器的关系 ? ? ntpstat 命令查看时间同步状态,这个一般需要5-10分钟后才能成功连接和同步 ? ? ? 客户端同步 ? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |