LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 05-17-2022, 03:31 AM   #1
mn_h4ck3r
LQ Newbie
 
Registered: Apr 2009
Posts: 10

Rep: Reputation: 0
How to sync with local time from NTP server?


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:
Code:
chronyc sources
^? ntp.gnc.am                    0   9     0     -     +0ns[   +0ns] +/-    0ns
^? time.cloudflare.com           0  10     0     -     +0ns[   +0ns] +/-    0ns
^? 192.168.1.2                   4   9   377   513  -3439ms[-3439ms] +/- 7959ms
^? 192.168.1.10                  4   9   377   457  -3438ms[-3438ms] +/- 7960ms
What means
Quote:
?
sign?

Last edited by mn_h4ck3r; 05-17-2022 at 11:10 PM. Reason: solved
 
Old 05-17-2022, 07:01 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,717

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
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?
 
1 members found this post helpful.
Old 05-17-2022, 09:02 AM   #3
mn_h4ck3r
LQ Newbie
 
Registered: Apr 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by michaelk View Post
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.
 
Old 05-17-2022, 09:16 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,717

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
Quote:
Can I set RTC to local time?
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?
 
1 members found this post helpful.
Old 05-17-2022, 10:02 AM   #5
mn_h4ck3r
LQ Newbie
 
Registered: Apr 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by michaelk View Post
Is the Windows time server not syncing to the internet?
Windows ntp server is syncing from internet correctly. It was configured as time.windows.com
But it is used a lot of devices.
 
Old 05-17-2022, 10:51 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,717

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
I have not really played with using Windows as a time source.

What Windows version are you running? Is it specifically configured i.e. registry settings modified etc to be a time server?
 
Old 05-17-2022, 11:06 AM   #7
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
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.
 
1 members found this post helpful.
Old 05-17-2022, 11:39 AM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,717

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
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.
 
Old 05-18-2022, 12:21 AM   #9
mn_h4ck3r
LQ Newbie
 
Registered: Apr 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by michaelk View Post

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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Debian jessie NTP server sync to windows ntp server question rogzuser Linux - Server 1 09-08-2015 06:19 AM
ntp client is not syncing with ntp server time sagar666 Linux - Server 3 12-19-2014 04:47 AM
ntp server keeps on changing time-local ntp server Gil@LQ Linux - Newbie 3 01-23-2013 09:33 AM
NTP time sync with windows 2000 AD time csghosh Linux - Enterprise 7 02-24-2012 03:46 PM
ntp drift file in /etc/ntp instead of /var/lib/ntp - suggestion for a patch in Slack niels.horn Slackware 16 05-07-2009 07:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration