ubuntuusers.de

NTP server sendet keine zeit mehr

Status: Gelöst | Ubuntu-Version: Server 16.04 (Xenial Xerus)
Antworten |

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14757

Conan179 schrieb:

das:

root@Ubuntu-1604-64bit-Openvpn-maschine:~# systemctl status ntp.service
● ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
   Active: active (exited) since So 2016-06-05 14:13:04 CEST; 8h ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1137 ExecStart=/etc/init.d/ntp start (code=exited, status=0/SUCCESS)

Evtl. ist die Konfiguration des ntpd nicht OK (siehe gelbe Markierung). So sieht es z. B. bei mir aus:

:~ $ systemctl status ntp.service
● ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp)
   Active: active (running) since Sun 2016-05-29 11:01:15 CEST; 1 weeks 0 days ago
   CGroup: /system.slice/ntp.service
           └─541 /usr/sbin/ntpd -p /var/run/ntpd.pid -4 -g -U 0 -c /var/lib/ntp/ntp.conf.dhcp -u 106:111

Conan179

(Themenstarter)

Anmeldungsdatum:
20. Dezember 2010

Beiträge: 235

die konfig hab ich das letzte mal im märz bearbeitet, seid dem wurde sie nicht verändert.

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14757

Conan179 schrieb:

die konfig hab ich das letzte mal im märz bearbeitet, ...

Nutzt Du IPv6? Wie ist auf dem Server die Ausgabe von:

cat /etc/default/ntp

?

Conan179

(Themenstarter)

Anmeldungsdatum:
20. Dezember 2010

Beiträge: 235

Ja, der server hat eine Statische ipv4 und ipv6:

1
2
3
root@Ubuntu-1604-64bit-Openvpn-maschine:~# cat /etc/default/ntp
NTPD_OPTS='-g'
root@Ubuntu-1604-64bitOpenvpn-maschine:~#

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14757

Conan179 schrieb:

Ja, der server hat eine Statische ipv4 und ipv6:

Kannst Du zum testen, beim ntpd temporär auf IPv6 verzichten? Wenn ja, dann versuch mal mit:

NTPD_OPTS='-4 -g -U 0 -c /etc/ntp.conf'

in der "/etc/default/ntp" und mit folgender "/etc/ntp.conf":

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift

# 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

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server  ntp1.hetzner.de  iburst
server  ntp2.hetzner.com iburst
server  ntp3.hetzner.net iburst

# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com minpoll 14 maxpoll 15

# 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
#restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
#restrict ::1

# 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

interface ignore ipv6
interface listen ipv4

und danach:

systemctl restart ntp.service
systemctl status ntp.service
netstat -ulpen | grep -i :123

Conan179

(Themenstarter)

Anmeldungsdatum:
20. Dezember 2010

Beiträge: 235

klar kein problem:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
root@Ubuntu-1604-64bit-Openvpn-maschine:~# systemctl restart ntp.service
root@Ubuntu-1604-64bit--Openvpn-maschine:~# systemctl status ntp.service
● ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
   Active: active (running) since So 2016-06-05 23:31:39 CEST; 8s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2238 ExecStop=/etc/init.d/ntp stop (code=exited, status=0/SUCCESS)
  Process: 2251 ExecStart=/etc/init.d/ntp start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/ntp.service
           └─2264 /usr/sbin/ntpd -p /var/run/ntpd.pid -4 -g -U 0 -c /etc/ntp.conf -u 107:116

