首页 CentOS CentOS 7 中使用NTP进行时间同步

CentOS 7 中使用NTP进行时间同步

1、确认已经ntp程序包:#yuminstallntp2、配置时间源#vi/etc/ntp.confserverpool.ntp.org#可选择其他优先服务器server2.cn.pool.ntp.orgserver1.asia.pool.ntp.orgserver2.asia.pool.ntp.org#允许上层时间服务器主动修改本机时间

1、确认已经
ntp程序包:

#yuminstallntp

2、配置时间源

#vi/etc/ntp.conf
serverpool.ntp.org
#可选择其他优先服务器
server2.cn.pool.ntp.org
server1.asia.pool.ntp.org
server2.asia.pool.ntp.org
#允许上层时间服务器主动修改本机时间
restrict2.cn.pool.ntp.orgnomodifynotrapnoquery
restrict1.asia.pool.ntp.orgnomodifynotrapnoquery
restrict2.asia.pool.ntp.orgnomodifynotrapnoquery
server127.0.0.1#local
clockfudge127.0.0.1stratum10
3、配置是否为其他PC提供时间服务
#vi/etc/ntp.conf
restrict192.168.1.0mask255.255.255.0nomodifynotrap

4、配置开机时自动运行时间服务
#chkconfigntpdon

5、启动或停止时间服务

#servicentpdstart
#servicentpdstop
#servicentpdrestart

6、验证
ntp服务已经运行
#pgrepntpd

7、初始同步
#ntpdate-utime.lib.tsinghua.edu.cn
8、确认同步成功
#ntpq-p
9、同时建议修改一下
/etc/sysconfig/ntpd文件
#
vi/etc/sysconfig/ntpd
SYNC_HWCLOCK=yes
#改成
yes
吧!这样主机

BIOS
的时间也会跟着一起改变的!


当然,如果要提供时间服务,还必须相应的设置
iptable
防火墙的配置。
CentOS
的时间服务
使用
udp123
端口。

本文来自网络,不代表云浮站长网立场。转载请注明出处: https://www.0766zz.com/html/zhonghe/fwq/centos/20200906/10179.html
上一篇
下一篇

作者: dawei

【声明】:云浮站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

为您推荐

返回顶部