NTP server connecting protocol and ports

Post new topic   This topic is locked: you cannot edit posts or make replies.    DD-WRT Forum Index -> General Questions
Author Message
user_1982
DD-WRT Novice


Joined: 11 Mar 2021
Posts: 10

PostPosted: Thu Mar 11, 2021 14:22    Post subject: NTP server connecting protocol and ports Reply with quote
Hi All,
This is my first post and it's a bit different type of query and I am trying to find some answers from the DDWRT developers/experts.

My TP Link router with stock TP Link's firmware fails to sync time with Internet NTP servers. It just returns Time Out for tens of NTP servers.
I understand that this is totally out of scope here on this forum.

But I am curious to understand when DD WRT firmware establishes Time Sync with NTP servers on various routers does it connect to SNTP 123 or UDP 123 or TCP 37 or UDP 37 or some other port/protocol.

Sadly TP Link support is not providing any info and it's unclear if my ISP blocks these ports or there's indeed issue with TP Link firmware.

My Linux PC on same ISP can sync time ntpdate -q <servername> command as well as another Dlink router with stock firmware but not TP Link router.

I am not expecting any help in troubleshooting as I am not using DD WRT but I am restricting the scope to understanding how DD WRT syncs time with NTP servers.



Thanks and I hope my query is on topic here.
Best regards.
Sponsor
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1410

PostPosted: Fri Mar 12, 2021 2:49    Post subject: Reply with quote
NTP runs over udp port 123 by default... there are different versions of the protocol and if yours is too old it will give errors. I have no idea what your TP Link router is doing so I can not be of much help. The other thing is your hardware clock on that router may have failed or be so undisiciplined that the ntp algorithm rejects it and does not sync.

DD-WRT uses the standard UDP 123 to establish the connection.

the NTP server can have settings to reject for certain reasons, some will block/reject if you query too many times in a specific amount of time (ie they think it is a start of a ddos)
user_1982
DD-WRT Novice


Joined: 11 Mar 2021
Posts: 10

PostPosted: Fri Mar 12, 2021 9:26    Post subject: Reply with quote
Thank you @Wildlion for this info.
Ok so it's UDP 123 and since my other Dlink router is able to sync, it means ISP is not blocking the port.
I also flashed my Dlink router with DDWRT and it was as well able to sync time correctly with default as well as time.nist.gov. So connection outbound to UDP 123 is fine.
That's the only clarity I needed.

So there must be something wrong with the TPLink router.

Thanks again.
user_1982
DD-WRT Novice


Joined: 11 Mar 2021
Posts: 10

PostPosted: Fri Mar 12, 2021 21:19    Post subject: Reply with quote
Hi,
additionally I have just one more query. When DD-WRT sends NTP client sync request to NTP server does it originate on Source port UDP 123 or a higher port like above 1000

i.e. is it Client UDP 123 to NTP Server UDP 123
or Client UDP (say) 1020 to NTP UDP 123
Thanks.
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1410

PostPosted: Sat Mar 13, 2021 17:10    Post subject: Reply with quote
it would be udp 123 (s) to udp 123 (d) connection
user_1982
DD-WRT Novice


Joined: 11 Mar 2021
Posts: 10

PostPosted: Sat Mar 13, 2021 21:30    Post subject: Reply with quote
Thanks, that's a bit puzzling because my ISP blocks incoming 123 port udp, so how come DD-WRT on my dlink router is able to sync time with NTP servers.
I though it would have been a higher numbered port which generally is not blocked by ISP.
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1410

PostPosted: Mon Mar 15, 2021 0:49    Post subject: Reply with quote
It probably is doing packet inspection and sees an outgoing request first from that port/protocol, then it records in the table an expected response and waits until it gets it.

This is essentially how NAT routers work.
user_1982
DD-WRT Novice


Joined: 11 Mar 2021
Posts: 10

PostPosted: Mon Mar 15, 2021 20:22    Post subject: Reply with quote
Does it change the source port from 123 to something else?
If it expects a response back on 123 it will be blocked at ISP. Yet with DD-WRT, NTP Sync in router is working.
Wildlion
DD-WRT Guru


Joined: 24 May 2016
Posts: 1410

PostPosted: Tue Mar 16, 2021 22:42    Post subject: Reply with quote
That would be for only new connections, yours would be related or established... otherwise that would break the standard ntp ports/distro
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Sun Sep 18, 2022 12:31    Post subject: Reply with quote
If you share your DD-WRT version and router brand name and version it would be better than making generic questions based on wild guesses and conjecture and thus we could perhaps see if any thing is not right in setup and give you specific help if needed. If in doubt read the top sections on https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=332703

I dont think there are any ISP blocks to standard NTP ports, it would make no sense for any ISP, as NTP is pretty much universal use case for all sorts of devices, as you noted yourself other devices work, so it is not blocked, this is a fact.

Also your NTP setup matters, we have no idea what you're inserting in there, also its best left blank as it uses built in servers which change based on your geo location.

Only cases it fails is if there is no WAN connection on router itself. These attempts are also logged to syslog if you have it enabled under services tab.

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
user_1982
DD-WRT Novice


Joined: 11 Mar 2021
Posts: 10

PostPosted: Tue Sep 20, 2022 18:26    Post subject: Reply with quote
@the-joker
Thanks for your post. The general info I was looking for was more or less received in the discussion. The original post is nearly 2 years old. I returned my TPLink router back to seller then and have changed my ISP twice since then.
This thread may simply be closed now as the original context no longer exists.
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Tue Sep 20, 2022 19:35    Post subject: Reply with quote
IDK it showed up on recent posts, so I replied, odd, didnt even notice the dates. Must have been Monday Wink.

Locking

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
Display posts from previous:    Page 1 of 1
Post new topic   This topic is locked: you cannot edit posts or make replies.    DD-WRT Forum Index -> General Questions All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum