Menu

PTP - unicast from MASTER to sync SLAVE(s)?

Help
Anonymous
2011-08-06
2012-11-23
  • Anonymous

    Anonymous - 2011-08-06

    Hi,

    I've been using PTP to sync time on a 10 servers that are not on the same LAN and are located on a different locations.

    So, I use a MASTER PTP srv. + 10 SLAVE servers. On each SLAVE I have an PTP deamon running, while on the MASTER I have a 10 PTP deamons running (one for every SLAVE). The reason why I'm doing this is that I can't allow multicast packets to be sent form the MASTER, so I run one PTP deamon for every slave with the "-u IP" (send multicast to IP) option (the same parametars is used on the SLAVEs also - no multicast).

    I am wondering if I can set up PTP synchronization like this? Is it possible to run serveral PTP deamons on the same server (maybe there will be a problem with interefering or something?)?

    On the MASTER I run PTP deamons with the followind options:
    /home/user/ptp/ptpd2 -T0 -b eth0 -h -u <IP_ADDR_Slave1>
    /home/user/ptp/ptpd2 -T0 -b eth0 -h -u <IP_ADDR_Slave2>

    /home/user/ptp/ptpd2 -T0 -b eth0 -h -u <IP_ADDR_SlaveN>

    , and on the slaves:
    /home/user/ptp/ptpd2 -T0 -D -g -b eth0 -h -u <IP_ADDR_MASTER> -f /home/user/PTP_Test_Log.txt

    I've also used the -T0 option to set multicast TTL to zero. Is this ok?

    I have one more question :) ..I use an application that monitors the One-way Trip Time, Round-Trip-Time, packet loss and several other parameters on the SLAVE servers. Since it uses local clock to measure the forementioned parameters, the clocks must be precisely synced.

    So far, everything works fine. There is just one thing that bugs me - the OTT is pretty constant over time (PTP greatly improves precision of the monitoring over NTP sychronization). However, recently I just killed the PTP deamon on the SLAVEs (just to turn off the logging) and turned it on immediately. A significant change in OTT from one SLAVE to another was shown (range about few ms) -> for example, OTT from SLAVE1 to SLAVE2 was decreased, and OTT from SLAVE2 to SLAVE1 was increased. Does anybody have an idea why would this happen? Shouldn't the value of OTT remain constant if the PTP was swiched off/on? I'm guessing that something went wrong with the synchronization?

    Maybe I should turn off the process on the MASTER aswell? What is the correct procedure for resetting the whole PTP synchronization? Maybe this configuration can't be used (running several PTP deamons on the MASTER?)?

    I would appriciate any info, ideas, etc. This thing have been bugging me for a while and I can't find myself an reasonable explanation. Nevertheless, I am very satisfied how the PTP works, great improvement over NTP.

    Thanks in advance :)

     
  • Anonymous

    Anonymous - 2012-11-15

    It seems even if you use "-u" flag, upon further inspection of packets the message is sent using multicast. 

    I am able to use ptpd2 server in unicast mode with ptp client only supporting unicast messages.

    Here are changes made to support unicast in file  /ptpd-2.2.2/src/dep/msg.c :

            //Nibble transport = 0x80;
            Nibble transport = 0x00;

            //unicast supp
            *(UInteger8 *) (buf + 7) = 0x02; //PTP_UNICAST;

    recompile code and should work in unicast mode.

    Cheers,

     
  • Anonymous

    Anonymous - 2012-11-15

    Here is updated header code in msg.c file:

    /*Pack header message into OUT buffer of ptpClock*/
    void
    msgPackHeader(Octet * buf, PtpClock * ptpClock)
    {

            //Nibble transport = 0x80;
            Nibble transport = 0x00;

            /* (spec annex D) */
            *(UInteger8 *) (buf + 0) = transport;
            *(UInteger4 *) (buf + 1) = ptpClock->versionNumber;
            *(UInteger8 *) (buf + 4) = ptpClock->domainNumber;

            /* TODO: this bit should have been active only for sync and PdelayResp */
            if (ptpClock->twoStepFlag)
                    *(UInteger8 *) (buf + 6) = 0x04; //PTP_TWO_STEP;
            //Unicast Supp
            *(UInteger8 *) (buf + 7) = 0x02; //PTP_UNICAST;

            memset((buf + 8), 0, 8);
            copyClockIdentity((buf + 20), ptpClock->portIdentity.clockIdentity);
            *(UInteger16 *) (buf + 28) = flip16(ptpClock->portIdentity.portNumber);
            *(UInteger8 *) (buf + 33) = 0x7F;
            /* Default value(spec Table 24) */
    }

     

Log in to post a comment.