当前位置: 技术问答>linux和unix
linux 设置时间同步服务器后,时间未同步
来源: 互联网 发布时间:2017-02-18
本文导语: 时间服务器主机:10.128.6.8 时间服务器客户端:10.128.6.134 要求:每天晚上12点客户端同步服务器时间,采用ntp设置 服务器ntp.conf文件配置如下: restrict 127.0.0.1 restrict 10.128.6.134 restrict 10.128.6.0 mask 255.255.255.192 nom...
时间服务器主机:10.128.6.8 时间服务器客户端:10.128.6.134
要求:每天晚上12点客户端同步服务器时间,采用ntp设置
服务器ntp.conf文件配置如下:
restrict 127.0.0.1
restrict 10.128.6.134
restrict 10.128.6.0 mask 255.255.255.192 nomodify notrap
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
broadcastdeley 0.008
authenticate no
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
客户端ntp.conf文件配置如下:
restrict 127.0.0.1
restrict 10.128.6.0 mask 255.255.255.192 nomodify notrap
server 10.128.6.8
broadcastdeley 0.008
authenticate no
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
客户端设置contab任务,执行crontab -e ,设置内容如下:
0 * * * * /usr/sbin/ntpdate 10.128.6.8 >>/var/log/ntpdate.log
启动服务器:service ntpd start;
服务端执行,watch ntpq -p 显示如下:
Every 2.0s: ntpq -p Fri Apr 20 15:08:34 2012
remote refid st t when poll reach delay offset jitter
==============================================================================
*LOCAL(0) .LOCL. 10 l 22 64 377 0.000 0.000 0.001
客户端执行,watch ntpq -p 显示如下:
Every 2.0s: ntpq -p Fri Apr 20 15:10:09 2012
remote refid st t when poll reach delay offset jitter
==============================================================================
10.128.6.8 .INIT. 16 u - 1024 0 0.000 0.000 0.000
*LOCAL(0) .LOCL. 10 l 48 64 377 0.000 0.000 0.001
客户端执行:ntpdate -d 10.128.6.8,提示信息如下:
20 Apr 15:11:22 ntpdate[9444]: ntpdate 4.2.2p1@1.1570-o Thu May 14 13:01:42 UTC 2009 (1)
Looking for host 10.128.6.8 and service ntp
host found : 10.128.6.8
transmit(10.128.6.8)
transmit(10.128.6.8)
transmit(10.128.6.8)
transmit(10.128.6.8)
transmit(10.128.6.8)
10.128.6.8: Server dropped: no data
server 10.128.6.8, port 123
stratum 0, precision 0, leap 00, trust 000
refid [10.128.6.8], delay 0.00000, dispersion 64.00000
transmitted 4, in filter 4
reference time: 00000000.00000000 Thu, Feb 7 2036 14:28:16.000
originate timestamp: 00000000.00000000 Thu, Feb 7 2036 14:28:16.000
transmit timestamp: d33b8a9d.245fe111 Fri, Apr 20 2012 15:11:25.142
filter delay: 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000
filter offset: 0.000000 0.000000 0.000000 0.000000
0.000000 0.000000 0.000000 0.000000
delay 0.00000, dispersion 64.00000
offset 0.000000
20 Apr 15:11:26 ntpdate[9444]: no server suitable for synchronization found
查了下no server suitable for synchronization found的原因,但仍无法解决。
要求:每天晚上12点客户端同步服务器时间,采用ntp设置
服务器ntp.conf文件配置如下:
restrict 127.0.0.1
restrict 10.128.6.134
restrict 10.128.6.0 mask 255.255.255.192 nomodify notrap
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
broadcastdeley 0.008
authenticate no
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
客户端ntp.conf文件配置如下:
restrict 127.0.0.1
restrict 10.128.6.0 mask 255.255.255.192 nomodify notrap
server 10.128.6.8
broadcastdeley 0.008
authenticate no
driftfile /var/lib/ntp/drift
keys /etc/ntp/keys
客户端设置contab任务,执行crontab -e ,设置内容如下:
0 * * * * /usr/sbin/ntpdate 10.128.6.8 >>/var/log/ntpdate.log
启动服务器:service ntpd start;
服务端执行,watch ntpq -p 显示如下:
Every 2.0s: ntpq -p Fri Apr 20 15:08:34 2012
remote refid st t when poll reach delay offset jitter
==============================================================================
*LOCAL(0) .LOCL. 10 l 22 64 377 0.000 0.000 0.001
客户端执行,watch ntpq -p 显示如下:
Every 2.0s: ntpq -p Fri Apr 20 15:10:09 2012
remote refid st t when poll reach delay offset jitter
==============================================================================
10.128.6.8 .INIT. 16 u - 1024 0 0.000 0.000 0.000
*LOCAL(0) .LOCL. 10 l 48 64 377 0.000 0.000 0.001
客户端执行:ntpdate -d 10.128.6.8,提示信息如下:
20 Apr 15:11:22 ntpdate[9444]: ntpdate 4.2.2p1@1.1570-o Thu May 14 13:01:42 UTC 2009 (1)
Looking for host 10.128.6.8 and service ntp
host found : 10.128.6.8
transmit(10.128.6.8)
transmit(10.128.6.8)
transmit(10.128.6.8)
transmit(10.128.6.8)
transmit(10.128.6.8)
10.128.6.8: Server dropped: no data
server 10.128.6.8, port 123
stratum 0, precision 0, leap 00, trust 000
refid [10.128.6.8], delay 0.00000, dispersion 64.00000
transmitted 4, in filter 4
reference time: 00000000.00000000 Thu, Feb 7 2036 14:28:16.000
originate timestamp: 00000000.00000000 Thu, Feb 7 2036 14:28:16.000
transmit timestamp: d33b8a9d.245fe111 Fri, Apr 20 2012 15:11:25.142
filter delay: 0.00000 0.00000 0.00000 0.00000
0.00000 0.00000 0.00000 0.00000
filter offset: 0.000000 0.000000 0.000000 0.000000
0.000000 0.000000 0.000000 0.000000
delay 0.00000, dispersion 64.00000
offset 0.000000
20 Apr 15:11:26 ntpdate[9444]: no server suitable for synchronization found
查了下no server suitable for synchronization found的原因,但仍无法解决。
|
ntp使用udp协议,123端口是否开放?