Jun 05 23:31:39 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: proto: precision = 0.042 usec (-24)
Jun 05 23:31:39 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: restrict 0.0.0.0: KOD does nothing without LIMITED.
Jun 05 23:31:39 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: Listen normally on 0 v4wildcard 0.0.0.0:123
Jun 05 23:31:39 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: Listen normally on 1 lo 127.0.0.1:123
Jun 05 23:31:39 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: Listen normally on 2 eth0 188.xxx.xxx.xxx:123
Jun 05 23:31:39 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: Listen normally on 3 tun6 192.168.6.1:123
Jun 05 23:31:39 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: Listen normally on 4 tap0 192.168.0.1:123
Jun 05 23:31:39 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: Listen normally on 5 tap5 192.168.5.1:123
Jun 05 23:31:39 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: Listening on routing socket on fd #22 for interface updates
Jun 05 23:31:40 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: receive: Unexpected origin timestamp from 91.189.94.4
root@Ubuntu-1604-64bit-Openvpn-maschine:~# netstat -ulpen | grep -i :123
udp        0      0 192.168.5.1:123         0.0.0.0:*                           0          448797      2264/ntpd
udp        0      0 192.168.0.1:123         0.0.0.0:*                           0          448795      2264/ntpd
udp        0      0 192.168.6.1:123         0.0.0.0:*                           0          448793      2264/ntpd
udp        0      0 188.xxx.xxx.xxx:123      0.0.0.0:*                           0          448791      2264/ntpd
udp        0      0 127.0.0.1:123           0.0.0.0:*                           0          448789      2264/ntpd
udp        0      0 0.0.0.0:123             0.0.0.0:*                           0          448784      2264/ntpd
root@Ubuntu-1604-64bit-Openvpn-maschine:~#
1
2
3
root@Praxisberry:~# rdate -4npu <IP-Adresse-Server>
Sun Jun  5 23:34:14 CEST 2016
root@Praxisberry:~#

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14757

Conan179 schrieb:

   Active: active (running) since So 2016-06-05 23:31:39 CEST; 8s ago
   CGroup: /system.slice/ntp.service
           └─2264 /usr/sbin/ntpd -p /var/run/ntpd.pid -4 -g -U 0 -c /etc/ntp.conf -u 107:116

Jun 05 23:31:39 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: Listen normally on 3 tun6 192.168.6.1:123
Jun 05 23:31:39 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: Listen normally on 4 tap0 192.168.0.1:123
Jun 05 23:31:39 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2264]: Listen normally on 5 tap5 192.168.5.1:123

udp        0      0 192.168.5.1:123         0.0.0.0:*                           0          448797      2264/ntpd
udp        0      0 192.168.0.1:123         0.0.0.0:*                           0          448795      2264/ntpd
udp        0      0 192.168.6.1:123         0.0.0.0:*                           0          448793      2264/ntpd
root@Praxisberry:~# rdate -4npu <IP-Adresse-Server>
Sun Jun  5 23:34:14 CEST 2016

Evtl. hat der ntpd Probleme mit einem evtl. späteren Zuweisen von IPv6-Adressen an die zahlreichen Interfaces, an denen der ntpd auf deinem Server lauschen soll/kann.

Versuch jetzt mal ohne "-4" aber mit "-U 0" in der "/etc/default/ntp".

NTPD_OPTS='-g -U 0 -c /etc/ntp.conf'

EDIT:

Und ohne "-4" auch die Ausgaben von:

cat /var/log/syslog | grep -i ntp
ls -la /usr/lib/systemd/system-preset
ls -la /etc/systemd/system-preset
ls -la /run/systemd/system-preset

BTW: Nutzt Du den ntpd auch per IPv6? Wenn nicht, dann könntest Du den ntpd ja lediglich für IPv4 konfiguriert lassen.

Conan179

(Themenstarter)

Anmeldungsdatum:
20. Dezember 2010

Beiträge: 235

also ohne -4 kommt das:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
root@Ubuntu-1604-64bit-Openvpn-maschine:~# systemctl restart ntp.service
root@Ubuntu-1604-64bit-Openvpn-maschine:~# cat /var/log/syslog | grep -i ntp
root@Ubuntu-1604-64bit-Openvpn-maschine:~# cat /var/log/syslog | grep -i ntp
root@Ubuntu-1604-64bit-Openvpn-maschine:~# ls -la /usr/lib/systemd/system-preset
ls: Zugriff auf '/usr/lib/systemd/system-preset' nicht möglich: Datei oder Verzeichnis nicht gefunden
root@Ubuntu-1604-64bit-Openvpn-maschine:~# ls -la /etc/systemd/system-preset
ls: Zugriff auf '/etc/systemd/system-preset' nicht möglich: Datei oder Verzeichnis nicht gefunden
root@Ubuntu-1604-64bit-Openvpn-maschine:~# ls -la /run/systemd/system-preset
ls: Zugriff auf '/run/systemd/system-preset' nicht möglich: Datei oder Verzeichnis nicht gefunden
root@Ubuntu-1604-64bit-Openvpn-maschine:~# netstat -ulpen | grep -i :123
udp        0      0 192.168.5.1:123         0.0.0.0:*                           0          1076427     3289/ntpd
udp        0      0 192.168.0.1:123         0.0.0.0:*                           0          1076425     3289/ntpd
udp        0      0 192.168.6.1:123         0.0.0.0:*                           0          1076423     3289/ntpd
udp        0      0 188.xxx.XXX.XXXX:123      0.0.0.0:*                           0          1076421     3289/ntpd
udp        0      0 127.0.0.1:123           0.0.0.0:*                           0          1076419     3289/ntpd
udp        0      0 0.0.0.0:123             0.0.0.0:*                           0          1076415     3289/ntpd
root@Ubuntu-1604-64bit-Openvpn-maschine:~# systemctl status ntp.service
? ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
   Active: active (running) since Mo 2016-06-06 13:16:59 CEST; 47s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3262 ExecStop=/etc/init.d/ntp stop (code=exited, status=0/SUCCESS)
  Process: 3276 ExecStart=/etc/init.d/ntp start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/ntp.service
           ??3289 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -U 0 -c /etc/ntp.conf -u 107:116

