Ntp server
Installation
- apt install ntp
Die Hauptkonfiguration vom NTP Server
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
# Leap seconds definition provided by tzdata
leapfile /usr/share/zoneinfo/leap-seconds.list
# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
#server: Ähnlich wie pool, nur das hier nur ein Server angegeben wird.
#server ntp.your-provider.example
#pool: Für Adressen des Typs mobilisiert dieser Befehl eine dauerhafte Zuordnung im Client-Modus
#mit einer Reihe von Remote-Servern. In diesem Modus kann die lokale Uhr mit dem entfernten Server
#synchronisiert werden, aber der entfernte Server kann niemals mit dem lokalen synchronisiert werden
pool 0.debian.pool.ntp.org iburst
pool 1.debian.pool.ntp.org iburst
pool 2.debian.pool.ntp.org iburst
pool 3.debian.pool.ntp.org iburst
# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
#
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.
# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
# Needed for adding pool entries
restrict source notrap nomodify noquery
# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust
# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255
# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines. Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient
Optionen
pool
Für Adressen des Typs aktiviert dieser Befehl eine dauerhafte Zuordnung im Client-Modus mit einer Reihe von Remote-Servern. In diesem Modus kann die lokale Uhr mit dem entfernten Server synchronisiert werden, aber der entfernte Server kann niemals mit dem lokalen synchronisiert werden. Kann alternativ oder auch mit der Direktive server benutzt werden. pool wendet das RoundRobin-Verfahren an.
driftfile
Die Driftdatei wird verwendet, um den Frequenzversatz zwischen der Systemuhr, die mit ihrer Nennfrequenz läuft, und der Frequenz zu speichern, die erforderlich ist, um mit UTC synchron zu bleiben. Falls vorhanden, wird der in der Driftdatei enthaltene Wert beim Systemstart gelesen und zur Korrektur der Taktquelle verwendet. Die Verwendung der Driftdatei verringert die Zeit, die zum Erreichen einer stabilen und genauen Zeit erforderlich ist. Der Wert wird einmal pro Stunde von ntpd berechnet und die Driftdatei ersetzt. Die Driftdatei wird ersetzt und nicht nur aktualisiert, und aus diesem Grund muss die Driftdatei in einem Verzeichnis liegen, für das ntpd Schreibrechte hat.
Statistiken anzeigen
- watch -n 1 ntpq -p
remote refid st t when poll reach delay offset jitter ============================================================================== 0.debian.pool.n .POOL. 16 p - 64 0 0.000 +0.000 0.000 1.debian.pool.n .POOL. 16 p - 64 0 0.000 +0.000 0.000 2.debian.pool.n .POOL. 16 p - 64 0 0.000 +0.000 0.000 3.debian.pool.n .POOL. 16 p - 64 0 0.000 +0.000 0.000 +x.ns.gin.ntt.ne 129.250.35.222 2 u 43 64 377 30.994 +4.343 6.664 *ntp0.rrze.uni-e .GPS. 1 u 49 64 377 33.502 +2.076 7.938 +ntp2.lwlcom.net .GPS. 1 u 52 64 377 45.357 +5.363 10.198 +pmg.jonasled.de 131.188.3.220 2 u 52 64 377 40.279 +5.072 15.165 +h2954360.strato 208.90.67.116 3 u 46 64 377 49.506 +5.910 9.933 +sv1.ggsrv.de 192.53.103.103 2 u 50 64 377 37.064 +3.896 8.377 +static.255.156. 124.216.164.14 2 u 46 64 377 42.464 +6.099 9.968 +ntp1.m-online.n 212.18.1.106 2 u 47 64 377 34.221 +1.075 6.425 +stratum2-3.NTP. 129.70.137.82 2 u 36 64 377 42.527 +2.333 7.465 #ntp1.as213151.n 216.239.35.0 2 u 37 64 377 32.346 -56.093 78.495 +kuehlich.com 131.188.3.221 2 u 46 64 377 49.752 +4.470 10.315 +tanss.it-risch. 192.53.103.103 2 u 45 64 377 28.801 -0.441 5.282