[SOLVED] How to sync with local time from NTP server?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I configured Chorony server side on Centos 8 then I tried to sync time with client with linux and got this result
Code:
timedatectl
Local time: Tue 2022-05-17 13:16:46 +05
Universal time: Tue 2022-05-17 08:16:46 UTC
RTC time: Tue 2022-05-17 08:18:07
NTP enabled: yes
NTP synchronized: no
RTC in local TZ: no
DST active: n/a
RTC time seems like synced but Local time not synced. How to sync the time with local time too? Firewall disabled on both server/client side so 123 port is open.
On the centos /chronyc server/ side I added 4 server:
The ? means the system lost communication with the server or something was wrong with the ntp data packets.
The 377 (in the fourth column of data) indicates the system was actually communicating and the queries were successful, 0 means nothing was every received.
The RTC is the battery backed hardware clock and the system thinks it should be set to UTC. Normally when the computer boots it reads and sets the system time using the RTC. Eventually when the network is up chronyc updates the time when connected to a time server. Actually the system is set to UTC and the timezone setting is used to display local time.
ntp.gnc.am and time.cloudflare.com may be a networking problem.
How are the 192.168.1.2 and 192.168.1.10 syncing their time? Are they running ntp?
The ? means the system lost communication with the server or something was wrong with the ntp data packets.
The 377 (in the fourth column of data) indicates the system was actually communicating and the queries were successful, 0 means nothing was every received.
The RTC is the battery backed hardware clock and the system thinks it should be set to UTC. Normally when the computer boots it reads and sets the system time using the RTC. Eventually when the network is up chronyc updates the time when connected to a time server. Actually the system is set to UTC and the timezone setting is used to display local time.
ntp.gnc.am and time.cloudflare.com may be a networking problem.
How are the 192.168.1.2 and 192.168.1.10 syncing their time? Are they running ntp?
Thanks for your reply.
Can we determine what was wrong with data packet?
Can I set RTC to local time?
The centos 8 which I installed chrony as server is not syncing the time from the Internet. Is that problem persist on client side?
One of them is working Windows ntp server.
Second one is linux based chrony server.
Yes, but in general time syncing works much better if it set to UTC. The system clock is UTC regardless of timezone or RTC clock setting. However, you do need to tell the operating system which setting you are using so the system clock is set correctly. In addition, there is no conflict during DST time changes. If your not using DST then it probably does not matter.
Quote:
The centos 8 which I installed chrony as server is not syncing the time from the Internet. Is that problem persist on client side?
It can persist. If the server clock drifts a lot the client does not trust the server and will not use it as a source.
Is the Windows time server not syncing to the internet?
On any modern OS, it is mandatory that the system bios time is set to UTC. Then when you set the local time zone the system time is properly displayed as local time. That is how the OS manages time. It is also how NTP keeps times synced. The OS displays time as local time, but under the hood it manages UTC time.
Any properly configured and synced time server (windows, linux, or other) will also use utc to sync with its clients.
Attempting any other config is simply asking for problems in time sync with the internet time servers and display on the OS.
Last edited by computersavvy; 05-17-2022 at 11:10 AM.
As an aside... Many embedded systems like the Pi do not even have a hardware clock and the only purpose for the hardware clock is to set the system time. Now days when everybody is connected to the internet its less important IMHO. But if you do have a RTC make sure it is set correctly. ntp does not care about the RTC. With most configurations ntp at start forces the system clock to sync to an absolute time regardless.
There are certain conditions like DST that complicates conversion from local to UTC when the hardware clock is set to local time but should be fixed when ntp is synced.
It can persist. If the server clock drifts a lot the client does not trust the server and will not use it as a source.
That was problem, I installed as new server with ubuntu. That ubuntu's chronyc is syncing from the internet, then syncing to the local are connection.
Thank you guys.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.