User Tools

Site Tools


informatique:linux:ntp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
informatique:linux:ntp [2020/04/29 09:54] – created didzkovitchzinformatique:linux:ntp [2020/04/30 17:27] (current) didzkovitchz
Line 1: Line 1:
 ====== NTP ====== ====== NTP ======
 +
 +===== Fichier minimal =====
 +
 +
 +<code>
 +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
 +</code>
 +
 +==== 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''
 +
 +<code>
 +[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 ~]# 
 +</code>
 +
 +
 +===== 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]].
 +
 +
 +===== ntpq -pn =====
 +
 +ça c'est un bon site qui explique simplement l'output du "ntpq -p" :\\
 +[[http://tech.kulish.com/2007/10/30/ntp-ntpq-output-explained/]]
 +
 +
 +===== ntpdate =====
 +
 +''ntpdate'' a été passé en "deprecated" depuis la version 7 de RHEL.\\
 +[[https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/s1-configure_ntpdate_servers]]
  
  
 {{tag>GNU_Linux NTP chrony}} {{tag>GNU_Linux NTP chrony}}
informatique/linux/ntp.1588146847.txt.gz · Last modified: 2020/04/29 09:54 by didzkovitchz