2013年1月4日金曜日

NTP服务器在CentOS建设

我建立了一个NTP服务器,在CentOS。

/ etc / ntp.conf中描述的配置信息。

NTP查询,是一个本地网络,从网络192.168.100.0/24是允许的。

在本地网络上的设备可以与NTP时间服务器同步。

NTP服务器本身的服务器和时间同步。

ntp.nict.jp
1.centos.pool.ntp.org
2.centos.pool.ntp.org


我们允许 192.168.100.0 ntp查询,从下面的描述中。

restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap



[root@ntp01 ~]# more /etc/ntp.conf


# 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
restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap

# 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 ntp.nict.jp
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org

#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

# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
#server 127.127.1.0 # local clock
#fudge 127.127.1.0 stratum 10

# 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
[root@ntp01 ~]#
[root@ntp01 ~]#




我有足够的时间同步,我们可以检查ntpq-p命令。


[root@ntp01 ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*ntp-a3.nict.go. .NICT.           1 u  532 1024  377   20.644   -2.750   1.318
+103.6.16.254    10.84.87.146     2 u  530 1024  377   16.677   -0.464  14.068










このエントリーをはてなブックマークに追加