Jun 06 13:16:59 Ubuntu-1604-64bit-Openvpn-maschine ntpd[3289]: restrict 0.0.0.0: KOD does nothing without LIMITED.
Jun 06 13:16:59 Ubuntu-1604-64bit-Openvpn-maschine ntpd[3289]: Listen normally on 0 v4wildcard 0.0.0.0:123
Jun 06 13:16:59 Ubuntu-1604-64bit-Openvpn-maschine ntp[3276]:    ...done.
Jun 06 13:16:59 Ubuntu-1604-64bit-Openvpn-maschine systemd[1]: Started LSB: Start NTP daemon.
Jun 06 13:16:59 Ubuntu-1604-64bit-Openvpn-maschine ntpd[3289]: Listen normally on 1 lo 127.0.0.1:123
Jun 06 13:16:59 Ubuntu-1604-64bit-Openvpn-maschine ntpd[3289]: Listen normally on 2 eth0 188.xxx.xxx.xxx:123
Jun 06 13:16:59 Ubuntu-1604-64bit-Openvpn-maschine ntpd[3289]: Listen normally on 3 tun6 192.168.6.1:123
Jun 06 13:16:59 Ubuntu-1604-64bit-Openvpn-maschine ntpd[3289]: Listen normally on 4 tap0 192.168.0.1:123
Jun 06 13:16:59 Ubuntu-1604-64bit-Openvpn-maschine ntpd[3289]: Listen normally on 5 tap5 192.168.5.1:123
Jun 06 13:16:59 Ubuntu-1604-64bit-Openvpn-maschine ntpd[3289]: Listening on routing socket on fd #22 for interface updates
root@Ubuntu-1604-64bit-Openvpn-maschine:~# systemctl restart ntp.service

ABER wen ich von einem anderen linux afrage kommt:

1
2
3
root@Praxisberry:~# rdate -4npu <IP-Adresse-Server>
rdate: Ignoring NTP server with alarm flag set
rdate: Unable to get a reasonable time estimate

also eignetlich, als ntp server greife ich nur auf die ipv4 zu. Wen es so läuft las ich es auf ipv4 only.

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14757

Conan179 schrieb:

... ich nur auf die ipv4 zu. Wen es so läuft las ich es auf ipv4 only.

OK. Eigentlich hätte man für den Test (betr. IPv6) auch die Zeile:

interface ignore ipv6

