Joined: 26 Mar 2013 Posts: 1857 Location: Hung Hom, Hong Kong
Posted: Sun Jan 16, 2022 4:26 Post subject:
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??
_________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
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??
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.
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.
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.
Joined: 31 Jul 2021 Posts: 2146 Location: All over YOUR webs
Posted: Sat Jul 30, 2022 7:10 Post subject:
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.
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
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.
*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
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.