Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Building a Stratum 1 NTP Server Using Raspberry Pi

    Scheduled Pinned Locked Moved Off-Topic & Non-Support Discussion
    57 Posts 9 Posters 30.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • johnpozJ
      johnpoz LAYER 8 Global Moderator @kiokoman
      last edited by johnpoz

      That is same same pi make and model. Same setup just the difference in the hats?

      Wow - something seems off there.. I can see why your interested now..

      What specific pi? And what specific hat? Maybe I will order one ;)

      An intelligent man is sometimes forced to be drunk to spend time with his fools
      If you get confused: Listen to the Music Play
      Please don't Chat/PM me for help, unless mod related
      SG-4860 24.11 | Lab VMs 2.8, 24.11

      kiokomanK 1 Reply Last reply Reply Quote 0
      • kiokomanK
        kiokoman LAYER 8 @johnpoz
        last edited by

        @johnpoz
        yes both are raspberry pi 4 with 4gb same debian but different hat

        ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
        Please do not use chat/PM to ask for help
        we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
        Don't forget to Upvote with the 👍 button for any post you find to be helpful.

        johnpozJ 1 Reply Last reply Reply Quote 0
        • johnpozJ
          johnpoz LAYER 8 Global Moderator @kiokoman
          last edited by johnpoz

          What are you using to graph that like that? I would be up for getting a pi4 and the same hat to test.. Always up for fun projects ;)

          Trying to find an excuse to get a 4 ;) hehehe

          You seem to be pretty for out on the same hat I have, your ublox

               remote                                   refid      st t when poll reach   delay   offset   jitter
          =======================================================================================================
          *SHM(1)                                  .PPS.            0 l    2   16  377   0.0000  -0.3426   0.0026
          

          Is the hat you got.. You had to solder?
          https://www.adafruit.com/product/2324

          An intelligent man is sometimes forced to be drunk to spend time with his fools
          If you get confused: Listen to the Music Play
          Please don't Chat/PM me for help, unless mod related
          SG-4860 24.11 | Lab VMs 2.8, 24.11

          kiokomanK 1 Reply Last reply Reply Quote 0
          • kiokomanK
            kiokoman LAYER 8 @johnpoz
            last edited by kiokoman

            @johnpoz
            that is telegraf sending to grafana
            grafana sitting on another raspberry ..
            https://www.adafruit.com/product/2324
            https://www.waveshare.com/max-m8q-gnss-hat.htm

            adafruit need soldering this but it's easy
            6567a574-19cb-40db-ac99-187a918ee3d8-immagine.png

            ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
            Please do not use chat/PM to ask for help
            we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
            Don't forget to Upvote with the 👍 button for any post you find to be helpful.

            stephenw10S 1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator @kiokoman
              last edited by

              Are those values actually in milliseconds or is it microseconds and just mislabeled?

              Steve

              kiokomanK 1 Reply Last reply Reply Quote 0
              • kiokomanK
                kiokoman LAYER 8 @stephenw10
                last edited by

                @stephenw10
                the values from ntpq afaik is milliseconds ?

                ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
                Please do not use chat/PM to ask for help
                we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
                Don't forget to Upvote with the 👍 button for any post you find to be helpful.

                stephenw10S 1 Reply Last reply Reply Quote 0
                • stephenw10S
                  stephenw10 Netgate Administrator @kiokoman
                  last edited by

                  Yes, it reads in milliseconds but that can get confusing when is shows a value like 0.001 (1μs).

                  Values in microseconds are what you should expect if PPS is working.

                  Less than 1μs is impressive. I generally see between 1-2μs here.

                  Steve

                  1 Reply Last reply Reply Quote 0
                  • Q
                    q54e3w @kiokoman
                    last edited by

                    @kiokoman said in Building a Stratum 1 NTP Server Using Raspberry Pi:

                    and it drift up and down very mutch during the day compare to the adafruit

                    Is your device thermally stable, without some kind of TCXO its likely drift. I see fluctuations around 11am to 4pm as the sun hits the room where my timing hardware is located. Temperature corrected devices are unaffected.

                    Also, different drivers are very likely to introduce different levels of performance so try and ensure you are using same drivers (type 22 PPS vs SHM type 28 etc).

                    kiokomanK 1 Reply Last reply Reply Quote 0
                    • kiokomanK
                      kiokoman LAYER 8 @q54e3w
                      last edited by kiokoman

                      yeah, i'm using only type 20 and type 22
                      but i think i was finally able to find a configuration that suits it

                      http://www.philrandal.co.uk/blog/archives/04-01-2019_04-30-2019.html
                      with some minor adjustment

                      Immagine.jpg
                      Immagine2.jpg

                      ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
                      Please do not use chat/PM to ask for help
                      we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
                      Don't forget to Upvote with the 👍 button for any post you find to be helpful.

                      1 Reply Last reply Reply Quote 2
                      • kiokomanK
                        kiokoman LAYER 8 @tman222
                        last edited by kiokoman

                        @tman222

                        I'll answer your question about nohz
                        it does not work on raspberry pi 4 + raspbian
                        the kernel isn't configured to allows the nohz parameter to work
                        also, I found that you can only use
                        flag 3 0 (use the ntpd clock discipline)
                        and not
                        flag 3 1 (use the kernel discipline)
                        for PPS
                        if you try to use flag 3 1 you see in the syslog this:

                        refclock_params: time_pps_kcbind: Operation not supported
                        

                        this is because the kernel is compiled without CONFIG_NTP_PPS

                        Immagine.jpg

                        obviusly
                        as a good nerd I recompiled ... 😑

                        this is ublox now

                        server 127.127.20.0 mode 89 iburst prefer minpoll 2 maxpoll 4
                        fudge 127.127.20.0 flag1 1 flag3 1 time1 0.0 time2 0.025 refid GPS
                        
                        pi@raspberrypi3:~/linux $ uname -a
                        Linux raspberrypi3 4.19.118-v7lntp+ #1 SMP Fri Dec 11 14:42:08 CET 2020 armv7l GNU/Linux
                        
                        pi@raspberrypi3:~/linux $ ntpq -crv -pn
                        status=041d leap_none, sync_uhf_radio, 1 event, kern,
                        version="ntpd ntpsec-1.1.3 2019-11-18T06:04:00Z", processor="armv7l", system=" Linux/4.19.118-v7lntp+", leap=00, stratum=1, precision=-20, rootdelay=0.0, rootdisp=2.18, refid=GPS, reftime=e37e600c.8bd6769d 2020-12-11T21:15:56.546Z,
                        clock=e37e6018.d0a57250 2020-12-11T21:16:08.815Z, peer=11020, tc=4, mintc=0, offset=7.8e-05, frequency=-18.907623, sys_jitter=0.000277, clk_jitter=0.000728, clk_wander=0.001816, tai=37, leapsec="2017-01-01T00:00Z",
                        expire="2021-06-28T00:00Z"
                             remote                                   refid      st t when poll reach   delay   offset   jitter
                        =======================================================================================================
                        oNMEA(0)                                 .GPS.            0 l   12   16  377   0.0000   0.0001   0.0003
                        

                        Immagine.jpg

                        ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
                        Please do not use chat/PM to ask for help
                        we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
                        Don't forget to Upvote with the 👍 button for any post you find to be helpful.

                        1 Reply Last reply Reply Quote 0
                        • S
                          sagliklihayatimiz Banned
                          last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • T
                            tman222
                            last edited by

                            Hi all -

                            Wanted to follow up on this thread as I recently acquired a Stratum 1 NTP server for my network (LeoNTP - very cool little device). Currently, I have it setup as the only NTP time server on pfSense (i.e. no other servers are configured). Is this an acceptable setup, or should I be adding a few additional public Stratum 1 servers as a sanity check, and set the LeoNTP device as the preferred server? I realize with just one server I don't have any redundancy, but is that the only main drawback? Thanks in advance!

                            kiokomanK Q 2 Replies Last reply Reply Quote 0
                            • kiokomanK
                              kiokoman LAYER 8 @tman222
                              last edited by kiokoman

                              @tman222
                              if I remember correctly you need at least 3 good ntp server on the list to see if the leontp is working correctly
                              without any reference you don't know if the time is correct

                              ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
                              Please do not use chat/PM to ask for help
                              we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
                              Don't forget to Upvote with the 👍 button for any post you find to be helpful.

                              1 Reply Last reply Reply Quote 0
                              • Q
                                q54e3w @tman222
                                last edited by

                                @tman222 I run a few Pi based GPS devices that don't offer the same accuracy, and a few external sources for backup. The LeoNTP takes precedence as primary source of time due to its accuracy.

                                1 Reply Last reply Reply Quote 0
                                • T
                                  tman222
                                  last edited by

                                  Thanks @kiokoman and @q54e3w, I really appreciate the help and advice. Do either of you use the "prefer" keyword on your local NTP server(s), or do you leave the server choice solely to the selection algorithm? Thanks again.

                                  kiokomanK 1 Reply Last reply Reply Quote 0
                                  • kiokomanK
                                    kiokoman LAYER 8 @tman222
                                    last edited by

                                    @tman222
                                    this is my config for the ublox

                                    server 127.127.20.0 mode 89 iburst prefer minpoll 2 maxpoll 4
                                    fudge 127.127.20.0 flag1 1 flag3 1 time1 0.0 time2 0.025 refid GPS
                                    
                                    tos mindist 0.060
                                    
                                    server 192.168.10.200
                                    server 151.3.106.211
                                    server ntp1.inrim.it
                                    server ntp2.inrim.it
                                    pool 0.it.pool.ntp.org
                                    pool 1.it.pool.ntp.org
                                    

                                    this is the results

                                    remote                          refid      st t when poll reach   delay   offset   jitter
                                    ========================================================================================
                                    oNMEA(0)                        .GPS.            0 l   11   16  377   0.0000   0.0002   0.0003
                                    +192.168.10.200                 .GPS.            1 u   42   64  377   0.0996  -0.0002   0.0149
                                    +151.3.106.211                  .GPS.            1 u   40   64  377  24.2144   0.1478   0.9674
                                    -193.204.114.232                .CTD.            1 u   59   64  377  25.2698  -4.7052   0.3729
                                    +193.204.114.233                .CTD.            1 u   49   64  377  12.5229   0.0942   0.3967
                                     0.it.pool.ntp.org              .POOL.          16 p    -  256    0   0.0000   0.0000   0.0010
                                     1.it.pool.ntp.org              .POOL.          16 p    -  256    0   0.0000   0.0000   0.0010
                                    -37.247.53.178                  193.204.114.233  2 u   57   64  377  11.9465   1.0424   0.6543
                                    -162.159.200.123                10.20.14.167     3 u   37   64  377  25.2151   0.8878   0.4707
                                    +212.45.144.206                 193.204.114.232  2 u    9   64  377  10.5258   0.5104   0.3046
                                    

                                    2bec0572-bb2b-4b3f-bb7e-f9ea25d706d3-image.png

                                    ̿' ̿'\̵͇̿̿\з=(◕_◕)=ε/̵͇̿̿/'̿'̿ ̿
                                    Please do not use chat/PM to ask for help
                                    we must focus on silencing this @guest character. we must make up lies and alter the copyrights !
                                    Don't forget to Upvote with the 👍 button for any post you find to be helpful.

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post
                                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.