Advanced search FAQ Register Login

It is currently Mon Feb 19, 2018 4:55 am

 

Postby TerryJC » Thu Jan 25, 2018 1:00 pm

TerryJC wrote:Further to my experiences related above, it has now emerged that our solution for an NTP Server may actually be causing a problem with the Real Time Clock. This post https://forum.modmypi.com/technical-support/rasclock-timekeeping-very-erratic-t1713.html#p7572 relates my problems with getting the RTC to keep time and the current state of affairs which seems to be that running the NTP Server on my Pi causes the time to be corrupted on itself.

It's a while ago now, but someone emailed me through the Forums with a question (which I couldn't really answer properly), but it reminded me that I had never come back to relate how we solved this.

A member of our local LUG suggested that instead of NTP, we could try using rdate. We needed to set up a time service on our main Pi (see https://en.wikipedia.org/wiki/Xinetd) and then run:

Code: Select all

rdate -v <IP Address of the main Pi>

from the client.

TerryJC
Initiated

Posts: 44

Joined: Mon Nov 07, 2016 2:23 pm

Location: Wimborne Minster, Dorset

Terry

Postby TerryJC » Thu Jan 25, 2018 2:22 pm

ljylxl wrote:I am doing a similar experiment now. I use two pi and I set up one as a server and the other as a client. The setup process is the same as yours. I would like to set a random time on the server pi and let the client pi to sync with the server. I saw your screen capture and now I am also in this step. When I use "ntpq -pn" to show the server ip, the output is the same with the pic you posted. However, I do not know what to do next.\ What command can I use to sync client to server?

Providing that you have set up both server and client as detailed in https://forum.modmypi.com/networking-and-servers/set-up-and-offline-rpi-as-an-ntp-server-with-rasclock-t1693.html#p7432 above, (especially the information detailed in the link to http://raspberrypi.tomasgreno.cz/ntp-client-and-server.html), your client(s) should sync to the server without any additional command.

If you follow that thread down from that posting, you will see that we had problems because it was taking up to 10 minutes for the server to stop sending out Kiss of Death (KOD) packets and because the server and client were starting together. If your server is online before the client starts, then you shouldn't have that problem.

TerryJC
Initiated

Posts: 44

Joined: Mon Nov 07, 2016 2:23 pm

Location: Wimborne Minster, Dorset

Terry

Postby ljylxl » Thu Jan 25, 2018 5:22 pm

More details:
I directly connect the two pi with an ethernet cable and I set up their IP.
They can be pinged with each other. After setting the client and server, using "ntpq -n" I can see the server IP (the only server).

ljylxl
n00b

Posts: 5

Joined: Thu Jan 25, 2018 2:56 am

Postby TerryJC » Thu Jan 25, 2018 5:42 pm

ljylxl wrote:More details:
I directly connect the two pi with an ethernet cable and I set up their IP.
They can be pinged with each other. After setting the client and server, using "ntpq -n" I can see the server IP (the only server).

I understand that, but have you set up both the server and the client end too as detailed in the link above?

Are you using a RASClock (or some other HW Clock) on the server or getting time from the Internet?

Also, I recall that there was some problem with NTP not working with the Pi's RTC because it wasn't considered accurate enough. Here is what a member of our LUG said:
Everything is sitting at stratum 16 "no trusted clocks", the server won't
offer a syncronisation service at this level.

The server needs a clock it trusts before it will serve the time.

Add the following two lines to your servers config.

server 127.127.1.0
fudge 127.127.1.0 stratum 12

This tells the server to use the system clock as a reference at stratum
12. System clock on a Pi is a poor choice since the Pi doesn't have an
RTC so will get clobbered on every power cycle but it should get you
going.


I've attached the last versions of my server and client ntp.conf files. I hope they can assist you.

TerryJC
Initiated

Posts: 44

Joined: Mon Nov 07, 2016 2:23 pm

Location: Wimborne Minster, Dorset

Terry

Postby TerryJC » Thu Jan 25, 2018 5:48 pm

TerryJC wrote:I've attached the last versions of my server and client ntp.conf files. I hope they can assist you.

I can't get the board to accept the files. I'll try renaming them. If this doesn't work I'll have to paste them into the post.

TerryJC
Initiated

Posts: 44

Joined: Mon Nov 07, 2016 2:23 pm

Location: Wimborne Minster, Dorset

Attachments

client_ntp.txt

(1.94 KiB) Downloaded 5 times

server_ntp.txt

(2.05 KiB) Downloaded 4 times

Terry

Postby ljylxl » Thu Jan 25, 2018 6:01 pm

HI, thank you for the reply.
I think I follow the link to setup the server and client.
I do not use RASclock.
My idea is I setup one pi's time randomly(rather than from internet or RASclock) and makes it as a server. the client is sync to this time. Since the on the client side when I use "ntpq -np" I can see the server's IP under "remote" why I can not sync with it?

ljylxl
n00b

Posts: 5

Joined: Thu Jan 25, 2018 2:56 am

Postby TerryJC » Thu Jan 25, 2018 6:05 pm

ljylxl wrote:My idea is I setup one pi's time randomly(rather than from internet or RASclock) and makes it as a server. the client is sync to this time. Since the on the client side when I use "ntpq -np" I can see the server's IP under "remote" why I can not sync with it?

In that case, I think that you will also need to use the 'fudge' setting that I mentioned above, because the RPi's RTC is not considered by the NTP server software to be accurate enough to serve.

TerryJC
Initiated

Posts: 44

Joined: Mon Nov 07, 2016 2:23 pm

Location: Wimborne Minster, Dorset

Terry

Postby ljylxl » Thu Jan 25, 2018 10:40 pm

Thank you for the reply. I made it done now and I have the same problem that it needs several mins to sync the two pi. I tried put iburst in the server ntp conf but it has no help.

ljylxl
n00b

Posts: 5

Joined: Thu Jan 25, 2018 2:56 am

Postby TerryJC » Fri Jan 26, 2018 10:46 am

ljylxl wrote:Thank you for the reply. I made it done now and I have the same problem that it needs several mins to sync the two pi. I tried put iburst in the server ntp conf but it has no help.

I'm afraid we never got past that point because we found a work-round (see https://forum.modmypi.com/networking-and-servers/set-up-and-offline-rpi-as-an-ntp-server-with-rasclock-t1693.html#p7466 above).

In any case we eventually abandoned NTP and used rdate because of the problems with NTP screwing with our RASClock.

Perhaps someone else has some ideas?

TerryJC
Initiated

Posts: 44

Joined: Mon Nov 07, 2016 2:23 pm

Location: Wimborne Minster, Dorset

Terry

Postby ljylxl » Fri Jan 26, 2018 5:00 pm

Hi, Terry, my project is a little different.
I can boot one pi first and then the next one. Also I can wait for them to be synced. Also I want to try to use rdate.

ljylxl
n00b

Posts: 5

Joined: Thu Jan 25, 2018 2:56 am

PreviousNext

Who is online

Users browsing this forum: No registered users and 1 guest

Board index

The teamDelete all board cookies • All times are UTC [ DST ]