Akiraka Akiraka
  • Home
  • Linux
    • ELK
    • PHP
    • Shell
    • Nginx
    • Docker
      • Docker Compose
    • Centos
    • Ubuntu
    • Jenkins
  • Python
  • Mac OS
  • Windows
  • Big Data
    • Hadoop
    • CDH
    • Hive
    • Spark
    • ZooKeeper
  • K8S
    • Kubernetes
    • Helm
  • Other
  • Quark
  • Contribute
  • Home
  • Linux
    • ELK
    • PHP
    • Shell
    • Nginx
    • Docker
      • Docker Compose
    • Centos
    • Ubuntu
    • Jenkins
  • Python
  • Mac OS
  • Windows
  • Big Data
    • Hadoop
    • CDH
    • Hive
    • Spark
    • ZooKeeper
  • K8S
    • Kubernetes
    • Helm
  • Other
  • Quark
  • Contribute
首页 Linux Centos 搭建 NTP 服务器与客户端同步

搭建 NTP 服务器与客户端同步

Akiraka 2年前

文章目录

  • 操作场景
  • 测试主机
  • 一、公共 NTP 网络时间服务器
    • 1.1、阿里云
    • 1.2、腾讯云
  • 二、部署 NTP 服务
    • 2.1、安装 NTP 服务
    • 2.2、配置服务端
    • 2.3、部署客户端
    • 2.4、启动 NTP 服务

操作场景

ntpd(Network Time Protocol daemon)是 Linux 操作系统的一个守护进程,用于校正本地系统与时钟源服务器之前的时间,完整的实现了 NTP 协议。ntpd 与 ntpdate 的区别是 ntpd 是步进式的逐渐校正时间,不会出现时间跳变,而 ntpdate 是断点更新。

测试主机

主机名 IP地址 描述
server-01 192.168.8.2 ntp 服务端
server-01 192.168.8.3 ntp 客户端

一、公共 NTP 网络时间服务器

1.1、阿里云

  • 阿里云: https://help.aliyun.com/document_detail/92704.html
server ntp1.aliyun.com
server ntp2.aliyun.com
server ntp3.aliyun.com
server ntp4.aliyun.com
server ntp5.aliyun.com
server ntp6.aliyun.com
server ntp7.aliyun.com

1.2、腾讯云

  • 腾讯云: https://cloud.tencent.com/document/product/213/30392
server time1.cloud.tencent.com
server time2.cloud.tencent.com
server time3.cloud.tencent.com
server time4.cloud.tencent.com
server time5.cloud.tencent.com

二、部署 NTP 服务

2.1、安装 NTP 服务

  • 服务端和客户端机器都需要安装
#   1、安装 ntp 服务
yum install ntp -y
2、设置 ntp 开机启动
systemctl enable ntpd.service

2.2、配置服务端

  • 需要修改 2 个地方
#   1、编辑配置文件
vim /etc/ntp.conf
#   2、修改 restrict 这里修改成网段
restrict 192.168.8.0 mask 255.255.255.0
#   3、修改 server 默认的全部删除 替换成以下内容
server ntp1.aliyun.com
server ntp2.aliyun.com
server ntp3.aliyun.com
server ntp4.aliyun.com
server ntp5.aliyun.com
server ntp6.aliyun.com
server ntp7.aliyun.com

2.3、部署客户端

#   1、编辑配置文件
vim /etc/ntp.conf
#   2、找到 server xxxx 全部删除,修改成 ntp 服务端地址
server 192.168.8.2

2.4、启动 NTP 服务

#   1、服务端和客户端都需要执行
systemctl restart ntpd
#   2、检查 ntpd 状态
netstat -nupl
#   3、查看 ntpd 状态是否正常
service ntpd status
1
猜你喜欢
  • Linux Centos/Ubuntu/Debain配置账户登录失败锁定策略
  • Centos 7 MySQL 5.7 编译安装
  • Cenos 6.x yum 源过期替换问题 尝试其他镜像
  • Crontab 修改默认编辑器
  • Centos/Ubuntu Linux 系统 根目录扩容方法
Akiraka
站长
本人擅长 Ai、Au、Fl、Ae、Pr、Ps 等软件的安装与卸载,精通 CSS、JavaScript、PHP、Python、Shell、Go 等单词的拼写,熟悉 Windows、Linux、Mac、Android、IOS 等系统的开关机!
160
文章
24
评论
73
获赞
Popular Articles
TOP1
Kubernetes(k8s)Helm 部署 EFK 集群
2年前
TOP2
Kubernetes(k8s)helm 搭建 prometheus + Grafana 监控
2年前
TOP3
Container 命令ctr、crictl 命令使用说明
11月前
TOP4
Kubernetes(k8s)Helm 部署 Jenkins 持续化集成部署
2年前
TOP5
Helm 部署 Loki 日志聚合
2年前
Related Articles
Docker 使用官方镜像构建 nginx 容器
2年前
Ingress Nginx 添加 Basic Auth 安全认证
11月前
密码保护:Kubernetes中容器Nginx动态解析
1年前
sqlite3数据库
2年前
Container 命令ctr、crictl 命令使用说明
11月前
Copyright © 2019-2022 Akiraka. 沪18036911号