2

I have a raspberry pi hooked up to a local network where there is not internet acces. I have configured a computer to act as a timesever (windows timeservice). The timeserver has the ip 192.168.6.1 and the raspberry has the ip 192.168.6.83.

I have been reading about NTP and how to configure NTP. My configuration file (/etc/ntp.conf) looks like:

tinker panic 0
server 192.168.6.1 prefer true iburst

driftfile /var/lib/ntp/ntp.drift
logfile /var/log/ntp.log

minpoll 4
maxpoll 5

The output of the "ntpq -pn" command is:

    remote         refid      st t  when  poll reach    delay    offset  jitter
===============================================================================
192.168.6.1    192.168.6.82    3 u    23   64      3    0.652   1836879   2.136

There is a large offset but if I understood it correctly this shouldn't matter because of the 'tinker panic 0' line in the configuration file.

I know the server is working correctly because I can sync the right time with the command:

sudo sntp -s 192.168.6.1

I want the raspberry to sync with the server, no matter what the offset is. And it should go automatically. I want the raspberry to sync when it boots and then keep syncing.

I know about the post here but this uses the ntpdate which seems to be depreciated.

1
  • The ntp service is definitely running? Feb 13, 2018 at 11:44

2 Answers 2

2

To be able to sync with a Windows NTP, add

tos maxdist 30

to the end of your /etc/ntp.conf and restart your NTP service.

From Why should I need a tweak to force VMware ESXi 5 to sync time with Windows NTP server

(quotation slightly changed in the Italics)

By default, an unsynced Windows server chooses a 10-second dispersion and adds to the dispersion on each poll interval that it remains in sync. A Linux ntpd, by default, does not accept any NTP reply with a root dispersion greater than 1.5 seconds.

Besides this, you also have to make changes to Windows.

4
  • @Steven What is the version of windows? Feb 13, 2018 at 15:03
  • Windows 10 Pro N
    – Steven
    Feb 13, 2018 at 15:09
  • does this help? russlescai.wordpress.com/2013/01/07/… My other answer was wrong, whilst in windows 2k it was true, nowadays windows uses NTP Feb 13, 2018 at 15:22
  • It is a clear tutorial, but it is similar to tutorials I have found while trying to solve this problem. Your answer did point me in the right direction. I used [link] (satsignal.eu/ntp/setup.html) and now the raspberry does receive time updates. This would mean that there is something on the windows side that is not configured correct. The raspberry side was ok. Thanks anyway.
    – Steven
    Feb 13, 2018 at 15:30
1

After some more trial and error I have found a solution to the problem. Most credit goes to @Rui F Ribeiro for pointing me in the right direction with his response (which he later deleted for being not correct). Because this did lead to a solution I am posting it.

Windows time service implements Simple-NTP (SNTP) by default and not NTP. As a result the ntp deamon won't be able to talk to the SNTP service.

Syncing by using the command sudo sntp -s 192.168.6.1 is a way that implements SNTP and therefore is able to set the time.

The solution for my problem was by using a NTP service (on windows) that can be found HERE (link points to a tutorial).

The program implements the NTP protocol on windows with the linux syntax. This service works out of the box when the computer on which it is installed is connected to the internet. I wanted to be able to sync the time even when the windows computer is not able to reach the time servers. Therefore I had to edit the ntp.conf file to include the following lines:

# add the Local clock
server 127.127.1.0
# Set stratum to a high level so that the clock is accepted
fudge 127.127.1.0 stratum 5

This resulted in the raspberry being able to sync with the windows computer (that may or may not be connected to the internet).

5
  • Had you have to deativate the Windows NTP service? Feb 14, 2018 at 11:10
  • Yes, it seems that this one replaces the windows NTP service
    – Steven
    Feb 14, 2018 at 16:33
  • The point is that if you have installed it without doing nothing else and without problems, that the NTP server was not running. Feb 14, 2018 at 16:50
  • During the installation it asks if it is OK to shut the widows ntp down. And the sntp did work before? Or is it that Windows had a seperate server running for sntp and ntp?
    – Steven
    Feb 15, 2018 at 19:24
  • oh, ok, then you did something. Feb 15, 2018 at 19:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .