How can I set up a simple PTP timing network

This recipe will provide a step-by-step guide to setting up a primary timing network using Timebeat software. This process aims to create your PTP timing networks using the steps learned in this recipe and tailor them to your needs.

Problem:

You want to be able to set up a PTP grandmaster and have downstream servers talk PTP and synchronise to the UTC source. 

Ingredients (the minimum required items)

  • A source of UTC

  • A device operating as a PTP grandmaster

  • A Local Area Network

  • A device operating as a PTP slave

  • Wireshark (tshark) - optional

Total Prep time: 15 mins, Total Cook time: 15 mins

 

In this recipe, we will use a GPS antenna connected to a Timebeat Grandmaster Clock (G0kK-1) and Timebeat software.

Step 1:

Connect the GNSS antenna to the Grandmaster

 

Step 2:

Connect an ethernet cable to the appropriate network port (in this case, we are connecting to ens1).

Step 3:

SSH or log into your grandmaster to configure the PTP feed. For Timebeat software and grandmasters, we SSH to the console and then access the config file:

LINUX:

root@gm01 ~]# vi /etc/timebeat/timebeat.yml

WINDOWS:

Open up the timebeat.yml file using Notepad or similar from your installation directory (typically recommended program files --> Timebeat....)

Step 4:

(All amended fields are highlighted)

We will want to set up our PTP domain. For now, we will stick to the default of 0.

We then need to choose Unicast PTP distribution or Multicast. For this recipe, we will use multicast. 

So we uncomment (remove the # from the start of the line) line 32

We will want to ensure that this device operates solely as a grandmaster

So we uncomment line 33

Lastly, we want to ensure PTP is delivered from the correct interface.
As we already cabled up interface ens1, let's place that into the config.

For this, we uncomment line 44 and modify the interface name to read ens1 

       
27 # PTP Config example
28      - protocol:                 ptp
29        domain:                   0
30        #serve_unicast:           true
31        #max_unicast_subscribers: 0
32        serve_multicast:         true
33        server_only:             true
34        announce_interval:        1
35        sync_interval:            0
36        delayrequest_interval:    0
37        #unicast_master_table:    ['1.2.3.4','2.3.4.5', '3.4.5.6']
38        #delay_strategy:          e2e   # other options which can be used are: 'p2p'
39        #hybrid_e2e:              false # Send delay requests as unicast (enterprise profile)
40        #priority1:               128
41        #priority2:               128
42        #monitor_only:            false
43        #use_layer2:              false      # Use ptp over ethernet instead of IP/UDP
44        interface:               ens1
45        #profile:                 'G.8275.2' # other options which can be used are: 'G.8275.1', 'G.8265.1' and 'enterprise-draft'
46        #logsource:               'Grandmaster Clock in NY4' # configurable name for source included in all logging records for source
47        #asymmetry_compensation:  0 # In nanoseconds. Static compensation for know asymmetry (+/- as the case maybe)
48        #max_packets_per_second:  0 # If inbound packet rate exceeds this a WRED algorithm is used

 

Step 6:

Now we will configure the source of UTC for the Grandmaster. In this case, we are using a Timebeat G0kK-1 grandmaster so we scroll down in the config file to the PPS section 

So for this, we will uncomment every line from lines 73 - 80

We want to make sure PPS is configured to the correct interface. In this case, it is ens1, so line 74 gets changed to ens1

In the G0kK-1, it is essential to note PPS is delivered over Pin 1 and index 1, so we modify that on lines 75 & 76 

       
72  # 1 Pulse-per-second input config example. 1-PPS out can be configured using Timebeat CLI
73      - protocol:     pps
74        interface:    ens1
75        pin:          1
76        index:        1
77        cable_delay:  0          # Cable delay in nanoseconds (odds are ~5 ns per meter is a good value)
78        edge_mode:    "rising"   # PPS event trigger for older cards. Options are "rising", "falling" or "both"
79        monitor_only: false
80        utc_offset:   37         # If TAI or similar UTC offset add here (only meaningful is phc_as_tai enabled)

 

It is important to note that at this stage, PPS only provides minor time, so we need to configure our secondary source to be an NMEA source to provide the Grandmaster with major time.

This step is super simple: all you need to do is uncomment lines 144-148; no changes are necessary.

141   # Other vendor specific GNSS receivers input config example (can provide majortime for PPS sources)
142      # Eight data bits, no parity bit, and one stop bit (8N1) is assumed
143      # (It is not recommended to configure a Mini-JLT source if you have an alternative secondary source)
144      - protocol:     timecard-mini  # "mini-jlt" (Jackson Labs) is also an option
145        device:       '/dev/serial0' # Serial device path
146        baud:         9600         # Serial device baud rate
147        offset:       0              # Static offset of RMC line
148        monitor_only: false

Once complete just save the config and quit. (if using vi, the below command will do the trick).

:wq!

Step 7:

Now, we start the service using the standard commands

LINUX:

root@gm01 ~]# systemctl start timebeat

