linux服务器时间同步
2018-03-01 16:11
246 查看
由于分布式系统对时间一致性要求比较高,因此需要一台同一时间的服务器,其他服务器时间以他为准。
这里使用的工具是ntp 4.2.6p5
操作系统为centos7
一、设置时间服务器
修改/etc/ntp.confrestrict default nomodify notrap nopeer noquer
restrict 192.168.160.0 mask 255.255.255.0 nomodify notrap
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org
server 3.cn.pool.ntp.org
restrict 0.cn.pool.ntp.org
restrict 1.cn.pool.ntp.org
restrict 2.cn.pool.ntp.org
restrict 3.cn.pool.ntp.org
server 127.0.0.1
fudge 127.0.0.1 stratum 10
权限配置关键字如下:
ignore:关闭所有的 NTP 联机服务 nomodify:客户端不能更改服务端的时间参数,但是客户端可以通过服务端进行网络校时。 notrust :客户端除非通过认证,否则该客户端来源将被视为不信任子网 noquery :不提供客户端的时间查询:用户端不能使用ntpq,ntpc等命令来查询ntp服务器 notrap :不提供trap远端登陆:拒绝为匹配的主机提供模式 6 控制消息陷阱服务。陷阱服务是 ntpdq 控制消息协议的子系统,用于远程事件日 志记录程序。 nopeer :用于阻止主机尝试与服务器对等,并允许欺诈性服务器控制时钟 kod : 访问违规时发送 KoD 包。 restrict -6 表示IPV6地址的权限设置。
restrict 192.168.160.0 mask 255.255.255.0 nomodify notrap 表示对160网段的客户端开放网络校时功能
server 后面跟的地址为校时服务器上层的校时服务器,其中127.0.0.1表示,根据自己校时
fudge 127.0.0.1 stratum 10 其中stratum的范围为0-15
开启ntp服务 ntpd -c /etc/ntp.conf 每次修改了配置文件,都需要重启ntp服务
二、设置客户端
修改/etc/ntp.confserver 校时服务器ip 将校时命令配置到crontab中*/5 * * * * /usr/sbin/ntpdate 192.168.160.66 &> /var/log/ntpdate.log 注意:不能直接使用ntpdate 校时服务器ip
这里使用的工具是ntp 4.2.6p5
操作系统为centos7
一、设置时间服务器
修改/etc/ntp.confrestrict default nomodify notrap nopeer noquer
restrict 192.168.160.0 mask 255.255.255.0 nomodify notrap
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server 2.cn.pool.ntp.org
server 3.cn.pool.ntp.org
restrict 0.cn.pool.ntp.org
restrict 1.cn.pool.ntp.org
restrict 2.cn.pool.ntp.org
restrict 3.cn.pool.ntp.org
server 127.0.0.1
fudge 127.0.0.1 stratum 10
权限配置关键字如下:
ignore:关闭所有的 NTP 联机服务 nomodify:客户端不能更改服务端的时间参数,但是客户端可以通过服务端进行网络校时。 notrust :客户端除非通过认证,否则该客户端来源将被视为不信任子网 noquery :不提供客户端的时间查询:用户端不能使用ntpq,ntpc等命令来查询ntp服务器 notrap :不提供trap远端登陆:拒绝为匹配的主机提供模式 6 控制消息陷阱服务。陷阱服务是 ntpdq 控制消息协议的子系统,用于远程事件日 志记录程序。 nopeer :用于阻止主机尝试与服务器对等,并允许欺诈性服务器控制时钟 kod : 访问违规时发送 KoD 包。 restrict -6 表示IPV6地址的权限设置。
restrict 192.168.160.0 mask 255.255.255.0 nomodify notrap 表示对160网段的客户端开放网络校时功能
server 后面跟的地址为校时服务器上层的校时服务器,其中127.0.0.1表示,根据自己校时
fudge 127.0.0.1 stratum 10 其中stratum的范围为0-15
开启ntp服务 ntpd -c /etc/ntp.conf 每次修改了配置文件,都需要重启ntp服务
二、设置客户端
修改/etc/ntp.confserver 校时服务器ip 将校时命令配置到crontab中*/5 * * * * /usr/sbin/ntpdate 192.168.160.66 &> /var/log/ntpdate.log 注意:不能直接使用ntpdate 校时服务器ip
相关文章推荐
- 让Linux服务器时间同步
- Linux服务器时间同步
- linux服务器应用NTP配置时间同步
- 局域网内Linux服务器时间同步
- Linux服务器时间设置及同步
- Linux服务器时间同步
- LINUX服务器集群时间同步之NTP配置
- linux服务器时间同步
- Linux服务器同步网络时间
- linux服务器同步时间
- Linux服务器时间同步
- Linux服务器时间同步
- Linux服务器时间同步
- Linux服务器同步网络时间
- LINUX服务器同步时间
- LINUX服务器集群时间同步之NTP配置
- 局域网内Linux服务器时间同步
- Linux服务器时间同步
- linux服务器系统时间同步设置方法
- Linux服务器时间同步