免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 12293 | 回复: 12
打印 上一主题 下一主题

配好了ntp服务,为何时间就是不同步 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-12-16 09:53 |只看该作者 |倒序浏览
我的server端的ntp.conf是这样的
server 192.168.8.110 prefer
broadcast 224.0.1.1 ttl 4

enable auth monitor
driftfile /var/ntp/ntp.drift
statsdir /var/ntp/ntpstats/
filegen peerstats file peerstats type day enable
filegen loopstats file loopstats type day enable
filegen clockstats file clockstats type day enable

keys /etc/inet/ntp.keys
trustedkey 0
requestkey 0
controlkey 0


client端的ntp.conf是这样的:
server 192.168.8.110


然后server运行
touch /var/ntp/ntp.drift
/etc/init.d/xntpd start

client运行
/etc/init.d/xntpd start


接着作snoop | grep -i ntp
发现server和client在发送同步消息,

server端的snoop输出如下:

# snoop | grep -i ntp
Using device /dev/bge (promiscuous mode)
192.168.30.180 ->; MFTOMCR      NTP  client (Thu Dec 16 09:50:06 2004)
     MFTOMCR ->; 192.168.30.180 NTP  server (Thu Dec 16 09:44:31 2004)
192.168.30.180 ->; 192.168.31.70 TELNET R port=1056 16 Dec 09:50:55 ntpd
192.168.30.180 ->; MFTOMCR      NTP  client (Thu Dec 16 09:51:10 2004)
     MFTOMCR ->; 192.168.30.180 NTP  server (Thu Dec 16 09:45:35 2004)


client端的snoop输出如下:
# snoop | grep -i ntp
Using device /dev/eri (promiscuous mode)
     ax1105r ->; 192.168.8.110 NTP  client (Thu Dec 16 09:50:06 2004)
192.168.8.110 ->; ax1105r      NTP  server (Thu Dec 16 09:44:31 2004)
     ax1105r ->; 192.168.31.70 TELNET R port=1056 16 Dec 09:50:55 ntpd
     ax1105r ->; 192.168.8.110 NTP  client (Thu Dec 16 09:51:10 2004)
192.168.8.110 ->; ax1105r      NTP  server (Thu Dec 16 09:45:35 2004)
     ax1105r ->; 192.168.20.130 TELNET R port=1783 16 Dec 09:51:42 ntpd

感觉好像ntp已经在运作了,可是server与client的时间始终不同步,这是怎么回事啊,我这个ntp是搜索了论坛上以前的帖子来做的,为什么不成功啊?

论坛徽章:
0
2 [报告]
发表于 2004-12-16 10:19 |只看该作者

配好了ntp服务,为何时间就是不同步

自己顶一下了

论坛徽章:
0
3 [报告]
发表于 2004-12-16 10:39 |只看该作者

配好了ntp服务,为何时间就是不同步

你把server端的配置改成
server 127.127.1.0 prefer
fudge 127.127.1.0 stratum 0
试试

论坛徽章:
0
4 [报告]
发表于 2004-12-16 10:45 |只看该作者

配好了ntp服务,为何时间就是不同步

客户端启动之前先用ntpdate手工同步一下,防止两台主机时间相差太大造成退出
#ntpdate  <DB-SERVER-IP>;

同步状态可以使用ntpq -p和ntpq -c associations查看
具体的含义在sun的网站上下载ntp相关文档看吧

论坛徽章:
0
5 [报告]
发表于 2004-12-16 10:51 |只看该作者

配好了ntp服务,为何时间就是不同步

还是不能同步,snoop都有信息的
server的如下:
# snoop | grep -i ntp
Using device /dev/bge (promiscuous mode)
192.168.30.180 ->; 192.168.30.191 TELNET R port=1655 16 Dec 10:49:02 ntpd
192.168.30.180 ->; MFTOMCR      NTP  client (Thu Dec 16 10:49:12 2004)
     MFTOMCR ->; 192.168.30.180 NTP  server (Thu Dec 16 10:43:38 2004)
192.168.30.180 ->; MFTOMCR      NTP  client (Thu Dec 16 10:49:12 2004)
     MFTOMCR ->; 192.168.30.180 NTP  server (Thu Dec 16 10:43:38 2004)
192.168.30.180 ->; MFTOMCR      NTP  client (Thu Dec 16 10:49:12 2004)
     MFTOMCR ->; 192.168.30.180 NTP  server (Thu Dec 16 10:43:38 2004)
192.168.30.180 ->; MFTOMCR      NTP  client (Thu Dec 16 10:49:12 2004)
     MFTOMCR ->; 192.168.30.180 NTP  server (Thu Dec 16 10:43:38 2004)

client的如下
# snoop | grep -i ntp
Using device /dev/eri (promiscuous mode)
     ax1105r ->; 192.168.30.191 TELNET R port=1655 16 Dec 10:49:02 ntpd
     ax1105r ->; 192.168.8.110 NTP  client (Thu Dec 16 10:49:12 2004)
192.168.8.110 ->; ax1105r      NTP  server (Thu Dec 16 10:43:38 2004)
     ax1105r ->; 192.168.8.110 NTP  client (Thu Dec 16 10:49:12 2004)
192.168.8.110 ->; ax1105r      NTP  server (Thu Dec 16 10:43:38 2004)
     ax1105r ->; 192.168.8.110 NTP  client (Thu Dec 16 10:49:12 2004)
192.168.8.110 ->; ax1105r      NTP  server (Thu Dec 16 10:43:38 2004)
     ax1105r ->; 192.168.8.110 NTP  client (Thu Dec 16 10:49:12 2004)
192.168.8.110 ->; ax1105r      NTP  server (Thu Dec 16 10:43:38 2004)

真是奇怪了,怎么有ntp消息,就是不同步啊?

论坛徽章:
0
6 [报告]
发表于 2004-12-16 10:58 |只看该作者

配好了ntp服务,为何时间就是不同步

现在同步了,觉得很奇怪,怎么一上来有snoop消息的时候没有同步,不过现在同步了,而且我看论坛上原先的一些帖子好像说是要在server的ntp.conf中设置server  的ip的啊,先谢谢饮鸩止渴了

论坛徽章:
0
7 [报告]
发表于 2004-12-16 11:04 |只看该作者

配好了ntp服务,为何时间就是不同步

原帖由 "饮鸩止渴" 发表:
客户端启动之前先用ntpdate手工同步一下,防止两台主机时间相差太大造成退出
#ntpdate  <DB-SERVER-IP>;

同步状态可以使用ntpq -p和ntpq -c associations查看
具体的含义在sun的网站上下载ntp相关文档看吧


我用ntpdate的时候发生了错误:
# ntpdate 192.168.8.110
16 Dec 10:55:15 ntpdate[18422]: the NTP socket is in use, exiting

这是什么原因那?

论坛徽章:
0
8 [报告]
发表于 2004-12-16 11:53 |只看该作者

配好了ntp服务,为何时间就是不同步

就是客户端已经起了,你看看xntp进程

论坛徽章:
0
9 [报告]
发表于 2004-12-16 12:06 |只看该作者

配好了ntp服务,为何时间就是不同步

我现在将客户端的xntpd关闭,然后运行ntpdate 192.168.8.110
# ntpdate 192.168.8.110
16 Dec 11:59:00 ntpdate[18700]: adjust time server 192.168.8.110 offset -0.00093
1 sec
好像成功的。

但再运行一次,又不对了
# ntpdate 192.168.8.110
16 Dec 12:00:42 ntpdate[18707]: no server suitable for synchronization found
感觉好像是ntp服务器没有运行,但明明是运行的,然后我关了服务器的xntpd,再运行起来,还是报告同样的错误。

论坛徽章:
0
10 [报告]
发表于 2004-12-29 23:31 |只看该作者

配好了ntp服务,为何时间就是不同步

我在client上运行ntpdate 135.252.38.220时出现如下错误:
29 Dec 23:07:48 ntpdate[12015]: bind() fails: Permission denied。
我已经启动xntpd, 但在服务器snoop时没有包。

我的ntp.conf 如下:
server 127.127.1.0 prefer
fudge 127.127.1.0 stratum 0
enable auth monitor
driftfile /var/ntp/ntp.drift
statsdir /var/ntp/ntpstats/
filegen peerstats file peerstats type day enable
filegen loopstats file loopstats type day enable
filegen clockstats file clockstats type day enable

keys /etc/inet/ntp.keys
trustedkey 0
requestkey 0
controlkey 0
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP