NetWeaver NewsOpen Source

Stratum-1 NTP server on Raspberry Pi

1 Comment

We’ve run our own Stratum-2 time server, operating as part of the ntp public pool, for some time.  In the past we’ve synchronised this clock with a number of public Stratum-1 servers provided by organisations such as Leo Bodnar Electronics and the University of Suffolk.   Inspired by the setup at Bytemark, we set about creating our own Stratum-1 time server.

Stratum Explained

Stratum levels are used to describe how close to the source, and thus how precise, a time server is.  We start at Stratum-0, which is the reference clock – usually a cesium atomic clock, often via GPS (the GPS satellites contain cesium atomic clocks). Stratum-0 doesn’t connect to a network, it merely provides a source for a Stratum-1 time server to directly connect to.

Since GPS connected servers and cesium atomic clocks are relatively rare, Stratum-2 servers are setup to connect to them.  It is then, in most cases, the Stratum-2 servers which provide an NTP service for end users to connect to.  This may be within their own network or through the public pool.  Servers which synchronise from Stratum-2 servers, are known as Stratum-3 and so on.  The levels go all the way down to Stratum-16, but at this point the accuracy will be significantly diminished.

NTP Pool

For the huge majority of computers, servers in the NTP pool are configured as the default time source.  This service is an extremely valuable source on the internet, enabling critical servers to keep accurate time since the built in clocks are usually not that good.  At the time of writing there are 206 public NTP servers in the UK and 4153 around the world.  This may seem a lot, but with many individual applications using this service, as well as devices, the number of users could well be many hundreds of millions.  An error in a SnapChat update late last year showed the affect a fault in a popular app could have on this infrastructure.

The NetWeaver Stratum-1 server

Since our datacentre providers wouldn’t be too keen on us climbing onto their roofs to install GPS receivers, it made sense to install our NTP server in our Lancashire office.  We knew traffic to it would be low (only from our own Stratum-2 servers) so it would be fine to use our office broadband connection.

We wanted to use a Raspberry Pi for this, and were pleased to discover that the clever folk over at Uputronics have built a GPS expansion board for the Pi.  With the board installed, a GPS antenna installed outside (metal building + magnetic mount makes for easy install) we were ready to get configuring.  Our setup is based on Antony Stirk’s excellent guide, with changes and modifications made to allow for our use case and improvement tips from the various comments made on the post.

Build Cost

We used the following components to build our Raspberry Pi NTP server

Raspberry Pi 3 B+ Essentials Kit : £58 from Pimoroni
GPS Extension Board Kit : £35.99 from Uputronics
Active GPS Patch Antenna with SMA Connector : £11.99 from Uputronics
(postage total cost £9.91)

Total cost : £115.89 (including VAT)

Handy Resources

If you’re considering making your own Raspberry Pi based NTP server, the following websites are very helpful:

  • https://ava.upuaut.net/?p=951
  • https://www.satsignal.eu/ntp/Raspberry-Pi-NTP.html
  • https://support.ntp.org/bin/view/Sandbox/HowtoPpsOnRaspberryPi

Using NTP

If you’d like to synchronise with our Pi – you can set your NTP compatible device to get its time from : time.netweaver.uk

If you run your own NTP server (especially stratum-1), please tell us about it in the comments.

Previous Post
Get your dot uk domain for free – last chance – .uk
Next Post
Introducing NetWeaver Labs

1 Comment. Leave new

  • Hi, I run a Stratum 1 server on a Raspberry Pi model B using an Adafruit GPS breakout module to provide PPS and NMEA. The only problem with the RPi is a slow NIC which has a latency of 350ms. Cost about £70 all in.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.

Menu