centos:ntp-zeitserver

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
centos:ntp-zeitserver [12.01.2011 08:37. ] – Formatierung angepasst und link eingefügt djangocentos:ntp-zeitserver [20.04.2018 10:31. ] (aktuell) – Externe Bearbeitung 127.0.0.1
Zeile 1: Zeile 1:
 +====== lokalen Zeitserver einrichten ======
 +Mittels NTP((Network Time Protocol)) Nutzen wir einen Standard zur Synchronisierung aller Uhren in unserem SOHO((SmallOfficeHomeOffice))-LAN. 
 +NTP wurde als RFC 958 definiert um eine zuverlässige Zeitgabe über Netzwerke mit variabler Paketlaufzeit zu ermöglichen und bekam von der Internet Assigned Numbers Authority den UDP-Ports 123 zugewiesen. 
 +===== Installation =====
 +Falls nicht schon bei der Erstinstallation geschehen, installieren wir erst ein mal das benötige RPM für unseren Zeitserver.
 +<code>yum install ntp</code>
 +===== Konfiguration =====
 +==== NTP ====
 +Die Konfiguration unseres Zeitservers erfolgt über die Datei **/etc/ntp.conf**. Notwendige Änderungen nehmen wir mit dem editor unserer Wahl (**vim**) vor.
 +<code>vim /etc/ntp.conf
 +# Permit time synchronization with our time source, but do not
 +# permit the source to query or modify the service on this system.
 +restrict default kod nomodify notrap nopeer noquery
 +
 +# Permit all access over the loopback interface.  This could
 +# be tightened as well, but to do so would effect some of
 +# the administrative functions.
 +restrict 127.0.0.1 
 +restrict -6 ::1
 +
 +# Hosts on local network are less restricted.
 +restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap
 +
 +# Use public servers from the pool.ntp.org project.
 +# Please consider joining the pool (http://www.pool.ntp.org/join.html).
 +server 0.centos.pool.ntp.org
 +server 1.centos.pool.ntp.org
 +server 2.centos.pool.ntp.org
 +
 +#broadcast 192.168.1.255 key 42         # broadcast server
 +#broadcastclient                        # broadcast client
 +#broadcast 224.0.1.1 key 42             # multicast server
 +#multicastclient 224.0.1.1              # multicast client
 +#manycastserver 239.255.254.254         # manycast server
 +#manycastclient 239.255.254.254 key 42  # manycast client
 +#manycastserver 192.168.10.255
 +
 +# Undisciplined Local Clock. This is a fake driver intended for backup
 +# and when no outside source of synchronized time is available. 
 +server  127.127.1.0
 +fudge   127.127.1.0 stratum 10
 +
 +# Drift file.  Put this in a directory which the daemon can write to.
 +# No symbolic links allowed, either, since the daemon updates the file
 +# by creating a temporary in the same directory and then rename()'ing
 +# it to the file.
 +driftfile /var/lib/ntp/drift
 +
 +# Key file containing the keys and key identifiers used when operating
 +# with symmetric key cryptography. 
 +keys /etc/ntp/keys
 +
 +# Specify the key identifiers which are trusted.
 +#trustedkey 4 8 42
 +
 +# Specify the key identifier to use with the ntpdc utility.
 +#requestkey 8
 +
 +# Specify the key identifier to use with the ntpq utility.
 +#controlkey 8
 +restrict 0.centos.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
 +restrict 1.centos.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
 +restrict 2.centos.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
 +#Specify alternate log file
 +logfile /var/log/ntp.log
 +</code>
 +==== DHCP ====
 +Damit unsere Klienten auch von [[centos:dhcp-server|unserem eigenen NTP-Server]] Gebrauch machen, geben wir die IP-Adresse unseres NTP-Servers diesen via DHCP bekannt.
 +
 +Wir editieren also unsere **/etc/dhcpd.conf**.
 +   vim  /etc/dhcpd.conf
 +   
 +           option ntp-servers              192.168.100.1;
 +Abschließend restarten wir unseren DHCP-Server.
 +   service dhcpd restart
 +
 +===== Serverstart =====
 +Der erste Start unseres Zeitserver erfolgt dem gewohnten Syntaxschema:
 +<code>service ntpd start</code>
 +Im syslog wird der erfolgreiche Start entsprechend quittiert:
 +<code>Nov  7 21:00:40 mnss ntpd[15626]: ntpd 4.2.2p1@1.1570-o Tue Jun 10 00:07:18 UTC 2008 (1)
 +Nov  7 21:00:40 nss ntpd[15627]: precision = 2.000 usec
 +Nov  7 21:00:40 nss ntpd[15627]: Listening on interface wildcard, 0.0.0.0#123 Disabled
 +Nov  7 21:00:40 nss ntpd[15627]: Listening on interface wildcard, ::#123 Disabled
 +Nov  7 21:00:40 nss ntpd[15627]: Listening on interface eth0, fe80::21f:d0ff:fe8c:7277#123 Enabled
 +Nov  7 21:00:40 nss ntpd[15627]: Listening on interface lo, ::1#123 Enabled
 +Nov  7 21:00:40 nss ntpd[15627]: Listening on interface lo, 127.0.0.1#123 Enabled
 +Nov  7 21:00:40 nss ntpd[15627]: Listening on interface eth0, 192.168.100.2#123 Enabled
 +Nov  7 21:00:40 nss ntpd[15627]: kernel time sync status 0040
 +Nov  7 21:00:40 nss ntpd[15627]: frequency initialized -46.933 PPM from /var/lib/ntp/drift
 +</code>
 +Damit der Zeitserver **ntpd** automatisch bei jedem Systemstart startet, kann die Einrichtung eines Start-Scriptes über folgenden Befehl erreicht werden:
 +<code># chkconfig ntpd on</code>
 +Ein Überprüfung ob der Dienst (Daemon) ntdp wirklich bei jedem Systemstart automatisch mit gestartet wird, kann durch folgenden Befehl erreicht werden:
 +<code># chkconfig --list | grep ntpd
 +ntpd            0:Aus   1:Aus   2:Aus   3:Ein   4:Ein   5:Ein   6:Aus</code>
 +Wichtig ist jeweils der Schalter **on** bei den Runleveln - **3 4 5**. 
 +
 +===== Serverstatus =====
 +Mit dem Befehl **watch ntpq -np** können wir uns abschließend den Status unseres Timeservers anzeigen lassen (Die Synchronisation kann bis zu 30 Minuten dauern - diese Zeit muss ggf. gewartet werden)
 +<code>watch ntpq -np</code>
 +zeigt uns an:
 +<code>Every 2,0s: ntpq -np                                                                                         Wed Aug  6 17:11:20 2008
 +
 +     remote           refid      st t when poll reach   delay   offset  jitter
 +==============================================================================
 ++81.169.180.23   78.46.78.10      3 u    2   64  377   28.552    0.764   0.540
 ++88.198.23.16    192.53.103.104   2 u   64   64  377   12.074    0.461   0.589
 +*88.198.8.101    192.53.103.104   2 u   62   64  377   12.315    0.552   0.852</code>
 +
 +An Hand des ** * ** am Zeilenanfang ist zu erkennen, dass Synchronisation erfolgt. Die Spalten haben folgende Bedeutung: 
 +
 +
 +^Spalte^Bedeutung^
 +|remote|Mit welchen Servern ist mein Zeitserver verbunden?                     |
 +|refid |Von welcher Zeitquelle stammt die Zeit?                                |
 +|st    |stratum (Entfernung von der Zeitquelle in )                            |
 +|t     |type (u = unicast, m = multicast, l = local, - = don't know)           |
 +|when  |Wann wurde der Server zuletzt angefragt                                |
 +|poll  |Wie oft wird mit diesem Server syncronisiert? ( Intervall in Sekunden )|
 +|reach |Wie gut ist der Server erreichbar? 377 = optimal                       |
 +|delay |                                                                       |
 +|offset|                                                                       |
 +|jitter| Abweichung in Millisekunden                                           |
 +
 +
  
  • centos/ntp-zeitserver.txt
  • Zuletzt geändert: 20.04.2018 10:31.
  • von 127.0.0.1