Add NTP server to DD-WRT or not?

Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions
Goto page Previous  1, 2, 3, 4  Next

Do you want your router to serve NTP?
Yes, I really WANT this feature.
55%
 55%  [ 16 ]
Well, now you mention it. Yes!
13%
 13%  [ 4 ]
No, public NTP is fine with me.
31%
 31%  [ 9 ]
Uhh... It's already there ;-)
0%
 0%  [ 0 ]
Total Votes : 29

Author Message
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1855
Location: Hung Hom, Hong Kong

PostPosted: Sun Jan 16, 2022 4:26    Post subject: Reply with quote
Low-tier NTP server? Nice to have, nice to have... but not for old routers with limited RAM? And indeed you can use Entware to install it yourself.

BTW, the more important change is to force users to punch IP address in Basic Setup -> Time settings -> Server IP/Name?? Smile


_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
Sponsor
veekay
DD-WRT User


Joined: 09 Mar 2009
Posts: 77

PostPosted: Sun Jan 16, 2022 4:31    Post subject: Reply with quote
mwchang wrote:
Low-tier NTP server? Nice to have, nice to have... but not for old routers with limited RAM? And indeed you can use Entware to install it yourself.

BTW, the more important change is to force users to punch IP address in Basic Setup -> Time settings -> Server IP/Name?? Smile



I have 512mb of ram. Normally never had the need for one, but added a few managed switches that do time by NTP and I don't like how many times they are hitting outside servers to get time so I'd much rather have the router provide it.
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Sun Jan 16, 2022 15:02    Post subject: Reply with quote
I'm still happily running Entware's ntpd.
Code:
# opkg search /opt/sbin/ntpd
ntpd - 4.2.8p15-3
I have a device with a badly drifting clock and it can hit my dd-wrt ntp server way too often and I won't blacklist myself. Very Happy
veekay
DD-WRT User


Joined: 09 Mar 2009
Posts: 77

PostPosted: Sun Jan 16, 2022 18:02    Post subject: Reply with quote
yoyoma2 wrote:
I'm still happily running Entware's ntpd.
Code:
# opkg search /opt/sbin/ntpd
ntpd - 4.2.8p15-3
I have a device with a badly drifting clock and it can hit my dd-wrt ntp server way too often and I won't blacklist myself. Very Happy


Got it working and so far it is perfect. Will have to see what happens after a reboot, but my devices are pulling the time from it.
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Fri Jul 29, 2022 20:45    Post subject: Reply with quote
Summary: Use a raspberry Pi for your NTP Server not dd-wrt

My new ISP put their modem in a very different location than the previous ISP so dd-wrt was moved next to it. The GPS that feeds time to NTP was no longer getting a 3D fix in that location so I turned off the GPS and kept only internet NTP servers.

I eventually decided to move the NTP Server from dd-wrt to an always running raspberry Pi 3 that normally only runs kodi where the GPS 3D fix works (hate wasting a perfectly good GPS). This allowed adding a wire from the Adafruit GPS's PPS (pulse per second) pin to one of the raspberry pi's GPIO pins. The results for PPS are so accurate the offset and jitter are barely a microsecond (thousandth of a millisecond)!

Code:
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*SHM(0)          .GPSD.           1 l   10   16  377    0.000  -41.882  10.903
oPPS(0)          .KPPS.           0 l   10   16  377    0.000    0.000   0.001
+205.206.70.42   128.233.154.245  2 u    8   64  377   77.962   -5.530   0.245
+any.time.nl     200.160.7.197    2 u   30   64  377  129.343    1.426   0.293

The CPU & memory usage aren't noticeable when using kodi with gpsd using much more than ntpd but the Pi is still mostly idle.
Code:
top - 16:17:34 up 6 days, 15:43,  3 users,  load average: 0.09, 0.08, 0.08
Tasks: 164 total,   2 running, 162 sleeping,   0 stopped,   0 zombie
%Cpu(s):  3.1 us,  0.8 sy,  0.0 ni, 96.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:    766872 total,   582848 used,   184024 free,    94324 buffers
KiB Swap:   102396 total,        0 used,   102396 free.   245756 cached Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 1083 root      20   0  555648 154548  47780 S   7.5 20.2 759:01.45 kodi_v7.bin
  426 gpsd      10 -10   22144   7512   3028 R   4.6  1.0 364:16.20 gpsd

If you already have a raspberry Pi then it's a more appropriate place to run an NTP server than dd-wrt especially if you want to add a GPS and make it a stratum 1 NTP server. If you don't already have a raspberry Pi, like when I first put Entware's NTP on dd-wrt, then that works too.
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Sat Jul 30, 2022 7:10    Post subject: Reply with quote
I agree with yoyoma2

Not sure if a PI is the best target but its extensible and we can add a Real time clock to it, so then and only then the PI can be a decent time server.

