2
I'm fairly new to NTP. I have two computers running Lubuntu 17.04 that I'd like to keep in close time sync with minimal hardware. There is no need to sync to real time, just to keep the system times between the two computers as close as possible.
NTP seems to an appropriate solution. I succeeding in getting NTP working between the two computers, when configured with DHCP addresses (DHCP from a router, one PC is the NTP broadcast server and the other is the client, the PCs sync to each other and obtain close sync of ~1ms or less).
To reduce the amount of hardware I remove the router and set the IP's on each computer to static, then connect via a cross-over cable:
- 10.1.1.50 255.255.255.0 (NTP "client" PC)
- 10.1.1.51 255.255.255.0 (NTP "server" PC)
(Gateway was left blank in both cases.)
The PCs can ping each other successfully (delay is less than 1ms, around 0.3ms-0.4ms). However, I can't seem to get the ntp.conf
configured; the NTP client computer just stays on INIT and all measures at 0. How can I debug the NTP configuration to find out where it is going wrong please?
There is no /var/lib/ntp/ntp.conf.dhcp
file.
Firewall is turned off for both PCs.
Output from ntpq -pn
is
remote refid st t when poll reach delay offset jitter
==============================================================================
10.1.1.51 .INIT. 16 u - 1024 0 0.000 0.000 0.000
Relevant lines from ntp.conf
for the client are (i.e., all lines without comments)
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 10.1.1.51
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
restrict 127.0.0.1
restrict ::1
restrict 10.1.1.0 mask 255.255.255.0
disable auth
broadcastclient
Relevant lines from ntp.conf for the server NTP PC are (i.e., all lines without comments)
driftfile /var/lib/ntp/ntp.drift
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 127.127.2.1 # local clock
fudge 127.127.2.1 stratum 10
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
restrict 127.0.0.1
restrict ::1
restrict source notrap nomodify noquery
restrict 10.1.1.0 mask 255.255.255.0
broadcast 10.1.1.255
Using the command ntpdate -d 10.1.1.51 the problem seems to be that the NTP server 10.1.1.51 has too high a stratum level (as it is currently disconnected from the internet, and hence, it is not a trustworthy time source according to NTP).
Research suggests that it is not possible to fudge the stratum level of my isolated NTP server. Hence, I've enabled wifi on the NTP server and have attempted to allow it to sync to the standard Ubuntu pool of time servers, however ntpq -p takes a long time to respond with the cross over cable plugged in. I will check if my network config is correct and report back.
Is that 300ms accurate? It should be less than 1ms - did you mean 0.300ms - 0.400ms? If it is that high, then there is a networking problem. – Paul – 2017-11-12T02:42:01.440
My apologies, output of ping 10.1.1.51 from the client is 0.3 to 0.4 ms. (Question updated). – mark2017 – 2017-11-12T03:25:33.143