How can I use my local time as the only reference of `ntpd`?

1

I want to let my Linux device synchronize its local time with the local time of another Linux server without any other references. I don't care about the actual time. I want my fake time. Therefore I don't need any other ntp servers for reference. For example I just set the local time of my Linux server 1.2.3.4 to 2033-02-23 15:23:10. I want to let my Linux device synchronize this time. The config file /etc/ntp.conf on the Linux server is:

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

On the Linux client, I type ntpdate 1.2.3.4, and then it gives me error:

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

Why is that? I have tested the -d parameter, i.e. ./ntpdate -d 1.2.3.4, and it says:

 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

What is wrong with it? How can I solve this problem?


P.S. version information:

server:

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

client:

[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

Victor

Posted 2018-02-05T02:27:42.547

Reputation: 111

Setting the host itself as a server should work (i.e. localhost) – Ramhound – 2018-02-05T02:52:13.690

@Ramhound Do you mean I should add server 127.0.0.1 in the config file? – Victor – 2018-02-05T03:17:32.133

No answers