美文网首页
21ntp服务器

21ntp服务器

作者: 被运维耽误的厨子 | 来源:发表于2019-10-04 11:07 被阅读0次

本文来自上海学员马振凯

NTP安装部署

1.安装软件ntpdate

[root@m01 ~]# yum install -y ntp ntpdate

2.备份ntp服务器配置文件

[root@m01 ~]# cp /etc/ntp.conf /etc/ntp.conf.bak

3.精简优化配置文件

[root@m01 ~]# egrep -v "^$|#" /etc/ntp.conf.bak >/etc/ntp.conf

4.编辑配置文件

[root@m01 ~]# vim /etc/ntp.conf
ftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
#允许内网其他机器同步时间
restrict 172.16.1.0 mask 255.255.255.0 nomodify notr
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
#定义使用的上游 ntp服务器,将原来的注释
server ntp1.aliyun.com
server time1.aliyun.com
#允许上层时间服务器主动修改本机时间
restrict time1.aliyun.com nomodify notrap noquery
restrict ntp1.aliyun.com nomodify notrap noquery
#外部时间服务器不可用时,以本地时间作为时间服务
server 127.127.1.0
fudge 127.127.1.0 stratum 10
includefile /etc/ntp/crypto/pw
keys /etc/ntp/keys

5.启动NTP服务器和显示节点列表

[root@m01 ~]# systemctl start ntpd
[root@m01 ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 120.25.115.20   10.137.53.7      2 u    8   64    1   32.515    2.672   0.000
 203.107.6.88    10.137.38.86     2 u    7   64    1   24.061    4.179   0.000
*LOCAL(0)        .LOCL.          10 l    6   64    1    0.000    0.000   0.000

6.客户端测试

[root@web01 ~]# date -s 20190825    #更改时间
Sun Aug 25 00:00:00 CST 2019

[root@web01 ~]# ntpdate 172.16.1.61   #同步测试
2 Oct 09:22:40 ntpdate[1606]: adjust time server 172.16.1.61 offset 0.001950 sec

相关文章

  • 21ntp服务器

    本文来自上海学员马振凯 NTP安装部署 1.安装软件ntpdate 2.备份ntp服务器配置文件 3.精简优化配置...

  • 服务器硬件了解

    常见服务器品牌包括: IBM服务器、Dell服务器、HP服务器、浪潮服务器、华为服务器。 服务器硬件组成: 服务器...

  • 服务器和客户端

    服务器相关知识 服务器 服务器概念:能够提供某种服务的机器被称为服务器 服务器分类 服务器类型 文件服务器:向客...

  • 19

    服务器刀片服务器(电脑)不同的服务器需求是不一样的。服务器机器:服务器被攻击了,买了一台服务器。服务器挂了。服务器...

  • pomelo学习

    1,gate服务器 connector服务器 game服务器connector服务器和gate服务器间通过r...

  • MySql配置主主复制

    服务器A:192.168.99.24服务器B:10.255.255.24 服务器A mysql配置 服务器B my...

  • ajax

    1. 服务器 刀片服务器(电脑)不同的服务器需求是不一样的。服务器机器:服务器被攻击了,买了一台服务器。服务器挂了...

  • 2018-10-26

    1. 服务器 刀片服务器(电脑)不同的服务器需求是不一样的。服务器机器:服务器被攻击了,买了一台服务器。服务器挂了...

  • javaWeb知识总结

    一.web服务器,servlet服务器,servlet和jvm 1.1web服务器 服务器:安装了服务器软件的计算...

  • nginx负载均衡傻瓜式配置demo

    服务器:主服务器ip 172.31.242.250 、从服务器ip 172.31.242.249 主服务器ng...

网友评论

      本文标题:21ntp服务器

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