Centos7安装搭建NTP服务器和NTP客户端同步时间
NTP简介:
环境:
系统:CentOS Linux release 7.4.1708 (Core)
NTP Server服务器IP:192.168.0.15
NTP Client客户端IP:192.168.0.16
1、搭建NTP服务器
1.1、查看服务器是否安装ntp,系统默认安装ntpdate;
[root@localhost ~]# rpm -qa |grep ntp
ntpdate-4.2.6p5-.el7.centos.x86_64
ntp-4.2.6p5-.el7.centos.x86_64
1.2、安装ntp,ntpdate已经系统默认安装过了
[root@localhost ~]# yum install -y ntp
1.3、修改ntp配置文件
[root@localhost ~]# vim /etc/ntp.conf 把配置文件下面四行注释掉:
server .centos.pool.ntp.org iburst
server .centos.pool.ntp.org iburst
server .centos.pool.ntp.org iburst
server .centos.pool.ntp.org iburst 然后在下面添加这几行:
server .cn.pool.ntp.org iburst
server .cn.pool.ntp.org iburst
server .cn.pool.ntp.org iburst
server .cn.pool.ntp.org iburst
1.4、启动ntp服务,并开机自启动
[root@localhost ~]# systemctl start ntpd
[root@localhost ~]# systemctl enable ntpd
1.5、查询ntp是否同步
[root@localhost ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*119.28.206.193 100.122.36.196 u 19.711 -0.468 5.363
1.6、开启防火墙ntp默认端口udp123
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-port=/udp
success
[root@localhost ~]# firewall-cmd --reload
success
2、NTP客户端配置
安装的NTP跟上面的步骤一样
2.1、修改ntp配置文件,将上面的NTP服务器作为客户端同步NTP时间服务器
[root@localhost ~]# vim /etc/ntp.conf
#配置允许NTP Server时间服务器主动修改本机的时间
restrict 192.168.0.15 nomodify notrap noquery
#注释掉其他时间服务器
#server .centos.pool.ntp.org iburst
#server .centos.pool.ntp.org iburst
#server .centos.pool.ntp.org iburst
#server .centos.pool.ntp.org iburst
#配置时间服务器为本地搭建的NTP Server服务器
server 192.168.0.15
2.2、与NTP server服务器同步一下时间:
[root@localhost ~]# ntpdate -u 192.168.0.15
2.3、查看ntp同步状态
能看到已经成功同步,要记得开启ntpd这个服务器
[root@localhost ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
192.168.0.15 119.28.206.193 u 0.217 - 0.000
Centos7安装搭建NTP服务器和NTP客户端同步时间的更多相关文章
- Centos7安装搭建FTP服务器(最简便方法)
简介: vsftpd 是“very secure FTP daemon”的缩写,安全性是它的一个最大的特点. vsftpd 是一个 UNIX 类操作系统上运行的服务器的名字,它可以运行在诸如 Linu ...
- Centos7安装vsftpd (FTP服务器)
Centos7安装vsftpd (FTP服务器) 原文链接:https://www.jianshu.com/p/9abad055fff6 TyiMan 关注 2016.02.06 21:19* 字数 ...
- CentOS7安装 Apache HTTP 服务器
CentOS7安装 Apache HTTP 服务器 时间:2015-05-02 00:45来源:linux.cn 作者:linux.cn 举报 点击:11457次 不管你因为什么原因使用服务器,大部分 ...
- 自动与因特网时间服务器同步 NTP 服务器 pool.ntp.org, 120.24.166.46 端口 123
自动与因特网时间服务器同步 NTP 服务器 pool.ntp.org 海康提供的NTP服务器 120.24.166.46 端口 123
- CentOS7搭建NTP服务器及客户端同步时间
一.服务器配置 1.查看服务器.客户端操作系统版本 [root@hadoop101 ~]# cat /etc/redhat-release CentOS Linux release (Core) 2. ...
- CentOS7.x搭建时间同步服务器
关于chrony Chrony是一个开源的自由软件,像CentOS7或基于RHEL 7操作系统,已经是默认服务,默认配置文件在 /etc/chrony.conf 它能保持系统时间与时间服务器(NTP) ...
- CentOS7下搭建邮件服务器(dovecot + postfix + SSL)
CentOS 花了基本上两天的时间去配置CentOS7下的邮件服务器.其中艰辛太多了,一定得总结下. 本文的目的在于通过一系列配置,在CentOS 7下搭建dovecot + postfix + ...
- 在Centos7下搭建Git服务器
① 安装 Git ② 服务器端创建 git 用户,用来管理 Git 服务,并为 git 用户设置密码 ③ 服务器端创建 Git 仓库 ④ 客户端 clone 远程仓库 ⑤ 客户端创建 SSH 公钥和私 ...
- Centos7下搭建NFS服务器与连接详解
一,环境介绍 本实验使用了两台centos7虚拟机,其中 服务器:192.168.1.188 客户端:192.168.1.189 二,实验步骤 192.168.1.1 ...
随机推荐
- JavaScript基础之值传递和引用传递
js的值传递和引用(地址)传递 首先总述一下:js的5种基本数据类型 number,string,null,undefined,boolean 在赋值传递时是值传递,js的引用数据类型(object, ...
- 死磕 java集合之TreeMap源码分析(四)-内含彩蛋
欢迎关注我的公众号"彤哥读源码",查看更多源码系列文章, 与彤哥一起畅游源码的海洋. 二叉树的遍历 我们知道二叉查找树的遍历有前序遍历.中序遍历.后序遍历. (1)前序遍历,先遍历 ...
- 根据地址查询经纬度Js
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>根据地址查询经纬度</ ...
- redis 系列7 数据结构之跳跃表
一.概述 跳跃表(skiplist)是一种有序数据结构,它通过在每个节点中维持多个指向其他节点的指针,从而达到快速访问节点的目的.在大部分情况下,跳跃表的效率可以和平衡树(关系型数据库的索引就是平衡树 ...
- [Leetcode]112. Path Sum -David_Lin
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all ...
- C#2.0 委托
委托 委托是一个非常不错的设计,允许我们把方法做为参数传递,实现了开放閉放原则.在方法中我们只要有一个委托占位,调用者就可以传入符合签名的方法来做不同的操作,这也面向对象开发中多态的魅力. 但是在C# ...
- mysql数据库备份并且实现远程复制
一.实现ssh 远程登陆 机器环境: 192.167.33.108 clent 用户:crawler 192.167.33.77 server 用户:crawler 1.客户端 生成密钥 /home/ ...
- 用StyleCop规范团队代码
前言 编码风格,每个人都是有不同的特点,风格各异,而且一个人在不同的时期,编码风格的差异也可能是非常大的,好比学生时代,刚工作的时候,工作一段时间后等. 在一个团队中,或一个项目中,如果出现了N种风格 ...
- [十六]基础类型BigInteger简介
BigInteger和BigDecimal都是Java针对大数提供的类 超出了java的表示范围 属性简介 借助于signum和mag 来实现数据的符号位和实际数据的保存 final in ...
- Perl IO:简介和常用IO模块
三篇Perl IO基础类文章: Perl的IO操作(1):文件句柄 Perl的IO操作(2):更多文件句柄的模式 Perl文件句柄相关的常见变量 IO对象和IO::Module家族模块 无论是哪种高级 ...