aus der "/etc/ntp.conf"-Datei entfernen oder kommentieren (#) müssen. Aber wenn Du nur IPv4 mit dem ntpd nutzen willst, dann muss man auch nicht weiter testen/suchen (... warum es zusätzlich mit IPv6 evtl. Probleme gibt).

Conan179

(Themenstarter)

Anmeldungsdatum:
20. Dezember 2010

Beiträge: 235

Ich muss das thema wieder hoch holen. Heute nachmittag habe ich ein neustart machen müssen. Jetzt ist der ntp wieder nicht -.-

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
root@Ubuntu-1604-64bit-Openvpn-maschine:~# systemctl status ntp.service
● ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
   Active: active (exited) since Fr 2016-06-10 10:23:10 CEST; 9h ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1322 ExecStart=/etc/init.d/ntp start (code=exited, status=0/SUCCESS)

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
root@Ubuntu-1604-64bit-Openvpn-maschine:~# netstat -ulpen | grep -i :123
root@Ubuntu-1604-64bit-Openvpn-maschine:~# ls -la /run/systemd/system-preset
ls: Zugriff auf '/run/systemd/system-preset' nicht möglich: Datei oder Verzeichnis nicht gefunden
root@Ubuntu-1604-64bit-Conans-Openvpn-maschine:~# systemd-analyze blame | grep -i ntp
           265ms ntp.service

ich hab nichts, an den konfig datein geändert.

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14757

Conan179 schrieb:

Heute nachmittag habe ich ein neustart machen müssen. Jetzt ist der ntp wieder nicht -.-

root@Ubuntu-1604-64bit-Openvpn-maschine:~# netstat -ulpen | grep -i :123

Dann versuch mal:

systemctl restart ntp.service
systemctl status ntp.service
netstat -ulpen | grep -i :123

Conan179

(Themenstarter)

Anmeldungsdatum:
20. Dezember 2010

Beiträge: 235

ok, das ergebnis ist:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
root@Ubuntu-1604-64bit-Openvpn-maschine:~# systemctl restart ntp.service
root@Ubuntu-1604-64bit-Openvpn-maschine:~# systemctl status ntp.service
● ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp; bad; vendor preset: enabled)
   Active: active (running) since Fr 2016-06-10 22:25:05 CEST; 5s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2559 ExecStop=/etc/init.d/ntp stop (code=exited, status=0/SUCCESS)
  Process: 2571 ExecStart=/etc/init.d/ntp start (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/ntp.service
           └─2587 /usr/sbin/ntpd -p /var/run/ntpd.pid -4 -g -U 0 -c /etc/ntp.conf -u 107:116

Jun 10 22:25:05 Ubuntu-1604-64bitOpenvpn-maschine systemd[1]: Started LSB: Start NTP daemon.
Jun 10 22:25:05 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2587]: proto: precision = 0.042 usec (-24)
Jun 10 22:25:05 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2587]: restrict 0.0.0.0: KOD does nothing without LIMITED.
Jun 10 22:25:05 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2587]: Listen normally on 0 v4wildcard 0.0.0.0:123
Jun 10 22:25:05 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2587]: Listen normally on 1 lo 127.0.0.1:123
Jun 10 22:25:05 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2587]: Listen normally on 2 eth0 188.xxx.xxx.xxx:123
Jun 10 22:25:05 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2587]: Listen normally on 3 tun6 192.168.6.1:123
Jun 10 22:25:05 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2587]: Listen normally on 4 tap0 192.168.0.1:123
Jun 10 22:25:05 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2587]: Listen normally on 5 tap5 192.168.5.1:123
Jun 10 22:25:05 Ubuntu-1604-64bit-Openvpn-maschine ntpd[2587]: Listening on routing socket on fd #22 for interface updates
root@Ubuntu-1604-64bit-Openvpn-maschine:~# netstat -ulpen | grep -i :123
udp        0      0 192.168.5.1:123         0.0.0.0:*                           0          574421      2587/ntpd
udp        0      0 192.168.0.1:123         0.0.0.0:*                           0          574419      2587/ntpd
udp        0      0 192.168.6.1:123         0.0.0.0:*                           0          574417      2587/ntpd
udp        0      0 188.xxx.xxx.xxx:123      0.0.0.0:*                           0          574415      2587/ntpd
udp        0      0 127.0.0.1:123           0.0.0.0:*                           0          574413      2587/ntpd
udp        0      0 0.0.0.0:123             0.0.0.0:*                           0          574409      2587/ntpd

hmpf, warum läuft der wen man ihn manuell neustartet, aber nicht beim systemstart? -.-

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14757

Conan179 schrieb:

... neustartet, aber nicht beim systemstart? -.-

Dafür bräuchte man die ntpd-Eintragungen in der syslog, während des systemstarts.

Conan179

(Themenstarter)

Anmeldungsdatum:
20. Dezember 2010

Beiträge: 235

ok, in welcher log datei müste das drin sein?

lubux

Anmeldungsdatum:
21. November 2012

Beiträge: 14757

Conan179 schrieb:

... welcher log datei müste das drin sein?

In der "var/log/syslog".