NTP时间同步

NTP时间同步

目录

  • NTP时间同步
    • [一、 概述](#一、 概述)
    • [二、 软件包](#二、 软件包)
    • 三、NTP服务器配置
      • [1、 修改配置文件](#1、 修改配置文件)
      • [2、 重启服务](#2、 重启服务)
      • [3、 防火墙设置](#3、 防火墙设置)
    • 四、NTP客户端配置
      • [1、 修改配置文件](#1、 修改配置文件)
      • [2、 验证时间](#2、 验证时间)
      • [4、 重启服务](#4、 重启服务)
      • [5、 验证时间是否同步](#5、 验证时间是否同步)

一、 概述

​ Network Time Protocol(网络时间协议)

它用来同步网络中各个计算机的时间的协议。210.72.145.39,国家授权中心服务器IP地址

Stratum(分层设计),Stratum层的总数限制在15以内(包括15)

服务端端口:323 客户端端口:123

二、 软件包

bash 复制代码
]# yum -y install chrony
]# rpm -ql chrony
]# rpm -qc chrony
/etc/chrony.conf
/etc/chrony.keys
/etc/logrotate.d/chrony
/etc/sysconfig/chronyd

三、NTP服务器配置

1、 修改配置文件

bash 复制代码
]# cat /etc/chrony.conf
server 0.centos.pool.ntp.org iburst
allow 192.168.0.0/16
deny  192.168.4.1
local stratum 10

2、 重启服务

bash 复制代码
]# systemctl restart chronyd
]# systemctl enabled chronyd

3、 防火墙设置

bash 复制代码
可提前干掉防火墙,并修改配置文件将enabled改为disabled
]# systemctl disable firewalld --now

如不想干掉
]# firewall-cmd --set-default-zone=trusted

四、NTP客户端配置

1、 修改配置文件

bash 复制代码
主配置文件/etc/chrony.conf
]# cat /etc/chrony.conf
3 server 192.168.3.30 iburst       //设置与指定IP地址服务器同步数据
                                   //iburst参数设置重启服务后尽快同步时间

2、 验证时间

bash 复制代码
客户端将时间修改错误
]# date -s  "hour:minute"           //调整时间
]# date                             //查看时间

4、 重启服务

bash 复制代码
]# systemctl restart chronyd

5、 验证时间是否同步

bash 复制代码
]# date
]# chronyc sources -V
相关推荐
A小辣椒1 天前
TShark:Wireshark CLI 功能
linux
A小辣椒1 天前
TShark:基础知识
linux
AlfredZhao1 天前
OCI 明明分配了 200G 系统盘,为什么 df 只看到 30G?
linux·oci
AlfredZhao2 天前
vi 删除指定范围的行,不用再反复按 dd
linux·vi
用户9718356334662 天前
银河麒麟 KY10 申威(SW64) 安装 nginx-1.16.1-2.p01.ky10.sw_64.rpm 详细步骤
linux
猪脚踏浪2 天前
linux 拷贝文件或目录到指定的位置
linux
摇滚侠3 天前
Linux CentOS7 rpm 安装 MySQL 5.7
linux·运维·mysql
bush43 天前
嵌入式linux学习记录十四、术语
linux·嵌入式
载数而行5203 天前
Linux 11 动态监控指令top
linux
不会C语言的男孩3 天前
Linux 系统编程 · 第 8 章:进程基础
linux·c语言