摘录一:

System:ubuntu10.04
配置文件路径:/etc/ntp.conf  
配置格式:关键字(如server)    参数(如prefer) 以换行为结束,所以一个配置不能占多行。
ntp.conf包括两类配置命令集,一类叫配置命令(configuration commands)t。另一类叫辅助命令(auxiliary commands )。  
configuration commands 解释以及使用格式:
        server address [options …]    设置服务器地址列表。 
       peer address [options …]  激活对称模式,这种模式,C/S两端可互相同步时钟,使用较少。 
       broadcast address [options …] 广播模式,必须启用key。 
       manycastclient address [options …] 主机运行在客户端模式,向多台服务器发送广播同步请求。
    Options及其意义:
 autokey:带上此参数,所有的包都被自动加密,所以如果要启用的话,C/S两端都要带,                   
         否则客户端无法同步。 
 key key:指定key,第二个key要填具体的key路径及key号。  minpoll num,maxpoll num:最小最大轮询周期或者广播周期,具体周期为2的num次方。 noselect:标注服务器无用,只用于 server和 peer。  preempt :优先获取改服务器时间,只用于 server。  prefer:以该服务器时间为准,只用于 server和 peer。
 true:强制认为此服务器时间为真,只用于 server和 peer。  ttl:网络包生存时间,用于 broadcast。  version num:自定义版本号。
 dynamic:动态服务器,表示该服务器随时可能断开也可能连上。  
auxiliary commands 解释以及使用格式:         broadcastclient [novolley]
  启用广播客户端,如果没有novolley参数, 则客户端,   会自动连接服务器以计算广播时延(broadcastdelay)。如果有novolley参数,则 broadcastdelay  num有效,如果此时没有 broadcastdelay,则默认 broadcastdelay 为4ms。启用广播模式时,必须启用key。
        manycastserver address [...]

服务器端用于接收客户端广播请求,应用此模式时,两端须启用key。与manycastclient成对使用。
        multicastclient address [...]   组播模式,须启用key。 
其他命令参数:
        driftfile driftfile
  用于记录本地时钟偏差补偿的文件。
         enable [auth | bclient | calibrate | kernel | monitor |  ntp  |  pps  |
       stats] 
       disable [auth | bclient | calibrate | kernel | monitor | ntp  |  pps  |
       stats]
  这个命令用的很少,参数多没有什么用。         includefile includefile 
  允许包含其他的配置文件。
        restrict address/default  notrap nomodify  noquery  ignore   这是关于权限设定的命令,用于服务器端,参数意义:     default:默认所有IP地址,     ignore :拒绝连接到ntp server
    nomodify :可以连接到ntp server,但是不能对ntp server进行时间上的修改     notrust  :对没有认证的客户端不提供服务     notrap  :不提供 trap 远程登录功能
    noquery :不提供对ntp server查询时间,也就是拒绝和ntp server进行时间同步   
下面是给出的配置实例:
下面的配置是我们监控后台在没有上级对时源的情况,自己配置成1级服务器,以自己的本地时间下发广播报文。这里没有用到key也能同步,但是linux man page 里说需要用key,不知道为什么。 
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help 
driftfile /var/lib/ntp/ntp.drift   
# Enable this if you want statistics to be logged.

#statsdir /var/log/ntpstats/ 
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable filegen peerstats file peerstats type day enable filegen clockstats file clockstats type day enable  
# Local users may interrogate the ntp server more closely.. #设置本地换回权限127.0.0.1 代表本地换回地址 restrict 127.0.0.1 restrict ::1  
# You do need to talk to an NTP server or two (or three). #server ntp.ubuntu.com
#设置本地主机作为服务器 127.127.1.0 代表本机 stratum 0 表示1级primary reference
server 127.127.1.0 prefer fudge 127.127.1.0 stratum 0   
# Access control configuration; see
/usr/share/doc/ntp-doc/html/accopt.html for # details.  The web page
<http://support.ntp.org/bin/view/Support/AccessRestrictions> # might also be helpful. # # Note that "restrict" applies to both servers and clients, so a configuration # that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers. 
# By default, exchange time with everybody, but don't allow configuration. restrict -4 default kod notrap nomodify nopeer noquery restrict -6 default kod notrap nomodify nopeer noquery   
# Clients from this (example!) subnet have unlimited access, but only if # cryptographically authenticated.

#restrict 192.168.123.0 mask 255.255.255.0 notrust  
# If you want to provide time to your local subnet, change the next line. # (Again, the address is an example only.) #enable bclient 
#广播配置
broadcast 192.168.255.255 version 3 minpoll 3 maxpoll 4  #broadcastdelay 0.008 broadcastclient  
#配置key
keys /etc/ntp/keys trustedkey 4 
# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network! #disable auth  
如果有上级的时钟源做为服务器时,可根据服务器提供的IP地址配置,配置方法按照上面所说的配置命令格式,比较简单,就修改下server 的内容