WINDOWS:

The easiest method in Windows is to open the Task Manager, select Processes, find Timebeat in the list, right-click, and select Start.

 

Step 8 - Optional:

Let's check to see if PTP is leaving the correct interface. For this, we will just run a quick shark command (provided by Wireshark, Linux. If you do not have this, just run "dnf install Wireshark-1:3.6.2-1.fc36.x86_64 - y" or alternatively run "dnf provides wireshark" and select the appropriate package from the list.

[root@gm01 ~]# tshark -i ens1 port 319 or port 320

Note that -i represents interface, and ens1 is the interface we wish to check

We should see output like the below:

 

[root@gm01 ~]# tshark -i ens1 port 319 or port 320
Capturing on 'ens1'
** (tshark:35277) 17:10:22.266280 [Main MESSAGE] -- Capture started.
** (tshark:35277) 17:10:22.266340 [Main MESSAGE] -- File: "/var/tmp/wireshark_ens1xgePUf.pcapng"
1 0.000000000 10.101.103.31 → 224.0.1.129 PTPv2 106 Announce Message
2 0.008392124 10.101.103.31 → 224.0.1.129 PTPv2 86 Sync Message
3 0.015557624 10.101.103.31 → 224.0.1.129 PTPv2 86 Sync Message
4 0.015636935 10.101.103.31 → 224.0.1.129 PTPv2 86 Follow_Up Message
5 0.023994680 10.101.103.31 → 224.0.1.129 PTPv2 86 Sync Message
6 0.024078860 10.101.103.31 → 224.0.1.129 PTPv2 86 Follow_Up Message
7 0.031399504 10.101.103.31 → 224.0.1.129 PTPv2 86 Sync Message
8 0.031464042 10.101.103.31 → 224.0.1.129 PTPv2 86 Follow_Up Message
9 0.039642671 10.101.103.31 → 224.0.1.129 PTPv2 86 Sync Message

 

Step 9:

Now, we will configure the slave device to receive PTP and synchronise towards.

For this, we repeat Step 3 but using the details of the new device: 

SSH or log into your receiving device to configure the PTP feed to be received. For Timebeat software and grandmasters, we SSH to the console and then access the config file:

LINUX:

root@localhost ~]# vi /etc/timebeat/timebeat.yml

WINDOWS:

Open up the timebeat.yml file using Notepad or similar from your installation directory (typically recommended program files --> Timebeat....)

Step 10:

(All amended fields are highlighted)

We want to match the grandmaster's PTP configuration on the receiving device.

We will want to set up our PTP domain. For now, we will stick to the default of 0, as this is also what our grandmaster has.

So, all we need to amend here is the interface.

For this, we uncomment line 44 and modify the interface name to read ens1

 

       
27 # PTP Config example
28      - protocol:                 ptp
29        domain:                   0
30        #serve_unicast:           true
31        #max_unicast_subscribers: 0
32        #serve_multicast:         true
33        #server_only:             true
34        announce_interval:        1
35        sync_interval:            0
36        delayrequest_interval:    0
37        #unicast_master_table:    ['1.2.3.4','2.3.4.5', '3.4.5.6']
38        #delay_strategy:          e2e   # other options which can be used are: 'p2p'
39        #hybrid_e2e:              false # Send delay requests as unicast (enterprise profile)
40        #priority1:               128
41        #priority2:               128
42        #monitor_only:            false
43        #use_layer2:              false      # Use ptp over ethernet instead of IP/UDP
44        interface:               ens1
45        #profile:                 'G.8275.2' # other options which can be used are: 'G.8275.1', 'G.8265.1' and 'enterprise-draft'
46        #logsource:               'Grandmaster Clock in NY4' # configurable name for source included in all logging records for source
47        #asymmetry_compensation:  0 # In nanoseconds. Static compensation for know asymmetry (+/- as the case maybe)
48        #max_packets_per_second:  0 # If inbound packet rate exceeds this a WRED algorithm is used

 

Once complete just save the config and quit. (if using vi the below command will do the trick).

:wq!

 

Step 11:

Now, we start the service using the standard commands

LINUX:

root@gm01 ~]# systemctl start timebeat

WINDOWS:

The easiest method in Windows is to open the Task Manager, select Processes, find Timebeat in the list, right-click, and select Start.

 

Step 12 - Optional:

Let's check to see if PTP is arriving on the correct interface. For this, we will just run a quick tshark command identical to Step 7

[root@fedora ~]# tshark -i ens1 port 319 or port 320

note that -i represents interface, and ens1 is the interface we wish to check

We should see output like the below:

[root@fedora ~]# tshark -i ens1 port 319 or port 320

 

And that is a completed PTP timing network. Now, all that is left is to investigate the performance.

Check out our following recipe for setting up a monitoring solution and dashboard environment.