ptpd2(8)
π ptpd2(8) β Precision Time Protocol daemon (1588-2008) π
okay so bestie, welcome to ptpd2(8), the manual page for the Precision Time Protocol daemon. She's giving Very Serious Time Business but honestly she's iconic. Let's get into it π«Ά
β¨ NAME β¨
ptpd2 β the Precision Time Protocol daemon (1588-2008). That's it, that's the name section, short and slay π
π¦ SYNOPSIS π¦
ptpd2 [ -?hH ] [ -e SETTING ] [ -kvOLAl ] [ -smMyEPanCV ] [ -c FILE ] [
-R DIR ] [ -f FILE ] [ -S FILE ] [ -d DOMAIN ] [ -u ADDRESS ] [ -r
NUMBER ] -i INTERFACE
πΈ DESCRIPTION πΈ
So PTPd is a daemon that implements the Precision Time Protocol (PTP) Version 2, as defined by the IEEE 1588-2008 standard. PTP was literally developed to give LAN-connected computers very precise time coordination β it's the group chat scheduler of the networking world, no cap β°
The daemon must run as root in order to be able to manipulate the system clock and use low port numbers. That part is not a suggestion, bestie, that's a requirement π
PTPd is feature rich, and she supports:
- IPv4 multicast
- unicast
- hybrid mode (mixed) operation
- Ethernet mode
Even without hardware assistance, PTPd is able to achieve and maintain sub-microsecond level timing precision, and she's able to withstand PTP Grandmaster failovers, link failures and restarts with minimal impact to timing performance. Resilient queen energy honestly ππ
PTPd is lightweight, portable, and currently supports Linux, FreeBSD and Mac OS X, and runs on multiple CPU architectures, 32-bit and 64-bit, including x86 and ARM. She's everywhere, she's versatile, she's the main character π
π§ COMMAND-LINE CONFIGURATION π§
As of version 2.3.0, the configuration file is the preferred mechanism for configuring PTPd. So the options available as short options (-x) and long options (--xxxxx) mostly provide basic control over the daemon operation, and only provide the very basic PTP protocol settings.
The rest of the settings (see ptpd2.conf(5)) can also be specified as command-line options, but they take the long --key:section="value" form. Yes, it's giving fancy. Yes, it's on purpose π
π BASIC DAEMON OPTIONS π
-c,--config-filePATH β Path to the configuration file (seeptpd2.conf(5))-k,--check-configβ Check the configuration and exit β returns0if the configuration is correct.-v,--versionβ Print the version string and exit-h,--helpβ Show the help screen-H,--long-helpβ Show detailed help for all settings and behaviours-e,--explainSETTING β Show help for a single setting (section:key)-O,--default-configβ Show the default configuration and exit (the output is usable as a configuration file)-L,--ignore-lockβ Skip lock file checks and locking (alsoglobal:ignore_lock)-A,--auto-lockβ Use preset / port mode specific lock file names β useful when running multiple instances-l,--lockfileβ Specify the lock file path (alsoglobal:lock_file)-p,--print-lockfileβ Print the path to the lock file and exit (useful for init scripts in combination with auto lock files)-R,--lock-directoryDIR β Directory to store lock files (alsoglobal:lock_directory)-f,--log-filePATH β Path to the log file (alsoglobal:logfile)-S,--statistics-filePATH β Path to the statistics file (alsoglobal:statistics_file)
π₯ BASIC PTP PROTOCOL OPTIONS π₯
-i,--interfaceDEV β REQUIRED: the interface to use βeth0, etc (alsoptpengine:interface)-d,--domainNUMBER β The PTP domain number to become part of (alsoptpengine:domain)-s,--slaveonlyβ Slave only mode (alsoptpengine:preset=slaveonly)-m,--masterslaveβ Full IEEE 1588 implementation: master, slave when not best GM (alsoptpengine:preset=masterslave)-M,--masteronlyβ Master only mode: passive when not best GM (alsoptpengine:preset=masteronly)-y,--hybridβ Hybrid mode β mixed multicast and unicast operation (multicast for sync and announce, unicast for delay request and response (alsoptpengine:ip_mode=hybrid)-U,--unicastβ Unicast operation β (alsoptpengine:ip_mode=unicast). For a GM, unicast destinations must be specified (-u,--unicast-destinations,ptpengine:unicast_destinations) unless using unicast negotiation (-g,--unicast-negotiation,ptpengine:unicast_negotiation=y) for delay request and response (alsoptpengine:ip_mode=hybrid). For a slave, unicast destinations must be specified if not using unicast negotiation.-g,--unicast-negotiationβ Enable unicast message delivery and interval negotiation using signaling messages, as used by the Telecom profile (also enablesptpengine:ip_mode=unicast)-u,--unicast-destinationsip/host, ip/host, ... β List of unicast destinations β see--unicast(alsoptpengine:ip_mode=unicast+ptpengine:unicast_destinations)-E,--e2eβ End to end delay mechanism (alsoptpengine:delay_mechanism=E2E)
π real talk: in the original page this-E,--e2eentry is literally glued onto the end of the-udescription with no line break, so don't come for me β I'm just handing it to you as its own bullet so your eyes don't have to suffer.
-E,--p2pβ Peer to peer delay mechanism (alsoptpengine:delay_mechanism=P2P)-a,--delay-overrideβ In slave state, override the delay request interval announced by the master (alsoptpengine:log_delayreq_override) β the value ofptpengine:log_delayreq_intervalis used-r,--delay-intervalNUMBER β Specify the delay request message interval (log 2) β (alsoptpengine:log_delayreq_interval)-n,--clock:no_adjustβ Do not adjust the clock (alsoclock:no_adjust)-D<DD...>,--debugβ Debug level (alsoglobal:debug_level) β only if compiled withRUNTIME_DEBUG-C,--foregroundβ Don't run in the background (alsoglobal:foreground=Y)-V,--verboseβ Run in the foreground, log all the messages to standard output (alsoglobal:verbose_foreground=Y)
π COMPATIBILITY OPTIONS π
PTPd supports the following options compatible with versions before 2.3.0:
-bDEV β Network interface to use-iNUMBER β PTP domain number-gβ Slave only mode-Gβ Β΄Master mode with NTPΒ΄ (master only mode)-Wβ Β΄Master mode without NTPΒ΄ (master / slave mode)-Uβ Hybrid mode (mixed unicast + multicast operation)-YNUMBER β Delay request interval (log 2)-tβ Do not adjust the clock
β οΈ NOTE: the above options are deprecated and will be removed in subsequent versions. Until then, their use will issue a warning. So likeβ¦ they still work, but they're on notice, bestie π«
π PTPD PORT STATES π
initβ INITIALIZINGfltβ FAULTYlstn_initβ LISTENING (first time)lstn_resetβ LISTENING (subsequent reset)passβ PASSIVE (not best master, not announcing)unclβ UNCALIBRATEDslvβ SLAVEpmstβ PRE-MASTERmstβ MASTER (active)dsblβ DISABLED?(unk) β UNKNOWN state
Each one is a whole little era, honestly π
π STATISTICS LOG FILE FORMAT π
okay so when the statistics log is turned on β that's ptpengine:log_statistics, or verbose foreground mode, or a log file via ptpengine:statistics_file β a PTPd slave will log clock sync info every single time it gets a Sync and a Delay Response message. and when PTPd starts up or flushes the log, it drops a lil comment line (starts with #) listing all the column names, so you're never squinting at mystery numbers π
the format is a series of comma-separated values (CSV, bestie, we love a classic) and it imports super easily into stats tools and basically every spreadsheet package for analysis and graphing. heads up though: this log can get huge if you run PTPd for long periods at high message rates π so to cut down on the number of messages logged, you can use the global:statistics_log_interval setting to limit output to just one message per configured interval. the size and max number of the statistics log are also controllable β see ptpd2.conf(5).
and here's what each column actually means, bestie:
Timestampβ when the message was received. it can be a text date/time, a Unix timestamp (with fractional seconds), or both (in which case an extra field gets added), all depending on theglobal:statistics_timestamp_formatsetting (seeptpd2.conf(5)). plotting-software tip πΈ: when importing the log, if the software understands Unix time, set the timestamp format tounixorbothβ because some software will NOT deal properly with the fractional part of the second when it converts the text date/time.Stateβ the port state (seePTP PORT STATESβ¨).Clock IDβ the port identity of the current best master, as defined by IEEE 1588. this is the local clock's ID if the local clock is the best master. displayed asclock_id/port(host)β port is the PTP clock port number, do not confuse it with UDP ports, iykyk. the clock ID is an EUI-64 64-bit ID, usually converted from the 48-bit MAC address by inserting0xfffebetween the lower and upper half of the MAC. PTPd will try to convert the clock ID back to a MAC address and look up the hostname from/etc/ethers(seeethers(5)). so populating your ethers file = your admin recognises masters by familiar hostnames, iconic πOne Way Delayβ current one-way delay (a.k.a. mean path delay) in seconds, calculated by PTPd in slave state from the Delay Request β Delay Response exchange. > note: if this value stays at zero, it usually means no Delay Response messages are being received β likely a network issue πOffset From Masterβ current offset from master in seconds. this is the main output of the PTP engine in slave state, and it feeds the clock servo for clock corrections. this is the value you stare at when estimating slave performance πSlave to Masterβ intermediate offset value (seconds) pulled from the Delay Request β Delay Response exchange, used for computing one-way delay. if the last value was rejected by a filter, the previous value shows in the log. also zero if no Delay Response messages are coming in.Master to Slaveβ intermediate offset value (seconds) pulled from the Sync messages, used for computing the offset from master. if the last value got rejected by a filter, the previous value shows in the log.Observed Driftβ the integral accumulator of the clock control PI servo model, i.e. the frequency difference between the slave clock and the master clock. this value stabilises once the clock offset has stabilised, and can be used (and is used) to detect clock stability βLast Packet Receivedβ what message arrived last:Sfor Sync,Dfor Delay Response. if a slave logs noDentries, it's not receiving Delay Response messages, which could be a network issue πOne Way Delay Meanβ one-way delay mean, computed over the last sampling window.One Way Delay Std Devβ one-way delay standard deviation, computed over the last sampling window.Offset From Master Meanβ offset from master mean, computed over the last sampling window.Offset From Master Std Devβ offset from master standard deviation, computed over the last sampling window.Observed Drift Meanβ observed drift / local clock frequency adjustment mean, computed over the last sampling window.Observed Drift Std Devβ observed drift / local clock frequency adjustment standard deviation, computed over the last sampling window. the lower this value, the less aggressively the clock is being controlled β and therefore the more stable it is π§raw delayMSβ raw (unfiltered)delayMSvalue. great for evaluating outliers and filter performance.raw delaySMβ raw (unfiltered)delaySMvalue. also great for evaluating outliers and filter performance.
NOTE π: all of those statistical measures (mean and std dev) only get computed and displayed if PTPd was built without--disable-statistics. the duration of the sampling period is controlled by theglobal:statistics_update_intervalsetting β seeptpd2.conf(5).
π¦ HANDLED SIGNALS π¦
PTPd handles these signals, bestie:
SIGHUPβ reload the configuration file (if used) and reopen log filesSIGUSR1β when in slave state, force a clock step to the current Offset From Master valueSIGUSR2β dump all PTP protocol counters to the current log target (and clear them ifptpengine:sigusr2_clears_countersis set)SIGINT|SIGTERMβ clean exit: close logs and other open files, clean up the lock file, and exit π«ΆSIGKILLβ force an unclean exit π
πͺ EXIT CODES πͺ
when it exits, ptpd2 returns 0 on success β either it started successfully in daemon mode, or it otherwise exited cleanly. 0 is also returned when you use the -k (--check-config) option and the configuration was correct β¨
a non-zero exit code means errors:
- 3 β returned on lock file errors, and when
ptpd2could not be started as a daemon - 2 β returned on memory allocation errors during startup
- 1 β returned for all other error conditions, like configuration errors, running
ptpd2in help mode or with no parameters, on self shutdown, network startup errors, and when attempting to runptpd2as non-root π€
π» SUPPORTED PLATFORMS AND ARCHITECTURES π»
PTPd is fully supported on Linux and FreeBSD, because that's what the core devs focus on. OpenBSD and NetBSD are also supported but get less developer attention. so is Mac OS X, and as of PTPd 2.3.1 also OpenSolaris (11) derivatives (tested on OmniOS). Sun's / Oracle's Solaris 11 hasn't been tested, but in essence it should work as intended. Solaris 10 is NOT supported β because it doesn't provide the SO_TIMESTAMP socket option. theoretically you could use Solaris 10 with the pf facility the way snoop does, but there's currently no ongoing effort to achieve that. patches for QNX/Neutrino have been provided but can't be officially merged yet since the devs don't have QNX available. some users have ported PTPd to other RTOS, but that hasn't been merged either.
as of 2.3.1, PTPd runs entirely in software and only relies on kernel and OS APIs, so there are zero hardware dependencies π any little-endian or big-endian port of modern versions of the supported OSes should work, but only x86 and ARM are actively tested. the only dependencies even close to hardware are NIC drivers and how (and whether) they impact software timestamping.
β±οΈ HARDWARE TIMESTAMPING SUPPORT β±οΈ
as of 2.3.1, PTPd still does not support hardware timestamping. that functionality will show up in the upcoming version 2.4 β and potentially an interim 2.3.x might land that supports hardware clocks and timestamping on Linux. it's very much OS-specific and, to a large extent, hardware-specific. Linux has a PTP kernel API, but not all hardware supports it. and because PTPd supports multiple OS platforms β where hardware timestamping may use different mechanisms on every platform β it has to be rewritten in a modular way to allow all that without needlessly increasing code complexity, which is already a problem π lowkey the whole reason it's taking a minute.
π BUGS π
as of ptpd 2.3.1, the (Open)Solaris (11) OS family is supported, but libpcap functionality is currently broken β IPv4/pcap and Ethernet transports can't be used on those systems. PTPd will compile and run, but will not receive any data π
please report any bugs using the bug tracker on the SourceForge page: http://sourceforge.net/projects/ptpd/
π SEE ALSO π
π AUTHORS π
- Gael Mace
<gael_mace@users.sourceforge.net> - Alexandre Van Kempen
- Steven Kreuzer
<skreuzer@freebsd.org> - George Neville-Neil
<gnn@freebsd.org> - Wojciech Owczarek
<wojciech@owczarek.co.uk>
the ptpd2(8) man page was written by Wojciech Owczarek for ptpd 2.3.0 in November 2013 π«Ά
okay that's the whole page, bestie, you made it ππ this is version 2.3.1, dated June, 2015, and yes it's ptpd2(8) β go sync some clocks, you absolute icon, periodt β¨π
π¦ where this page comes from
- opensuse-leap 16.0: ptpd 2.3.1-bp160.1.9 Β· BSD-3-Clause
- opensuse-leap 16.0: ptpd 2.3.1-bp160.1.9 Β· BSD-3-Clause
- opensuse-leap 16.0: ptpd 2.3.1-bp160.1.9 Β· BSD-3-Clause
- opensuse-leap 16.0: ptpd 2.3.1-bp160.1.9 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms