Skip to content

Instantly share code, notes, and snippets.

@koy1619
Last active October 27, 2015 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save koy1619/9929578 to your computer and use it in GitHub Desktop.
Save koy1619/9929578 to your computer and use it in GitHub Desktop.
ntp.conf
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
# 允许本地所有操作
restrict 127.0.0.1
restrict -6 ::1
# 允许的局域网络段或单独ip
#restrict 127.0.0.1   
#restrict 192.168.10.2  # 指定某台机器时间同步
#restrict 192.168.0.0 mask 255.255.255.0 #允许192.168.0.0/254子网内主机时间同步
#restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap #允许任何主机跟进行时间同步
restrict 192.168.1.0 mask 255.255.255.0 nomodify motrap
# 使用上层的internet ntp服务器
#restrict cn.pool.ntp.org
restrict ntp.sjtu.edu.cn
#restrict 1.cn.poo.ntp.org
restrict s1a.time.edu.cn
restrict 0.asia.pool.ntp.org
restrict 3.asia.pool.ntp.org
#server cn.pool.ntp.org prefer
server ntp.sjtu.edu.cn prefer
#server 1.cn.poo.ntp.org
server s1a.time.edu.cn
server 0.asia.pool.ntp.org
server 3.asia.pool.ntp.org
# 如果无法与上层ntp server通信以本地时间为标准时间
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
# 计算本ntp server 与上层ntpserver的频率误差
driftfile /var/lib/ntp/drift
# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography.
keys /etc/ntp/keys
#设置ntp日志的path
statsdir /var/log/ntp/
#日志文件
logfile /var/log/ntp/ntp.log
# 全球 NTP SERVER http://www.pool.ntp.org/zh/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment