大家好我有一个ubuntu8服务器,我有date的问题。 我现在的date(欧洲/罗马)是9:35如果我做date打印我11:12:34我已经看到我的ntp.conf是:
server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org restrict -4 default kod notrap nomodify nopeer noquery restrict -6 default kod notrap nomodify nopeer noquery restrict 127.0.0.1 restrict ::1 restrict 192.168.1.0 mask 255.255.255.0 modify notrap
如果我停止并开始ntpdate回到我这个:
dpkg-reconfigure tzdata
我设置:
Europe Rome
并打印我
Current default timezone: 'Europe/Rome' Local time is now: Thu Mar 28 11:16:06 CET 2013. Universal Time is now: Thu Mar 28 10:16:06 UTC 2013.
如果我做date打印我
Thu Mar 28 11:16:25 CET 2013
我试过这个:
/etc/init.d/ntp stop ntpdate it.pool.ntp.org
打印我:
no server suitable for synchronization found
如果我检查这个:
netstat -antltp | grep "LISTEN" tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 3114/mysqld tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 3295/vsftpd tcp 0 0 109.233.120.149:53 0.0.0.0:* LISTEN 2935/named tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 2935/named tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2988/sshd tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 3265/master tcp 0 0 127.0.0.1:953 0.0.0.0:* LISTEN 2935/named tcp 0 0 0.0.0.0:1723 0.0.0.0:* LISTEN 2969/openvpn tcp6 0 0 :::53 :::* LISTEN 2935/named tcp6 0 0 :::22 :::* LISTEN 2988/sshd tcp6 0 0 ::1:953 :::* LISTEN 2935/named
我如何设定正确的date? 谢谢
ntpd根据当地时间和networking时间差异的大小有一些安全限制。 如果差异太大,ntpd将不会更新时间。 所以你最好把系统时间设置成正确的(在停止ntpd之后):
/etc/init.d/ntp停止
date+%T -s“hh:mm:ss”
/etc/init.d/ntp启动
这应该有希望解决这个问题
当防火墙阻止stream量时,通常会发生“找不到适合于同步的服务器”错误。 确保您的机器上的端口123对传入的udpstream量开放。
关于netstat,UDP是无状态的,所以如果你grep "LISTEN" ,你不会期望find任何东西。 你不希望find任何UDP连接与-t,但没有-u。 改用netstat -ul或netstat -uln 。 在这之前不要忘记重启你的ntpd。