3

I've searched around, but I cannot find an answer.

Can I use my Raspberry Pi as an NTP server (independently).

I want to synchronize 4 devices on a LAN for logging. They will be on a LAN with no WAN access... one is a Cisco Switch, one is the Pi and the other two are conversion boxes I want to log things on (they will be NTP client).

I just need them all to sync to 1 clock source (the Pi) is there a way to do this? All the answers I find are either to setup the Pi with a GPS module (which I can't do here) or sync it to external NTP servers for cascading the clock down (which I can't do here)... can I use NTP just to send out the Pi's system time ?

1
  • Note, unless you add some sort of clock to the PI, the time will reset on each PI reboot. Jul 4, 2018 at 11:19

3 Answers 3

2

You can, but you need a source for the time. a GPS module is one option, as it gets the correct time, but if you only need to set the time once and then just want to distribute it, you can just get a realtime clock module for the pi. This should be accurate up to a few seconds per year, which is probably enough when you just want to synchronize the time of your devices.

2
  • 1
    That's exactly what I'm looking for :-) ... After I add the RTC, can I used NTP to distribute it around the network (Pi acts as NTP Server)? I presume the command will be similar to the GPS module ones I have found to implement (obviously with changes)
    – bobuk
    Jul 3, 2018 at 8:58
  • 1
    When the realtime clock is working, you can use (open)ntpd to act as ntp server. Have a look at the config file and disable syncing with upstream servers and enable serving ntp to your LAN. If you need help, any related howto should do, as a pi with a RTC just works like any other computer.
    – allo
    Jul 3, 2018 at 9:04
2

Set the server to 127.127.1.0 in /etc/ntp.conf: this is a special address which tells NTP to use your local clock as a reference.

1
  • 1
    Generally you also set the stratum of such floating servers to a fairly low level (13) to avoid anyone mistaking them as true references.
    – colintd
    Feb 3, 2023 at 0:40
1

I'm assuming you can't do GPS due to lack of skyview? I don't know where you're based, but you could consider one of the long wave MSF/"Atomic time" radio receivers. They generally continue to work inside buildings, and will give you a fairly good external reference for NTP to run with.

If that doesn't work for you, you could consider something like this http://wiki.seeedstudio.com/High_Accuracy_Pi_RTC-DS3231/ which should keep time to about 1s/week.

1
  • The other thought is that ntp is all about time distribution and RPi are cheap. So if you can get networking to a site with sky view, go the extra rpi + ntp + gps route to get a good reference, then just use ntp to carry time where you need it.
    – colintd
    Feb 3, 2023 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.