美文网首页
Centos7服务器时间同步

Centos7服务器时间同步

作者: 霹雳解锋镝 | 来源:发表于2019-08-19 17:19 被阅读0次

1、安装ntp

查看是否安装ntp
rpm -q ntp
安装ntp
yum -y install ntp
systemctl enable ntpd
systemctl start ntpd
时间服务器端:标准时间设置(手动不同时间)
ntpdate -u cn.pool.ntp.org

2、服务器端配置

修改/etc/ntp.conf文件
restrict 192.168.162.0 mask255.255.255.0 nomodify notrap
## 远程时间服务器配置
server 2.cn.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
restrict 2.cn.pool.ntp.orgnomodify notrap noquery
restrict 1.asia.pool.ntp.orgnomodify notrap noquery
restrict 2.asia.pool.ntp.orgnomodify notrap noquery
## 本地时间服务器配置
server 127.127.1.0 # localclock
fudge 127.127.1.0 stratum 10

3、客户端配置

修改/etc/ntp.conf文件
server 192.168.162.130
restrict 192.168.162.130  nomodify notrap noquery

# 同步本地时间
server 127.127.1.0 # localclock
fudge 127.127.1.0 stratum 10

4、重启ntpd服务

systemctl restart ntpd
修改配置:vim /etc/sysconfig/ntpd
  OPTIONS= "-g -x"
  SYNC_HWCLOCK=yes

5、常用命令:

ntpstat:查看服务器时间不同状态
service ntpd status:查看ntp启动状态

相关文章

网友评论

      本文标题:Centos7服务器时间同步

      本文链接:https://www.haomeiwen.com/subject/klsesctx.html