ntp.conf详解
linux系统的ntp.conf文件默认保存在/etc/ntp.conf
版本:
[root@dsview ntpstats]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@dsview ntpstats]# uname -a
Linux dsview 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@dsview ntpstats]# ntpd --version
ntpd 4.2.6p5
ntpd 4.2.6p5@1.2349-o Sat Nov 23 18:21:48 UTC 2013 (1)
[root@dsview ntpstats]#
来个例子:直接从服务器上拽出来的
# 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).
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 kod nomodify notrap nopeer noquery
restrict -6 default kod 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 -6 ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.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
server 192.168.6.200 iburst
server 192.168.6.201 iburst
server 192.168.6.202 iburst
#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
logfile /var/log/ntp.log
#pidfile /var/run/ntpd.pid
详细解析:
#将自己主机的bios芯片震荡频率与上层的Time server频率比较,将误差记录在这个文件里,一般保持默认
driftfile /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 192.168.1.0 mask 255.255.255.0 nomodify notrap
参考时钟源设置
# 时钟源配置格式:
# [server] address [prefer] [mode int] [minpoll int] [maxpoll int]
# 注释掉默认配置
#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
# 这里需要修改为时间服务器地址,可以添加多个
server 192.168.6.200 iburst
server 192.168.6.201 iburst
server 192.168.6.202 iburst
时钟源格式详解,前缀一般默认是server
,也可以是其他
server address | 选取的参考时钟源 |
peer address | 与本机一起作为共同时钟源对外服务,在服务器启动时初始化,两台服务器会自行协议主备关系 |
broadcast address | 作为时钟源向指定广播域发送时钟信息 |
manycastclient address | 接受广播的NTP信息客户端配置 |
时钟源配置选项
burst | 时钟源可访问时发送8个包,默认发送间隔2秒,只用于server |
iburst | 时钟源不可访问时发送8个包,默认发送间隔2秒,只用于server |
minpool/maxpool | 最小/最大轮训间隔,间隔为2的minpool/maxpool次方,取值4-17。只用于peer和server |
noselect | 指定时钟源不再有效,只用于peer和server |
perfer | 首选时钟源,只用于peer和server |
ttl | ....(一般用不上) |
可添加其他配置
# Enable writing of statistics records.
# 记录状态,保存在/var/log/ntpstatus下
statistics clockstats cryptostats loopstats peerstats
# 日志文件保存路径,可按需求添加
logfile /var/log/ntp.log
# 进程ID号保存的文件,可按需求添加
#pidfile /var/run/ntpd.pid
后面有新了解再补充
ntp.conf详解的更多相关文章
- Redis:默认配置文件redis.conf详解
转: Redis:默认配置文件redis.conf详解 # Redis配置文件样例 # Note on units: when memory size is needed, it is possibl ...
- Redis配置文件redis.conf详解
一.Redis配置文件redis.conf详解 # Note on units: when memory size is needed, it is possible to specifiy # it ...
- linux离线部署redis及redis.conf详解
一.离线部署redis 由于博主部署的虚拟机没有网络也没有gcc编译器,所以就寻找具备gcc编译器的编译环境把redis编译安装好,Copy Redis安装目录文件夹到目标虚拟机的目录下.copy时r ...
- yum的配置文件yum.conf详解
说明:经过网上抄袭和自己的总结加实验,非常详细,可留作参考. yum的配置一般有两种方式: 一种是直接配置/etc目录下的yum.conf文件, 另外一种是在/etc/yum.repos.d目录下 ...
- /etc/security/limits.conf 详解与配置
目录 一. /etc/security/limits.conf 详解 /etc/security/limits.conf 配置解析 /etc/security/limits.d/ 目录 二. ulim ...
- rsync.conf详解
1.在服务端编辑配置文件 [root@game_intf ~]# more /etc/rsyncd.conf port=8730 log file=/var/log/rsync.log pid fil ...
- 004-mac上安装以及Nginx 配置文件nginx.conf详解
1.mac上nginx安装 安装brew:go-001-环境部署,IDEA插件 安装nginx: brew search nginx brew install nginx 当然也可以编译安装 安装完以 ...
- httpd.conf详解,因为php始终报fileinfo扩展无法加载的错
# # This is the main Apache HTTP server configuration file. It contains the # configuration directiv ...
- Nginx 配置文件 nginx.conf 详解
Nginx的配置文件nginx.conf配置详解如下: user nginx nginx; #Nginx用户及组:用户 组.window下不指定 worker_processes 8; #工作进程:数 ...
- Nginx安装及配置文件nginx.conf详解
1.安装Nginx 在安装Nginx之前,需确保系统已经安装了gcc. openssl-devel. pcre-devel和zlib-devel软件库. 下面是Nginx安装过程: wget http ...
随机推荐
- 【Boost】Windows端使用 MSVC14.2 编译 Boost 并在 CMake 项目中使用
Write 2023.7.24 关于 boost 在 Windows 下的使用 gcc 安装与 CLion 的配置, 能够查到的英文资料都比较少, 踩过坑后记录一下. MinGW 安装 Boost B ...
- 华东交通大学2019年ACM 双基 程序设计竞赛 个人题解(A - K)
目前先放几道题面,等晚上做完实验补 Update:A ~ D,更新剩余的题面(题面复制会有链接水印,懒得一一去除.直接截图) A.签到 真·签到题 输出祝贺祖国成立70周年!即可 B.欧涛的烦恼 思路 ...
- vivo 互联网业务就近路由技术实战
一.问题背景 在vivo互联网业务高速发展的同时,支撑的服务实例规模也越来越大,然而单个机房能承载的机器容量是有限的,于是同城多机房甚至多地域部署就成为了业务在实际部署过程中不得不面临的场景. 一般情 ...
- 详解KubeEdge EdgeMesh v1.15 边缘CNI特性
本文分享自华为云社区<KubeEdge EdgeMesh v1.15 边缘CNI特性原理及功能详解>,作者:达益鑫 |南开大学,刘家伟.吴锟 |DaoCloud,王杰章 |华为云 特性研发 ...
- vue 状态管理 三、Mutations和Getters用法
系列导航 vue 状态管理 一.状态管理概念和基本结构 vue 状态管理 二.状态管理的基本使用 vue 状态管理 三.Mutations和Getters用法 vue 状态管理 四.Action用法 ...
- echarts折线图美化(颜色渐变、背景透明、隐藏坐标轴)
echarts折线图美化(颜色渐变.背景透明.隐藏坐标轴) https://blog.csdn.net/Changeable0127/article/details/81333559?utm_medi ...
- C#绘制柱形图
柱形图数据 通过 panel 绘制柱形图 private void ShowPic() { Conn(); //打开数据库连接 using (cmd = new SqlCommand("SE ...
- STM32CubeMX教程19 I2C - MPU6050驱动
1.准备材料 正点原子stm32f407探索者开发板V2.4 STM32CubeMX软件(Version 6.10.0) 野火DAP仿真器 keil µVision5 IDE(MDK-Arm) ST- ...
- UEditor 添加在线管理图片删除功能 (转载)
第一,需要添加一个 php 文件来实现删除功能,文件添加到: ueditor\php\action_delete.php 代码内容: <?php /*---------------------- ...
- 【中介者模式(Mediator)】使用Java实现中介者模式
引言 中介者,何为中介者,顾名思义就是我们的在处理A和B之间的关系的时候,引入一个中间人,来处理这两者之间的关系,例如生活中我们需要去租房,买房,都会有中介,来处理房东和租客之间的协调关系,这个就是中 ...