因为预设的 NTP Server 本身的时间计算是依据 BIOS 的芯片震荡周期频率来计算的,但是这个数值与上层 Time Server 不见得会一致啊!所以 NTP 这个 daemon (ntpd) 会自动的去计算我们自己主机的频率与上层 Time server 的频率,并且将两个频率的误差记录下来,记录下来的档案就是在 driftfile 后面接的完整档名当中了!关于档名你必须要知道:
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help# 时间差异文件
driftfile /var/lib/ntp/ntp.drift
# 分析统计信息#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
# 上层ntp server.
pool 0.ubuntu.pool. iburst
pool 1.ubuntu.pool. iburst
pool 2.ubuntu.pool. iburst
pool 3.ubuntu.pool. iburst
# Use Ubuntu's ntp server as a fallback.
pool ntp.ubuntu.com
# 不允许来自公网上ipv4和ipv6客户端的访问
restrict -4default kod notrap nomodify nopeer noquery limited
restrict -6default kod notrap nomodify nopeer noquery limited
# 让NTP Server和其自身保持同步,如果在/etc/ntp.conf中定义的server都不可用时,将使用local时间作为ntp服务提供给ntp客户端.
restrict 127.0.0.1
restrict ::1# Needed for adding pool entries
restrict source notrap nomodify noquery
# 允许这个网段的对时请求.
restrict 192.168.123.0 mask 255.255.255.0 nomodify
# If you want to provide time to your local subnet, change the next line.# (Again, the address is an example only.)#broadcast 192.168.123.255# 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#broadcastclient#Changes recquired to use pps synchonisation as explained in documentation:#http://www./ntpfaq/NTP-s-config-adv.htm#AEN3918#server 127.127.8.1 mode 135 prefer # Meinberg GPS167 with PPS#fudge 127.127.8.1 time1 0.0042 # relative to PPS for my hardware#server 127.127.22.1 # ATOM(PPS)#fudge 127.127.22.1 flag3 1 # enable PPS API