The software described in this documentation is either in Extended Support or Sustaining Support. See https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdf for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.

14.2.1 Configuring the PTP Service

To configure the PTP service on a system:

  1. Install the linuxptp package.

    # yum install linuxptp
  2. Edit /etc/sysconfig/ptp4l and define the start-up options for the ptp4l daemon.

    Grandmaster clocks and slave clocks require that you define only one interface.

    For example, to use hardware time stamping with interface em1 on a slave clock:

    OPTIONS="-f /etc/ptp4l.conf -i em1 -s"

    To use software time stamping instead of hardware time stamping, specify the -S option:

    OPTIONS="-f /etc/ptp4l.conf -i em1 -S -s"
    Note

    The -s option specifies that the clock operates only as a slave (slaveOnly mode). Do not specify this option for a grandmaster clock or a boundary clock.

    For a grandmaster clock, omit the -s option, for example:

    OPTIONS="-f /etc/ptp4l.conf -i em1"

    A boundary clock requires that you define at least two interfaces, for example:

    OPTIONS="-f /etc/ptp4l.conf -i em1 -i em2"

    You might need to edit the file /etc/ptp4l.conf to make further adjustments to the configuration of ptp4l, for example:

    • For a grandmaster clock, set the value of the priority1 parameter to a value between 0 and 127, where lower values have higher priority when the BMC algorithm selects the grandmaster clock. For a configuration that has a single grandmaster clock, a value of 127 is suggested.

    • If you set the value of summary_interval to an integer value N instead of 0, ptp4l writes summary clock statistics to /var/log/messages every 2N seconds instead of every second (20 = 1). For example, a value of 10 would correspond to an interval of 210 or 1024 seconds.

    • The logging_level parameter controls the amount of logging information that ptp4l records. The default value of logging_level is 6, which corresponds to LOG_INFO. To turn off logging completely, set the value of logging_level to 0. Alternatively, specify the -q option to ptp4l.

    For more information, see the ptp4l(8) manual page.

  3. Configure the system firewall to allow access by PTP event and general messages to UDP ports 319 and 320, for example:

    # iptables -I INPUT -p udp -m udp --dport 319 -j ACCEPT
    # iptables -I INPUT -p udp -m udp --dport 320 -j ACCEPT
    # service iptables save
  4. Start the ptp4l service and configure it to start following a system reboot.

    # service ptp4l start
    # chkconfig ptp4l on
  5. To configure phc2sys on a clock system that uses hardware time stamping:

    1. Edit /etc/sysconfig/phc2sys and define the start-up options for the phc2sys daemon.

      On a boundary clock or slave clock, synchronise the system clock with the PTP hardware clock that is associated with the slave network interface, for example:

      OPTIONS="-c CLOCK_REALTIME -s em1 -w"
      Note

      The slave network interface on a boundary clock is the one that it uses to communicate with the grandmaster clock.

      The -w option specifies that phc2sys waits until ptp4l has synchronised the PTP hardware clock before attempting to synchronise the system clock.

      On a grandmaster clock, which derives its system time from a reference time source such as GPS, CDMA, NTP, or a radio time signal, synchronise the network interface's PTP hardware clock from the system clock, for example:

      OPTIONS="-c em1 -s CLOCK_REALTIME -w"

      For more information, see the phc2sys(8) manual page.

    2. Start the phc2sys service and configure it to start following a system reboot.

      # service phc2sys start
      # chkconfig phc2sys on

You can use the pmc command to query the status of ptp4l operation. The following example shows the results of running pmc on a slave clock system that is directly connected to the grandmaster clock system without any intermediate boundary clocks:

# pmc -u -b 0 'GET TIME_STATUS_NP'
sending: GET TIME_STATUS_NP
	080027.fffe.7f327b-0 seq 0 RESPONSE MANAGEMENT TIME_STATUS_NP 
		master_offset              -98434
		ingress_time               1412169090025854874
		cumulativeScaledRateOffset +1.000000000
		scaledLastGmPhaseChange    0
		gmTimeBaseIndicator        0
		lastGmPhaseChange          0x0000'0000000000000000.0000
		gmPresent                  true
		gmIdentity                 080027.fffe.d9e453
# pmc -u -b 0 'GET CURRENT_DATA_SET'
sending: GET CURRENT_DATA_SET
	080027.fffe.7f327b-0 seq 0 RESPONSE MANAGEMENT CURRENT_DATA_SET 
		stepsRemoved     1
		offsetFromMaster  42787.0
		meanPathDelay    289207.0

Useful information in this output includes:

gmIdentity

The unique identifier of the grandmaster clock, which is based on the MAC address of its network interface.

gmPresent

Whether an external grandmaster clock is available. This value is displayed as false on the grandmaster clock itself.

meanPathDelay

An estimate of how many nanoseconds by which synchronization messages are delayed.

offsetFromMaster

The most recent measurement of the time difference in nanoseconds relative to the grandmaster clock.

stepsRemoved

The number of network steps between this system and the grandmaster clock.

For more information, see the phc2sys(8), pmc(8), and ptp4l(8) manual pages, http://www.zhaw.ch/en/engineering/institutes-centres/ines/downloads/documents.html, and IEEE 1588.