The idea
PTP measures time to the nanosecond on a LAN; NTS proves which NTP server is speaking. ptpMaster and ptpSlave share the office LAN with the laptop; beyond officeRouter, timeServer tells the right time and rogueTime lies.
Steps
-
A grandmaster and a slave
Trading floors, phone networks and factory robots need clocks that agree to well under a millisecond, which NTP cannot give. PTP, the Precision Time Protocol, keeps clocks on a LAN together to nanoseconds. ptpMaster runs ptp4l and becomes the grandmaster, the clock the others follow. Run it on ptpSlave as a slave.
ptpMaster:~# ptp4l -f /etc/linuxptp/ptp4l.conf -i eth0 -m ptpSlave:~# ptp4l -f /etc/linuxptp/ptp4l.conf -i eth0 -s -m
-
Four timestamps on the wire
A clock cannot know how long the master's message spent on the wire, so PTP measures the trip both ways. It goes to a Multicast group, so the laptop on the same LAN hears it all. With both clocks running again, decode the PTP packets on the laptop's card.
ptpMaster:~# ptp4l -f /etc/linuxptp/ptp4l.conf -i eth0 -m ptpSlave:~# ptp4l -f /etc/linuxptp/ptp4l.conf -i eth0 -s -m laptop:~# tshark -i eth0 -n udp portrange 319-320
Pro
3 more steps in the app
- Plain NTP believes anyone
- NTS proves the server
- NTS refuses the impostor