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

    NTP: a Windows PC can't get time from pfSense. Other devices are okay.

    Scheduled Pinned Locked Moved Firewalling
    20 Posts 4 Posters 867 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.
    • Y
      youngy
      last edited by

      One of my devices (a Surface Pro running Windows 11) can’t get the time from my home network (it works fine at work). I get an error when it tries to do so. The PC is attached to the network by Wifi at home and at work.

      I use a Netgate 2100 with pfSense+ 24.11, which is connected to a Unifi switch. I have three access points and a cloudkey all connected to the same Unifi switch. There are several vlans. All my other devices seem to work okay (a wired Mac, speakers (wired and Wifi), and various phones etc).

      48af896f-b868-457c-8b86-25878a9096c6-image.png

      I use a NAT redirect to point devices to the firewal (192.168.40.44 is the device in question):

      8f59d0fb-bd78-49e9-8621-deae0294aed6-image.png

      which seems to work:

      95829e75-1a83-4932-a013-ce2e05a2f152-image.png

      A packet capture shows this:

      ebcdf72d-3620-412a-bcd3-d6afc3d9d2c7-image.png

      I've tried setting the time server on the PC as pfSense, but it doesn't work like that either.

      I use pfBlocker but presume it doesn’t matter when the device is getting the time from the firewall.

      I ran a search here and on the wider internet but couldn't find an answer. Altough the problem suggests to me that it's a Windows issue, I’m not sure how to go about troubleshooting. This is the only machine on my network running Windows and I'm quite unfamiliar with it as an operating system.

      Can anyone advise on how to proceed from here?

      GertjanG M johnpozJ 3 Replies Last reply Reply Quote 0
      • GertjanG
        Gertjan @youngy
        last edited by Gertjan

        @youngy said in NTP: a Windows PC can't get time from pfSense. Other devices are okay.:

        One of my devices (a Surface Pro running Windows 11) can’t get the time from my home network (it works fine at work). I get an error when it tries to do so. The PC is attached to the network by Wifi at home and at work.

        I use a Netgate 2100 with pfSense+ 24.11, which is connected to a Unifi switch. I have three access points and a cloudkey all connected to the same Unifi switch. There are several vlans. All my other devices seem to work okay (a wired Mac, speakers (wired and Wifi), and various phones etc).

        Your Surface connects to an AP using its SSID, and this AP is connected to the Unifi switch, which is connected to the pfSense, on the WAN interface ??

        Also, a question : does the NTP server listens on the WAN interface ? Maybe it does, I'm not sure, you better check that.

        Try this : hook up your PC t the pfSense LAN interface.
        tell the PC that its NTP source is "192.168.1.1".
        That's why I do. Tested and works.
        Just do the test to be sure that this isn't a "PC" issue.

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        Y 1 Reply Last reply Reply Quote 0
        • M
          mer @youngy
          last edited by

          @youngy Is Windows really using NTP? I've seen stuff in the past where it's not really using NTP but some variant.

          Not sure if my understanding is relevant, it's just something I remember

          GertjanG 1 Reply Last reply Reply Quote 0
          • GertjanG
            Gertjan @mer
            last edited by

            @mer said in NTP: a Windows PC can't get time from pfSense. Other devices are okay.:

            Is Windows really using NTP? I've seen stuff in the past where it's not really using NTP but some variant.

            It is.

            d5ea35d7-711f-4fc3-99ae-393885f96683-image.png

            and I have the packet capture to proof it 😊

            No "help me" PM's please. Use the forum, the community will thank you.
            Edit : and where are the logs ??

            1 Reply Last reply Reply Quote 1
            • Y
              youngy @Gertjan
              last edited by

              Gertjan,
              Thanks for helping.

              @Gertjan said in NTP: a Windows PC can't get time from pfSense. Other devices are okay.:

              Your Surface connects to an AP using its SSID, and this AP is connected to the Unifi switch, which is connected to the pfSense, on the WAN interface ??

              Yes, the APs are connected to the Unifi switch, which is connected to LAN. The VLANs are setup on pfSense and are set up the same in the Unifi controller (IIRC I followed a Lawrence Systems video when I first set up the 2100 about 5 years ago).

              Also, a question : does the NTP server listens on the WAN interface ? Maybe it does, I'm not sure, you better check that.

              These are the NTP settings (no interface selected - I think that's the default).

              941470b3-7458-4d92-bd00-31c1898b5c8f-image.png

              Try this : hook up your PC t the pfSense LAN interface.
              tell the PC that its NTP source is "192.168.1.1".
              That's why I do. Tested and works.
              Just do the test to be sure that this isn't a "PC" issue.

              As suggested, I attached the PC directly to pfSense LAN (wired), but the PC still didn't get the time.

              GertjanG 1 Reply Last reply Reply Quote 0
              • GertjanG
                Gertjan @youngy
                last edited by

                @youngy said in NTP: a Windows PC can't get time from pfSense. Other devices are okay.:

                I attached the PC directly

                and you set manually :

                8335fc42-42e8-4494-befc-870261a5c4b9-image.png

                Btw : even if you tell the DHCPv4 and or DHCPv6 server ton hand over an NTOP source (server = pfSense), like this :

                3b9ffd26-3616-4fdb-b54b-1e367c2e3f17-image.png

                you'll discover that Microsoft devices don't ask for it, and not using the suggestion it found in the DHCP lease.
                This is one of the rare settings you have to do for every Microsoft device, if you want it to pfSense as time source. Which is optional, of course, as the default time.Microsoft.com (can't remember what is in there when you install Windows) will work just fine.

                With the default LAN firewall rules Netgate put into the LAN, NTP works fine.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                Y 1 Reply Last reply Reply Quote 1
                • Y
                  youngy @Gertjan
                  last edited by

                  Yes, I set the time server as shown above.

                  I've just set the time server on Windows to pool.ntp.org. If I connect the PC to my phone hotspot and my phone is on celluar service, the time syncs immediately. When I reconnect the PC to my wifi it fails to sync even though it's allowed to the firewall:

                  d8113702-e7aa-43f4-86a5-99e952fc9f83-image.png

                  I've tried providing different NTP servers in DHCP for the interface but that hasn't worked either. I'm a bit baffled about what to try next. Any suggestions would be appreciated.

                  johnpozJ GertjanG 3 Replies Last reply Reply Quote 0
                  • johnpozJ
                    johnpoz LAYER 8 Global Moderator @youngy
                    last edited by johnpoz

                    @youngy how about just pointing to the IP vs trying to redirect it.

                    What part did you not get about windows not using ntp handed out by dhcp?

                    Personally I hate the time sync built into windows, and just use the actual ntp client

                    C:\Windows\system32>ntpq
                    ntpq> pe
                         remote           refid      st t when poll reach   delay   offset  jitter
                    ==============================================================================
                    *ntp.home.arpa   .PPS.            1 u   51  128  377    0.752   +0.019   0.194
                    ntpq>
                    

                    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.7.2, 24.11

                    1 Reply Last reply Reply Quote 0
                    • GertjanG
                      Gertjan @youngy
                      last edited by

                      @youngy

                      Go to basic mode first.

                      Unselect everything :

                      and restart NTPd.

                      Then check in which ports its listening :

                      [24.11-RELEASE][root@pfSense.bhfr.tld]/root: sockstat -4 | grep '123'
                      root     ntpd       44699 21  udp4   *:123                 *:*
                      root     ntpd       44699 23  udp4   192.168.1.1:123       *:*
                      root     ntpd       44699 27  udp4   192.168.2.1:123       *:*
                      root     ntpd       44699 29  udp4   192.168.100.1:123     *:*
                      root     ntpd       44699 31  udp4   192.168.10.4:123      *:*
                      root     ntpd       44699 35  udp4   127.0.0.1:123         *:*
                      root     ntpd       44699 36  udp4   10.10.10.1:123        *:*
                      

                      These are all my known interfaces, port 123, UDP.

                      Then check the LAN firewall rules :

                      17265348-37da-4986-8946-86a67182210a-image.png

                      The first rule is a NUT NAT rule, very comparable to what you try to achieve.
                      But, as NTP listens to your LAN interface, why NATting it to 127.0.0.1 ?
                      NUT listens by default to 127.0.0.1 so the NAT is a solution.

                      The other two IPv4 and IPv6 rules are tested and work. because your pfSense was delivered to you with these two rules.

                      Between your PC and pfSense, removing everything else. a dumb "no options" switch is allowed of course.

                      Did you packet capture the LAN interface ?
                      You know the IP of the PC, the port used (123) and the protocol, UDP. Thats enough to check what arrives at pfSense.

                      No "help me" PM's please. Use the forum, the community will thank you.
                      Edit : and where are the logs ??

                      1 Reply Last reply Reply Quote 0
                      • GertjanG
                        Gertjan @youngy
                        last edited by

                        @youngy said in NTP: a Windows PC can't get time from pfSense. Other devices are okay.:

                        I've tried providing different NTP servers in DHCP for the interface but that hasn't worked either

                        A DHCP server can be stuffed with all the options in teh workd, but if the DHCP client, your PC, didn't asked for an NTP server (one, or more), then the server will not send it.

                        Check for yourself : packet capture : all set up just for you :

                        586555bd-6ddd-49be-a09c-b0f25a32a9fa-image.png

                        and click on start an see what happens.
                        You'll see the entire DHCP negotiation as it was meant to be since "1970" (I guess, DHCP is old).

                        You'll discover that Microsoft systems don't stuff doesn't ask for a NTP server.
                        They have a ntp host name build, to some NTP Microsoft server (Microsoft loves to call home ^^)

                        No "help me" PM's please. Use the forum, the community will thank you.
                        Edit : and where are the logs ??

                        Y 2 Replies Last reply Reply Quote 0
                        • Y
                          youngy @Gertjan
                          last edited by

                          @Gertjan Great, thanks for this. Much appreciated. I'll try it a bit later.

                          1 Reply Last reply Reply Quote 0
                          • Y
                            youngy @Gertjan
                            last edited by

                            @Gertjan I've done what you suggested (bar the pcap)- resetting NTP and making sure the any any rule was working (what are the advanced settings that you use?). And I also disabled all the NTP firewall rules for redirecting etc.

                            The good news is the PC can now sync with the time server (pool.ntp.org). Whenever I try to get it to use pfSense NTP it fails. As it's a portable PC I'll just leave it as it is now (which I think is what @johnpoz was suggesting as well).

                            I set up the NAT redirect for NTP because it was a Netgate suggestion from a while ago.

                            Many thanks for your help.

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

                              @youngy said in NTP: a Windows PC can't get time from pfSense. Other devices are okay.:

                              As it's a portable PC I'll just leave it as it is now (which I think is what @johnpoz was suggesting as well).

                              no what I was suggesting is actually point windows to the IP of pfsense for its ntp.. And I use the actual ntp client on windows, not whatever junk windows has built in.

                              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.7.2, 24.11

                              Y 1 Reply Last reply Reply Quote 0
                              • Y
                                youngy @johnpoz
                                last edited by

                                @johnpoz Right, okay. Thanks for clarifying. I changed Windows time server from time.windows.com to pool.ntp.org and allow the PC access to it. It seems to work fine now.

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

                                  @youngy that isn't getting time from pfsense - why not just point to pfsense IP or fqdn?

                                  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.7.2, 24.11

                                  Y 1 Reply Last reply Reply Quote 1
                                  • Y
                                    youngy @johnpoz
                                    last edited by

                                    @johnpoz I don't seem to understand this properly. I've tried things such as a redirect with no joy. I tried setting a host override but that didn't work, finally I tried setting the time server in Windows to my pfSense fqdn and then to its IP but that didn't work either. The only way I can get the PC to sync with a time server is to let it go out to the internet to sync with pool.ntp.org or similar. I'll try a packet capture tomorrow as shown by @Gertjan and see what that shows. Thanks for helping me push this along.

                                    Y 1 Reply Last reply Reply Quote 0
                                    • Y
                                      youngy @youngy
                                      last edited by

                                      @youngy @johnpoz @Gertjan . This problem appears to be fixed now. I presume at some time and for some reason I had selected the Service box in the default ACLs for NTP. I decided to look for the default settings and noticed in a post that Service wasn't selected. I deselected it and let NTP restart. Once I re-enabled the redirects for port 123 everything started working as it's supposed to. Thanks for helping me get to the bottom of this.

                                      c156b025-59bd-46c6-9430-7579e183346f-image.png

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

                                        @youngy said in NTP: a Windows PC can't get time from pfSense. Other devices are okay.:

                                        All my other devices seem to work okay

                                        Well guess none of your other devices are even pointing at pfsense for ntp then, or your redirects were not setup correctly either than.. Because if you had that checked nothing would of been able to get time from ntp on pfsense.

                                        And you stated all your other devices were working.

                                        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.7.2, 24.11

                                        Y 1 Reply Last reply Reply Quote 0
                                        • Y
                                          youngy @johnpoz
                                          last edited by

                                          @johnpoz yes I thought that was the case. For the wired devices, I just set the time server on the client to be the pfSense fqdn. I could see other devices getting redirected to localhost in the log so assumed they were fine but likely not as you say. It was just the windows PC that complained. I didn’t validate the setup, which in hindsight was a mistake. Lesson learnt.

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

                                            @youngy said in NTP: a Windows PC can't get time from pfSense. Other devices are okay.:

                                            Lesson learnt.

                                            I would prob actually validate time sync is going to where you want, either directly pointing to pfsense which is always prob the best idea vs redirect. And working, or via your redirect.

                                            I had some stupid iot devices (wifi light bulbs) that were pointing to pool address, not even in my country.. had some using uk.pool.ntp.org, which makes zero sense because they were bought in the states.. Someone messed up and didn't alter the code for regions they were going to be sold, etc..

                                            So I just set a host override to point uk.pool.ntp.org to my ntp server.

                                            A sniff (packet capture) for ntp will give great info that clients who clients are asking, and if being redirected, etc. you should see the client query and then response.

                                            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.7.2, 24.11

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