Koozali.org formerly Contribs.org

Data e ora server sbagliate

Offline Mat78

Data e ora server sbagliate
« on: January 18, 2019, 09:34:20 AM »
Buongiorno a tutti,
questa mattina ho notato sul mio server che l'ora è sbagliata, l'orologio del sistema (anche se sincronizzato con i time server) segnala le 8:53 mentre sono le 9:33.

Per caso qualcuno ha avuto lo stesso problema e sa come possa essere risolto?

Grazie in anticipo

Matteo

Offline mmccarn

  • *
  • 2,445
Re: Data e ora server sbagliate
« Reply #1 on: January 18, 2019, 01:10:23 PM »
Google translation of this topic (english to italian):
http://translate.google.com/translate?hl=it&sl=en&tl=it&u=https%3A%2F%2Fforums.contribs.org%2Findex.php%3Ftopic%3D53889.0%3Btopicseen

NTP stops syncing (by default) if your system clock is more than 1000 seconds off from the servers you're syncing with.

If that happens, you need to reset the system clock manually.  This command will usually do that:
Code: [Select]
ntpdate -u pool.ntp.org

Once your system time is approximately correct, you can check the ntp status using "ntpq".  The entry marked with "*" is the server currently being used by my system:
Code: [Select]
# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*208.75.88.4     192.12.19.20     2 u  140 1024  377   64.726    0.647  13.222
+50.116.52.97    192.5.41.41      2 u  456 1024  377    9.291    0.780   4.991
+104.155.144.4   216.239.35.12    2 u  670 1024  377   29.494   -2.097   0.753
-96.8.121.205    140.142.1.8      3 u  508 1024  371   72.938    2.256   5.367
 127.127.1.0     .LOCL.          10 l  20d   64    0    0.000    0.000   0.000

Some things that can cause your system time to get out of sync (in case it happens again):

- Virtual servers used to require some special settings for ntpd (I don't know if this is still a problem):
https://wiki.contribs.org/Virtual_SME_Server#NTPD

- The server's hardware clock may be acting up, or may no longer be supported by Centos 6
https://forums.contribs.org/index.php?topic=51088.0

- A bad motherboard battery can sometimes cause a physical server to boot with the wrong time when rebooted (my last server hardware had this problem, so I created a cron job to run '@reboot' to run ntpdate and set the server's time)

Offline Mat78

Re: Data e ora server sbagliate
« Reply #2 on: February 25, 2019, 06:06:13 PM »
Grazie per la risposta, sono riuscito a fare qualche test solo ora.

Ho provato a seguire il tuo suggerimento ma il server risponde con l'errore "ntpdate[6616]: no server suitable for synchronization found" anche provando ad usare server diversi, ma il risultato è sempre lo stesso.

Ho provato a guardare su internet, ho visto che nel 2014 c'era già stato un problema simile, che però oggi dovrebbe essere risolto.

Per adesso ho risolto impostando manualmente l'orario.

Qualcuno ha qualche altro suggerimento?

Ancora grazie
Matteo

Offline mmccarn

  • *
  • 2,445
Re: Data e ora server sbagliate
« Reply #3 on: February 26, 2019, 02:27:56 PM »
(translate this post from Italian back into English)
http://translate.google.com/translate?hl=it&sl=it&tl=en&u=https%3A%2F%2Fforums.contribs.org%2Findex.php%3Ftopic%3D53889.0%3Btopicseen

"man ntpd" on my SME 9.2 system says "ntpd -q" can be used instead of "ntpdate"

To use "ntpd -q" you need to stop the ntpd service:
Code: [Select]
# stop the running ntpd service
sv d ntpd

# run ntpd manually, set the time and exit (-q) ignoring the current offset (-g)
#   add -d to include debugging information (-d) in the output (ntpd -q -g -d)
ntpd -q -g

# restart the ntpd service
sv u ntpd


Some thoughts on why ntpdate might not have worked:

Were you using "ntpdate -u", or only "ntpdate"? I used to get the error you describe ("no server suitable for synchronization found") if I ran ntpdate without the "-u" argument.

According to https://www.pool.ntp.org/zone/it, a good NTP for you might be it.pool.ntp.org:
Code: [Select]
ntpdate -u it.pool.ntp.org
Both ntpdate and ntpd -q will fail if your network firewall is blocking outbound UDP traffic on port 123.

Offline Mat78

Re: Data e ora server sbagliate
« Reply #4 on: June 19, 2019, 09:13:25 AM »
Grazie, alla fine ho scoperto che il problema era proprio il firewall che bloccava la porta 123, una volta aperta questa porta tutto ha ripreso a funzionare alla perfezione.

Matteo