Labs / Speaking Protocols / Time & office: NTP, files, FTP & PTP

Lab 4 of 4 · Time & office: NTP, files, FTP & PTP

PTP and NTS: time that is precise, and time that is proven

Sync a clock to microseconds with PTP, then authenticate time with NTS.

Open this lab Pro 5 steps

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.

Four timestamps, two directions
Four timestamps, two directions

Steps

  1. 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
  2. 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

  1. Plain NTP believes anyone
  2. NTS proves the server
  3. NTS refuses the impostor
Get Pro

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Start with a free account: Google or email, no card.

Open this lab