Consumer routers (and PI without addon boards) dont have a real time clock only a software clock that is affected by high CPU loads, meaning the time offset would be larger the heavier the loads, most especially on slower machines.

NTP servers are the domain of devices that can serve accurate time, without a RTC at the very minimum, running a time server is not a well considered proposition, unless you also constantly updating the servers time, and then whats the point.

But since you can via entware, job done. Wink

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2927
Location: Germany

PostPosted: Sat Jul 30, 2022 7:20    Post subject: Reply with quote
Code:
raspberry4:~$ timedatectl
               Local time: Sat 2022-07-30 09:20:02 CEST
           Universal time: Sat 2022-07-30 07:20:02 UTC
                 RTC time: Sat 2022-07-30 07:20:02     
                Time zone: Europe/Berlin (CEST, +0200)
System clock synchronized: yes                         
              NTP service: active                     
          RTC in local TZ: no   


mine has had an RTC for a long time Smile
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Sat Jul 30, 2022 8:27    Post subject: Reply with quote
ho1Aetoo wrote:
mine has had an RTC for a long time Smile


Nice, which breakout did you use or did you build your own?

If I were doing it -> https://www.adafruit.com/product/4282

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2927
Location: Germany

PostPosted: Sat Jul 30, 2022 8:44    Post subject: Reply with quote
I have the RasClock 4.2

https://thepihut.com/products/rasclock-raspberry-pi-real-time-clock-module



8111111111131.png
 Description:
 Filesize:  5.93 MB
 Viewed:  1411 Time(s)

8111111111131.png


the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Sat Jul 30, 2022 9:50    Post subject: Reply with quote
Nice heatsink btw. Wink
_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2927
Location: Germany

PostPosted: Sat Jul 30, 2022 10:13    Post subject: Reply with quote
It's made in China... Mr. Green
but it works quite well, no thermal throttling even at full load on all cores.

I can only recommend especially since they are cheap
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Sat Jul 30, 2022 13:43    Post subject: Reply with quote
the-joker wrote:
Not sure if a PI is the best target but its extensible and we can add a Real time clock to it, so then and only then the PI can be a decent time server.

As this scientific paper states: "the GPS receiver has an extremely accurate internal clock, synchronized with the atomic clocks in the GPS satellites". The GPS clock needs so much precision that relativistic effects such as time slowing with motion and time speeding up with weaker gravity are both factored in. The GPS device with PPS is unbeatable for the price.
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 2927
Location: Germany

PostPosted: Sat Jul 30, 2022 13:54    Post subject: Reply with quote
Only matters if you don't have an internet connection.
Each NTP server synchronizes with an atomic clock.

GPS does not work well indoors especially if there is reinforced concrete in the way.

A simple RTC with battery backup costs much less.
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1899

PostPosted: Sat Jul 30, 2022 16:01    Post subject: Reply with quote
*Tomato and OpenWRT opted to use busybox's ntpd applet to provide client and server functionality. Only stock firmware, AsusWRT-Merlin / XWRT-Vortex, and DD-WRT "Official" still use ntpclient.
_________________
"The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost

"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
yoyoma2
DD-WRT User


Joined: 24 Sep 2016
Posts: 371

PostPosted: Sat Jul 30, 2022 18:40    Post subject: Reply with quote
ho1Aetoo wrote:
Only matters if you don't have an internet connection.
Each NTP server synchronizes with an atomic clock.

Your ntp server depends on the accuracy of the clocks you are communicating with and on the means of delivery of those clocks' time. In my post above, both the .GPSD. and the .KPPS. deliver time from the same fantastically accurate GPS clock. One has a 41882 microsecond error and the other under one microsecond error simply because of different quality delivery mechanisms for the same clock.
ho1Aetoo wrote:
GPS does not work well indoors especially if there is reinforced concrete in the way.

A simple RTC with battery backup costs much less.

True, in a concrete basement my GPS stopped working. When not in the basement (wooden house), it uses 7-11 satellites (I didn't buy the antenna for my Adafruit Ultimate GPS but I did buy the battery).

When running an NTP server, your delivery mechanism is only as good as the variable (see jitter above) internet performance at each update point in time between you and your several upstream servers. Over time, as the number of samples increases, the NTP algorithm will get an increasingly accurate guesstimate of the correct time giving more weight to the opinions of the better/closer servers it's communicating with.

A raspberry pi with a perfect RTC initialized at startup from the internet from a single or a small handful of samples is actually worse than dd-wrt with no RTC running entware's ntpd after an hour or two.

A perfect clock is only as accurate as how it's initialized. The GPS clock is initialized with direct line of sight with 10 atomic clocks (under 3 nanosecond accuracy) so the extra $12.45 for the GPS is justified. The RTC only adds value if you don't run ntpd.
Goto page Previous  1, 2, 3, 4  Next Display posts from previous:    Page 2 of 4
Post new topic   Reply to topic    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum