User Tools

Site Tools


informatique:linux:ntp

This is an old revision of the document!


NTP

Fichier minimal

tinker panic 0
restrict default nomodify notrap noquery
restrict 127.0.0.1

driftfile /var/lib/ntp/drift
broadcastdelay  0.008

keys            /etc/ntp/keys

logfile /var/log/ntp.log
server 10.0.0.25 iburst
#server 10.0.0.26 iburst

Détails

tinker panic 0
⇒ recommandation Red Hat pour les VM, indiquant au service NTP de ne pas paniquer et s'arrêter, peu importe l'offset

restrict default nomodify notrap noquery
restrict 127.0.0.1
⇒ permet de restreindre les clients interrogeant ce serveur

driftfile /var/lib/ntp/drift
⇒ fichier enregistrant le décalage de la fréquence locale, spécifier ce fichier est une optimisation

logfile /var/log/ntp.log
⇒ utile pour le débug

Forcer la synchronisation

ntpd -gq

[root@vm-front-01 ~]# service ntpd stop
Arrêt de ntpd : [  OK  ]
[root@vm-front-01 ~]# ntpd -gq
ntpd: time set +14.213552s
[root@vm-front-01 ~]# service ntpd start
Démarrage de ntpd : [  OK  ]
[root@vm-front-01 ~]# service ntpd status
ntpd (pid  22366) en cours d'exécution...
[root@vm-front-01 ~]# tail /var/log/ntp.log 
30 Apr 11:19:06 ntpd[22325]: ntpd: time set +14.213552 s
30 Apr 11:19:10 ntpd[22366]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
30 Apr 11:19:10 ntpd[22366]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
30 Apr 11:19:10 ntpd[22366]: Listen and drop on 1 v6wildcard :: UDP 123
30 Apr 11:19:10 ntpd[22366]: Listen normally on 2 lo 127.0.0.1 UDP 123
30 Apr 11:19:10 ntpd[22366]: Listen normally on 3 eth0 10.62.19.196 UDP 123
30 Apr 11:19:10 ntpd[22366]: Listening on routing socket on fd #20 for interface updates
30 Apr 11:19:10 ntpd[22366]: 0.0.0.0 c016 06 restart
30 Apr 11:19:10 ntpd[22366]: 0.0.0.0 c012 02 freq_set ntpd -473.184 PPM
30 Apr 11:19:11 ntpd[22366]: 0.0.0.0 c615 05 clock_sync
[root@vm-front-01 ~]# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+10.0.0.25     192.168.192.80   4 u    1   64    1    0.338   12.023   6.446
*10.0.0.26     192.168.192.80   4 u    2   64    1    0.334    8.876   5.370
[root@vm-front-01 ~]# ntpq -pn
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*10.0.0.25     192.168.192.80   4 u   57   64  377    0.317  831.829  69.528
+10.0.0.26     192.168.192.80   4 u   56   64  377    0.264  801.916  89.625
[root@vm-front-01 ~]# 

Nombre sources de temps

Il est fortement déconseillé d'utiliser deux sources de temps.
C'est expliqué sur ntp.org : http://support.ntp.org/bin/view/Support/SelectingOffsiteNTPServers#Section_5.3.3.
et sur le site de Redhat : https://access.redhat.com/solutions/58025.

ntpdate

informatique/linux/ntp.1588240050.txt.gz · Last modified: 2020/04/30 11:47 by didzkovitchz