前一段时间,有个机器配置了ntpd服务,结果时间还是不对,结果使用的gg找来问为什么?我也不清楚,然后上去检查一下:
root@xxxx:/root#ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
*10.0.xx.xxx 127.127.1.0 11 u 126 128 377 0.293 0.030 0.007
发现,根本就没有使用时间服务器同步,而是以本地为准,之后重新找了几个时间服务器重新配置:
root@xxxx:/etc#vi ntp.conf
# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default 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.
# -- CLIENT NETWORK -------
# Permit systems on this network to synchronize with this
# time service. Do not permit those systems to modify the
# configuration of this service. Also, do not use those
# systems as peers for synchronization.
# restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
server 61.xx.xx.xx
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
# configuration of this service. Also, do not use those
# systems as peers for synchronization.
# restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
server 61.xx.xx.xx
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
restrict 61.xx.xx.xx mask 255.255.255.255
restrict 127.0.0.1
# --- NTP MULTICASTCLIENT ---
#multicastclient # listen on default 224.0.1.1
# --- GENERAL CONFIGURATION ---
#
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available. The
# default stratum is usually 3, but in this case we elect to use stratum
# 0. Since the server line does not have the prefer keyword, this driver
# is never used for synchronization, unless no other other
# synchronization source is available. In case the local host is
# controlled by some external source, such as an external oscillator or
# another protocol, the prefer keyword would cause the local host to
# disregard all other synchronization sources, unless the kernel
# modifications are in use and declare an unsynchronized condition.
#
#
# Drift file. Put this in a directory which the daemon can write to.
# No symbolic links allowed, either, since the daemon updates the file
# by creating a temporary in the same directory and then rename()'ing
# it to the file.
#
driftfile /var/lib/ntp/drift
"ntp.conf" 72L, 2649C written
root@xxxx:/etc#
完了,停止ntpd服务,否则的话端口被现有的服务占有,无法同步
root@xxxx:/etc#service ntpd stop
Shutting down ntpd: [ OK ]
手工执行ntpdate 加上要使用的时间服务器地址
root@xxxx:/etc#ntpdate 61.xx.xx.xx
9 Feb 09:38:05 ntpdate[8731]: step time server 61.xx.xx.xx offset 599.505333 sec
时间同步完成,启动ntpd 服务。
root@xxxx:/etc#service ntpd start
ntpd: Synchronizing with time server: [ OK ]
Starting ntpd: [ OK ]
root@xxxx:/etc#
查看一下时间同步的情况
root@xxxx:/root#ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
+61.xx.xx.xx xxx.xx.xx.x 2 u 241 256 77 5.215 -20.446 0.017
221.130.196.230 0.0.0.0 16 u - 128 0 0.000 0.000 4000.00
*221.xx.xx.230 192.xx.xx.xx 2 u 72 256 247 113.303 46.281 4.569
+61.xx.xx.226 64.xx.xx.54 2 u 249 256 277 5.622 -18.847 0.956
看看是否是正常了呢。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/7312700/viewspace-1017025/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/7312700/viewspace-1017025/