Ubuntu 12.04 サーバー再構築(15) NTPとして動作させる


独立行政法人 情報通信研究機構が提供しているサービスを利用させていただくことにする。時空標準研究室にサーバーに関する説明がある。



Firewallの設定で、 123/udpを開けておく。


$ sudo apt-get install ntp



# /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

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
#server 0.ubuntu.pool.ntp.org
#server 1.ubuntu.pool.ntp.org
#server 2.ubuntu.pool.ntp.org
#server 3.ubuntu.pool.ntp.org
server ntp.nict.jp

# Use Ubuntu's ntp server as a fallback.
#server ntp.ubuntu.com

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page 
# 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

# Local users may interrogate the ntp server more closely.
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict mask notrust
restrict mask

# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)

# 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


$ sudo service ntp restart



$ ntpq -p
$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
 ntp-a3.nict.go. .NICT.           1 u    6   64    3   10.971   -2.172   0.148


$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
*ntp-b2.nict.go. .NICT.           1 u   15   64  177   12.423  -47.426  16.321



$ sudo ntpdate hogeserver.hogeddns.jp
16 Jun 07:44:29 ntpdate[4354]: adjust time server 172.16.nnn.nnn offset 0.146837 sec


$ sudo ntpdate hogeserver.hogeddns.jp
16 Jun 07:38:21 ntpdate[4341]: no server suitable for synchronization found



コメントはこちらから お気軽にどうぞ ~ 投稿に関するご意見・感想・他