Goal
To synchronize the clock of machine A (Ubuntu 18.04) with the clock of machine B (Ubuntu 16.04 on local network running an NTP server - time is approx. 10 minutes ahead of real-world time).
My research
I am new to NTP and slightly confused about the available packages and commands: ntpd, ntpq, timesyncd, timedatectl etc. Apparently some of these interact and others conflict. Any help clearing that up would be appreciated.
What I have tried
On machine A:
$ sudo apt-get install ntp
ntp.conf:
server 192.168.12.20 # NTP server (machine B)
server 127.127.1.0
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list
Then running:
$ sudo service ntp stop
$ sudo ntpd -gq
11 Mar 14:35:50 ntpd[11344]: ntpd 4.2.8p10@1.3728-o (1): Starting
11 Mar 14:35:50 ntpd[11344]: Command line: ntpd -gq
11 Mar 14:35:50 ntpd[11344]: proto: precision = 0.128 usec (-23)
11 Mar 14:35:50 ntpd[11344]: leapsecond file ('/usr/share/zoneinfo/leap-seconds.list'): good hash signature
11 Mar 14:35:50 ntpd[11344]: leapsecond file ('/usr/share/zoneinfo/leap-seconds.list'): loaded, expire=2019-12-28T00:00:00Z last=2017-01-01T00:00:00Z ofs=37
11 Mar 14:35:50 ntpd[11344]: leapsecond file ('/usr/share/zoneinfo/leap-seconds.list'): expired less than 75 days ago
11 Mar 14:35:50 ntpd[11344]: Listen and drop on 0 v6wildcard [::]:123
11 Mar 14:35:50 ntpd[11344]: Listen and drop on 1 v4wildcard 0.0.0.0:123
11 Mar 14:35:50 ntpd[11344]: Listen normally on 2 lo 127.0.0.1:123
11 Mar 14:35:50 ntpd[11344]: Listen normally on 3 eth0 192.168.12.193:123
11 Mar 14:35:50 ntpd[11344]: Listen normally on 4 wlan0 10.1.11.171:123
11 Mar 14:35:50 ntpd[11344]: Listen normally on 5 lo [::1]:123
11 Mar 14:35:50 ntpd[11344]: Listen normally on 6 eth0 [fd06:b21a:9c69::242]:123
11 Mar 14:35:50 ntpd[11344]: Listen normally on 7 eth0 [fd06:b21a:9c69:0:3411:70bb:5786:e9f9]:123
11 Mar 14:35:50 ntpd[11344]: Listen normally on 8 eth0 [fd06:b21a:9c69:0:f474:e414:7210:dc9e]:123
11 Mar 14:35:50 ntpd[11344]: Listen normally on 9 eth0 [fe80::37ed:4c5:7941:3e6%3]:123
11 Mar 14:35:50 ntpd[11344]: Listen normally on 10 wlan0 [fe80::2e44:748b:5ae0:f2dd%7]:123
11 Mar 14:35:50 ntpd[11344]: Listening on routing socket on fd #27 for interface updates
11 Mar 14:46:14 ntpd[11344]: ntpd: time set +617.018832 s
ntpd: time set +617.018832s
At this point, the date is correctly set to the date of machine A:
$ date
Wed Mar 11 14:46:33 CET 2020
However, after starting the service again...
$ sudo service ntp start
A few seconds later, the clock is reverted back:
$ date
Wed Mar 11 14:36:41 CET 2020
Peers (showing an unexpected 188. IP):
$ ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*_gateway 188.67.52.171 4 u 131 128 377 10.171 -11.526 16.139
ntpq -p
. Is this a VM, and if so on which hypervisor?ntpq -p
output. Not running in a VM.