CentOS7设置内网时间同步
1、yum 安装 NTP服务器
[root@master ~]# yum -y install ntp
2、启动ntpd服务
[root@master ~]# systemctl start ntpd
3、设置开机自启
[root@master ~]# systemctl enable ntpd
4、设置server端
[root@master ~]# vi /etc/ntp.conf
# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).
#记录system clock的误差值开机时不会丢失
driftfile /var/lib/ntp/drift # Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
#默认拒绝所有来源的任何访问
restrict default nomodify notrap nopeer noquery # Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
#允许本机地址一切操作
restrict 127.0.0.1
restrict ::1 # Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
#restrict 对ntp做权限控制 ignore:忽略所有类型的NTP连接请求 nomodify:限制客户端不能使用命令ntpc和ntpq来修改服务器端的时间
#noquery:不提供NTP网络校时服务 notrap:不接受远程登录请求 notrust:不接受没有经过认证的客户端的请求
#允许局域网66网段内所有client连接到这台服务器同步时间.但是拒绝让他们修改服务器上的时间和远程登录
restrict 192.168.66.0 mask 255.255.255.0 nomodify notrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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 127.127.1.0
#时间服务器层级0-15 0表示顶级 10通常用于给局域网主机提供时间服务
fudge 127.127.1.0 stratum 10 #broadcast 192.168.1.255 autokey # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 autokey # multicast server
#multicastclient 224.0.1.1 # multicast client
#manycastserver 239.255.254.254 # manycast server
#manycastclient 239.255.254.254 autokey # manycast client # Enable public key cryptography.
#crypto includefile /etc/ntp/crypto/pw # Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys # Specify the key identifiers which are trusted.
#trustedkey 4 8 42 # Specify the key identifier to use with the ntpdc utility.
#requestkey 8 # Specify the key identifier to use with the ntpq utility.
#controlkey 8 # Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats # Disable the monitoring facility to prevent amplification attacks using ntpdc
# monlist command when default restrict does not include the noquery flag. See
# CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor
5、重启server端
[root@master ~]# systemctl restart ntpd
6、查看状态
[root@master ~]# ntpstat
synchronised to local net (127.127.1.0) at stratum 11
time correct to within 7948 ms
polling server every 64 s
[root@master ~]#
7、设置client端
[root@node1 ~]# vi /etc/ntp.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#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
#client端仅仅加入server端IP
server master
7、重启client端
[root@node1 ~]# systemctl restart ntpd
8、检查网络中的NTP服务器
[root@node1 ~]# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*master LOCAL(0) 11 u 43 64 37 0.223 -134.33 92.058
[root@node1 ~]#
*表示目前使用的NTP Server,这里选择的本机;
st:即stratum阶层,值越小表示ntp serve的精准度越高;
when:单位秒,几秒前曾做过时间同步更新的操作;
poll表示,每隔多少毫秒与ntp server同步一次;
reach:已经向上层NTP服务器要求更新的次数;
delay:网络传输过程钟延迟的时间;
offset:时间补偿的结果;
jitter:Linux系统时间与BIOS硬件时间的差异时间
9、问题
NTP Server端重启后,Client端需要等5分钟再与其进行时间同步,否则会提示“no server suitable for synchronization found”错误。等待的时间可以通过命令 watch ntpq -p来监控
CentOS7设置内网时间同步的更多相关文章
- #centos7 创建内网yum源 OpenStack源部署
#centos7 创建内网yum源#centos7 自动化安装 本地 内网 web源创建.更新 createrepo http OpenStack源部署 Elven原创 http://www.cnbl ...
- 网吧局域网里的设置外网IP地址、设置内网IP地址、限制内网速度和路由器共享
现在啊,网吧的需求越来越高,同时在经济比较充裕的情况下,作为网吧的老板可能希望打造全千兆的网吧,让每个进入网吧的人都能充分体验高速的感觉,当然更重要的是在同行竞争中处于上游,特别是对网络游戏爱好者的吸 ...
- Windows 设置内网和外网同时使用
想要电脑同时使用内网和外网必须具备两个网卡,一个是无线网卡一个是本地连接,无线网卡用来连接wifi也就是外网,而本地连接需要网线连接内网,外网是不需要做设置的,我们只需要设置内网即可,鼠标右击电脑右下 ...
- Centos7.2内网环境安装MySQL5.7.24
1.配置本地yum源 内网环境,首先需要配置本地yum源,以解决MySQL的依赖安装,具体参考该文:点击打开 2.查看服务器环境 uname -a 3.去官网下载MySQL安装包 MySQL官网网址: ...
- linux 内网时间同步配置
在工作中,内网环境机器的时间会有所差异,在某些测试环境下需要一毫秒都不允许出现误差,但又不想同步外网时间,那我们可以选择一台机器作为时间服务器来供其他机器进行时间同步,例如每隔1分钟同步一次时间. 一 ...
- CentOS7 设置集群时间同步
1. 安装ntp时间同步工具 yum -y install ntp ntpdate #安装ntpdate时间同步工具 ntpdate cn.pool.ntp.org #设置时间同步 hwclock - ...
- TP-LINK路由器设置内网的一台电脑在外网可以远程操控
1.[IP和MAC绑定]--[静态ARP绑定设置]对MAC和IP进行绑定 2.[转发规则]--[DMZ主机],选择启用并把刚才设置的内网IP填入 3.直接访问路由器的外网IP就可以直接访问绑定的MAC ...
- win10 双网卡设置内网和外网同时访问
当前环境是内网使用固定ip 用有线连接 外网自动获取使用wifi模块连接wifi cmd窗口下运行route print -4 打印路由信息 首先删除 所有0.0.0.0的路由,也就是默认设置 rou ...
- Centos7搭建内网DNS服务器
一.配置阿里云yum源 执行脚本配置阿里云的yum源,已配置yum源的可以忽略 #!/bin/bash # ******************************************** ...
随机推荐
- CSAPP bomb分析
CSAPP bomb分析 问题介绍 这是一个关于反汇编方面的问题,根据已有的二进制代码来推测程序中的特定条件,主要参考了以下各个博客: CSDN 1 CSDN 2 CSDN 3 CSDN 4 stac ...
- Labview学习之路(一)程序框图中的修饰
很多小伙伴知道在前面板有很多修饰符,比如上凸框,加粗下凹框等等,但是其实在程序框图中也是有修饰符的,他的位置比较隐蔽,并且修饰符很少,所以很多人基本没有用过.现在就给大家介绍一些这些程序框图种的修饰. ...
- 透过UIRoot深入理解NGUI提供的屏幕适配方案
主要代码:UIRoot,UIOrthoCamera,UIRect.GetSides(UIPanel使用UIRect的)里的GetSides,代码量很少,但需要思考和测试验证. 一.UIRoot的基本内 ...
- 使用Unity的50个建议
关于这些建议 这些建议并不适用于所有的项目 这些建议是基于我与3-20人的小团队项目经验总结出来的 结构.可重复使用性.明晰度都是有价的——团队规模和项目规模决定了是否值得付这个价. 一些建议也许公然 ...
- Docker+Kubernetes/K8s+Jenkins视频资料【干货分享】
不管你是否意识到,在这几年时间里,技术岗招聘重点关注的是Docker.Kubernetes(以下简称: K8S),面试10家公司得有8家会问你会不会"docker"."k ...
- web测试——弱网测试、暂停页面执行
1.弱网测试: 2.暂停页面执行 1.js代码:可以直接在页面上打断点 缺点:需要看懂前端的代码 2.点击暂停按钮,如下图,再次点击,可继续运行
- Ubuntu修改默认Python版本,你了解多少~
目录 1 查看Python版本 1.1 查看装有哪些版本 1.2 查看默认版本 2 修改Python默认版本 2.1 基于文件修改 2.2 基于软链接修改 1 查看Python版本 1.1 查看装有哪 ...
- Fliptile(POJ 3279)
原题如下: Fliptile Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 16494 Accepted: 6025 D ...
- 数字,字符串,逻辑比较在IF语句中的判断应用
Shell 语言中的if条件 一.if的基本语法: if [ command ];then 符合该条件执行的语句 elif [ command ];then 符合该条件执行的语句 else 符合该条 ...
- [剑指Offer]30-包含min函数的栈
题目 定义栈的数据结构,请在该类型中实现一个能够得到栈中所含最小元素的min函数(时间复杂度应为O(1)). 题解 辅助栈记录当前最小值. 代码 import java.util.Stack; pub ...