phc2sys: uds: sendto failed: Connection refused

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux (RHEL) 6.5
  • linuxptp-1.3-1.el6.x86_64

Issue

  • The sever is using PTP (Precision Time Protocol) to synchronize clocks.
  • There are errors when phc2sys is run:
[root@server ~]# phc2sys -s eth2 -w
Nov 28 21:17:09 server phc2sys: [20696.522] uds: sendto failed: Connection refused
Nov 28 21:17:09 server phc2sys: [20696.522] failed to send message
Nov 28 21:17:10 server phc2sys: [20697.523] Waiting for ptp4l...
Nov 28 21:17:10 server phc2sys: [20697.523] uds: sendto failed: Connection refused
Nov 28 21:17:10 server phc2sys: [20697.523] failed to send message

Resolution

  • Check if ptp4l is running and synchronizing properly.
  • If the sender and the receiver are not in the same subnet network, either disable Reverse Path Filtering
    (sysctl rp_filter) or insert a static route to make sure the UDP multicast packet's reply goes out through
    the same interface used when it came in.

Root Cause

  • phc2sys acquires the offset value by reading it from ptp4l when -w is used.

Diagnostic Steps

  • To reproduce, stop ptp4l:
[root@ ~]# service ptp4l stop
Stopping ptp4l:                                            [  OK  ]
  • Then run phc2sys:
[root@ ~]# phc2sys -w  -s eth0 -m
phc2sys[151560.212]: uds: sendto failed: Connection refused
phc2sys[151560.212]: failed to send message
phc2sys[151561.213]: Waiting for ptp4l...
phc2sys[151561.214]: uds: sendto failed: Connection refused
phc2sys[151561.214]: failed to send message
phc2sys[151562.215]: Waiting for ptp4l...
phc2sys[151562.215]: uds: sendto failed: Connection refused
phc2sys[151562.215]: failed to send message
  • Then, enable ptp4l wait to minutes and it should work:
[root@ ~]# service ptp4l start
Starting ptp4l:                                            [  OK  ]
[root@ ~]# phc2sys -w  -s eth0 -m
phc2sys[151863.523]: Waiting for ptp4l...
phc2sys[151864.523]: sys offset      3014 s0 freq      +0 delay   4742
phc2sys[151865.523]: sys offset      -298 s1 freq  +36157 delay   4772
phc2sys[151866.524]: sys offset      7785 s2 freq  +43942 delay   4762
phc2sys[151867.524]: sys offset      8454 s2 freq  +46946 delay   4694
phc2sys[151868.524]: sys offset      9000 s2 freq  +50028 delay   4712
  • Also check if /proc/sys/net/ipv4/conf/*/rp_filter is enabled
  • if yes, then check if the packet source IP address causes its reply to go through another interface different from the one used when it was received

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments