Giter VIP home page Giter VIP logo

pc-ptp-ntp-guide's Introduction

Precision network time synchronization on PC hardware

This is still a work-in-progress. Suggestions for improvements are very welcome and can be made by creating issues.

This is a guide to how to precisely synchronize the clocks of computers on a local area network using inexpensive PC hardware, by making use of hardware designed to support the IEEE 1588 standard for Precision Time Protocol (PTP).

This guide is designed to complement my guide to using the hardware PTP support on the Raspberry Pi CM4.

Many modern, inexpensive NICs include hardware support for PTP. This means that the NIC has its own clock, sometimes called the PTP Hardware Clock (PHC), that can be used to timestamp incoming and outgoing network packets. This hardware support makes it possible to achieve accuracies of less than 100 nanoseconds. However, achieving this level of accuracy requires running a time server on your local area network. The main goal of this guide is to explain in detail the hardware and software needed to do this, without assuming prior knowledge of time synchronization.

The server needs two specialized pieces of hardware:

  • a NIC with a PPS input
  • a GPS receiver with a pulse-per-second (PPS) output, connected to the NIC's PPS input

The key is that the NIC can timestamp the pulses received on its PPS input using its clock: this is crucial for ensuring that the level of accuracy of the transfer of time from the GPS to the server is similar to that from the server to the client. NICs with this capability are rare: the one most commonly used for this purpose is the Intel i210-T1.

This guide assumes the use of Linux for the server's operating system, since Linux has by far the best support for PTP hardware. The obvious approach is for the server to run PTP; in PTP terminology, the server will be performing the role of a PTP grandmaster. The dominant PTP implementation on Linux is LinuxPTP. An alternative approach is for the server to run an NTP server using chrony; although NTP cannot usually achieve the level of precision we are aiming for, chrony can take advantage of PTP hardware support to achieve a much higher level of precision. PTP hardware support that chrony can make use of will also work for LinuxPTP. But chrony is a bit easier to work with than LinuxPTP, so it's a good way to get started.

I think Fedora is the best distribution for this: it has the most well-maintained, up-to-date packages and best documentation for linuxptp and chrony. But Debian and Ubuntu also work fine.

In selecting hardware, there's a new feature called Precision Time Measurement (PTM), which is very useful for this application. It allows for precise synchronization between the system clock and the PHC.

Hardware selection and assembly:

Server software configuration:

  • Linux prequisites - make sure everything is working at the Linux kernel level
  • chrony - how to set up chrony with gpsd
  • Linux PTP - how to configure Linux PTP as a PTP server (grandmaster)

Information about inexpensive switches with PTP support are in the CM4 guide.

References

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.