/etc/ntp.conf的更多相关文章

  1. 配置NTP服务ntpd/ntp.conf(搭建Hadoop集群可参考)

    本文拟定是在一个局域网内(比如一个Hadoop集群)设定一台NTP服务器作为整个网络的标准时间参考,使用网络(集群)内的所有机器保持时间一致!以下是详细的操作步骤: 1. 修改选定的服务器的本地时间 ...

  2. ntp.conf:很少有人提及的事

    [你可以到ntp.org下个ntp server的源代码,里面有HTML格式的文档,内容很全面.] [REF: http://doc.ntp.org/] Comprehensive List of C ...

  3. 对于ntp.conf的理解

    允许与我们的时间源同步时间,但是不允许源查询或修改这个系统上的服务. # Permit time synchronization with our time source, but do not # ...

  4. ntp

    一: 在一台可以连接外网的服务器A上配置ntp: 配置  /etc/ntp.conf  文件: server 202.120.2.101            # local clock (LCL) ...

  5. 时间同步ntp服务的安装与配置(作为客户端的配置

    在linux环境下,我们不仅可以自己设置时间,也可以对系统进行时间的同步,比如同步时间到某台物理机上或虚拟机,皆可!接下来我们就以同步时间到某台物理机为例, 一起学习学习. 1.配置本地yum源(挂载 ...

  6. CentOS7 NTP 安装配置

    NTP 网络时间协议用来同步网络上不同主机的系统时间.你管理的所有主机都可以和一个指定的被称为 NTP 服务器的时间服务器同步它们的时间.而另一方面,一个 NTP 服务器会将它的时间和任意公共 NTP ...

  7. 配置ntp服务

    配置ntp服务(hadoop搭建可参考) 一:修改选定的服务器的本地时间 date -s '2016-10-07 16:29:30' +'%F %T' //需要设置的时间 二:修改后将时间写入到硬件时 ...

  8. linux时间同步ntp服务的安装与配置

    1.首先安装NTP [root@localhost /]# yum install ntp -y 2.修改NTP配置文件,添加NTP服务器的网络位置    /etc/ntp.conf # For mo ...

  9. 如何搭建NTP服务

    最近,在搭建Oracle RAC过程中,需要用到DNS和NTP,其中,DNS用于域名.IP管理,NTP用于时间同步.其实,很久以前搭建过这两种服务,但技术,本质上,符合“用进废退”的客观规律.用得越频 ...

随机推荐

  1. 添加code到github上

    第一步:github上新建远程仓库 1. 在 https://github.com/  注册账号 2. new 一个新仓库 (1) 点击加号下的`New repository` (2)在Reposit ...

  2. 建议37:按需选择sort或sorted

    # -*- coding:utf-8 -*- ''' 用法: sorted(iterable[, cmp[, key[, reverse]]]) s.sort([cmp[, key[, reverse ...

  3. 试坑不完美的 clip-path (我说的 CSS 的那个)

    需求跟我说,咱们要创新,想做一个蜂巢状的列表,年少无知的我竟然一口答应了,全然因为刚接触了 clip-path: But,然而,不幸的是,这只是坎坷路途的开始.... clip-path 的教程很多了 ...

  4. P4309 [TJOI2013]最长上升子序列

    题目 P4309 [TJOI2013]最长上升子序列 做法 最长上升序列的求法肯定是烂大街了 水题是肯定的,确定出序列的位置然后套个树状数组就好了(强制在线的话改成线段树维护前缀最值也行) 所以说这题 ...

  5. UVA11297 Census

    题目 UVA11297 Census 做法 二维线段树,单点修改,矩阵查询,树套树(\(x,y\)),维护最大值最小值废话 有一点要注意的是:\(x\)树传到\(y\)树里面修改的时候,如果\(x\) ...

  6. Linux 安装扩展yum源

    Linux 安装扩展yum源 下载rpm扩展:http://rpmfind.net/linux/epel/6/x86_64/epel-release-6-8.noarch.rpm CentOS/RHE ...

  7. [转载]Struts2.1.6+Spring2.5.6+Hibernate3.3.

    原文地址:Struts2.1.6+Spring2.5.6+Hibernate3.3.1全注解实例详解(一)(转载大象)作者:沉睡森林  在JavaEE企业级开发中,以SSH2框架为核心的应用非常广,大 ...

  8. 【转载】Java类加载原理解析

    Java类加载原理解析 原文出处:http://www.blogjava.net/zhuxing/archive/2008/08/08/220841.html 1       基本信息 摘要: 每个j ...

  9. NLP-特征选择

    文本分类之特征选择 1 研究背景 对于高纬度的分类问题,我们在分类之前一般会进行特征降维,特征降维的技术一般会有特征提取和特征选择.而对于文本分类问题,我们一般使用特征选择方法. 特征提取:PCA.线 ...

  10. SPFA算法O(kE)

    SPFA算法O(kE) Dijkstra和Floyed是不断的试点.Dijkstra试最优点,Floyed试所有点. Bellman-Ford和SPFA是不断的试边.Bellman-Ford是盲目的试 ...