我怎样才能将当地时间用作`ntpd`的唯一参考?


1

我想让我的Linux设备将其本地时间与另一台Linux服务器的本地时间同步,而不需要任何其他引用。我不关心实际时间。我想要我的假时间。因此我不需要任何其他ntp服务器作为参考。例如,我只是将我的Linux服务器的本地时间设置1.2.3.42033-02-23 15:23:10。我希望这次让我的Linux设备同步。/etc/ntp.confLinux服务器上的配置文件是:

restrict 127.0.0.1 
restrict ::1

server 127.127.1.1
fudge  127.127.1.1 stratum 8

disable monitor
logfile /var/log/ntp/ntp.log
pidfile /var/run/ntpd.pid
driftfile /var/lib/ntp/drift
leapfile /etc/ntp.leapseconds

在Linux客户端上,我输入ntpdate 1.2.3.4,然后它给我错误:

 5 Feb 08:26:39 ntpdate[31059]: no server suitable for synchronization found

这是为什么?我测试了-d参数,即./ntpdate -d 1.2.3.4,它说:

 5 Feb 08:40:54 ntpdate[22958]: ntpdate 4.2.8p10@1.3728-o Mon Feb  5 10:02:23 UTC 2018 (1)
Looking for host 1.2.3.4 and service ntp
host found : 1.2.3.4
transmit(1.2.3.4)
receive(1.2.3.4)
transmit(1.2.3.4)
receive(1.2.3.4)
transmit(1.2.3.4)
receive(1.2.3.4)
transmit(1.2.3.4)
receive(1.2.3.4)
1.2.3.4: Server dropped: strata too high
server 1.2.3.4, port 123
stratum 16, precision -23, leap 11, trust 000
refid [1.2.3.4], delay 0.02573, dispersion 0.00000
transmitted 4, in filter 4
reference time:    00000000.00000000  Thu, Feb  7 2036 14:28:16.000
originate timestamp: de22269c.ab72b039  Mon, Feb  5 2018  8:41:00.669
transmit timestamp:  de22269c.ab0e1fba  Mon, Feb  5 2018  8:41:00.668
filter delay:  0.02579  0.02574  0.02573  0.02574 
         0.00000  0.00000  0.00000  0.00000 
filter offset: 0.001443 0.001416 0.001417 0.001418
         0.000000 0.000000 0.000000 0.000000
delay 0.02573, dispersion 0.00000
offset 0.001417

 5 Feb 08:41:00 ntpdate[22958]: no server suitable for synchronization found

这有什么问题?我怎么解决这个问题?


PS版本信息:

服务器:

[xxxx@xxxx:~]$ /usr/sbin/ntpd --version
ntpd 4.2.8p10@1.3728-o Mon Feb  5 10:02:23 UTC 2018 (1)

客户:

[xxxx@xxxx:~]$ ./ntpdate -v
 5 Feb 08:36:40 ntpdate[15840]: ntpdate 4.2.8p10@1.3728-o Mon Feb  5 10:02:23 UTC 2018 (1)
 5 Feb 08:36:40 ntpdate[15840]: no servers can be used, exiting

将主机本身设置为服务器应该可以工作(即localhost)
Ramhound

@Ramhound你的意思是我应该添加server 127.0.0.1配置文件?
维克多
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.