Dobrý den,
potřebuji bez ručních zásahů nastavit ntp klienta tak, aby vždy synchronizoval čas podle serveru.
Nyní mám stav takový, že bios (špatná baterie) má nastaven čas špatně a ntp klient ho neopravý .
Přitom ntp se souští s parametrem -g a konektivita na ntp servery je.
Můžete mi prosím poradit proč se čas nesynchronizuje?
Moc děkuji
$ hwclock
2023-02-28 20:02:22.117538+01:00
$ date
t 28. nora 2023, 20:08:36 CET
Ntp klient má konfigurační soubor:
$ cat /etc/ntpsec/ntp.conf
# /etc/ntpsec/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntpsec/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list
# To enable Network Time Security support as a server, obtain a certificate
# (e.g. with Let's Encrypt), configure the paths below, and uncomment:
# nts cert CERT_FILE
# nts key KEY_FILE
# nts enable
# You must create /var/log/ntpsec (owned by ntpsec:ntpsec) to enable logging.
#statsdir /var/log/ntpsec/
#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
# This should be maxclock 7, but the pool entries count towards maxclock.
tos maxclock 11
# Comment this out if you have a refclock and want it to be able to discipline
# the clock by itself (e.g. if the system is not connected to the network).
tos minclock 4 minsane 3
# Specify one or more NTP servers.
# Public NTP servers supporting Network Time Security:
server tik.cesnet.cz
server tak.cesnet.cz
#server time.cloudflare.com nts
# pool.ntp.org maps to about 1000 low-stratum NTP servers. Your server will
# pick a different set every time it starts up. Please consider joining the
# pool: <https://www.pool.ntp.org/join.html>
server 127.127.0.1
fudge 127.127.0.1 stratum 1
#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/ntpsec-doc/html/accopt.html
# for details.
#
# 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 default kod notrap nomodify nopeer noquery limited
# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1
Zde je log z restartu aplikace:
Feb 28 20:00:09 debian systemd[1]: Starting ntpsec.service - Network Time Service...
Feb 28 20:00:09 debian ntpd[37547]: INIT: ntpd ntpsec-1.2.2: Starting
Feb 28 20:00:09 debian ntp-systemd-wrapper[37547]: 2023-02-28T20:00:09 ntpd[37547]: INIT: ntpd ntpsec-1.2.2: Starting
Feb 28 20:00:09 debian ntp-systemd-wrapper[37547]: 2023-02-28T20:00:09 ntpd[37547]: INIT: Command line: /usr/sbin/ntpd -p /run/ntpd.pid -c /etc/ntpsec/ntp.conf -g -N -u ntps
ec:ntpsec
Feb 28 20:00:09 debian ntpd[37547]: INIT: Command line: /usr/sbin/ntpd -p /run/ntpd.pid -c /etc/ntpsec/ntp.conf -g -N -u ntpsec:ntpsec
Feb 28 20:00:09 debian systemd[1]: Started ntpsec.service - Network Time Service.
Feb 28 20:00:09 debian ntpd[37549]: INIT: precision = 0.264 usec (-22)
Feb 28 20:00:09 debian ntpd[37549]: INIT: successfully locked into RAM
Feb 28 20:00:09 debian ntpd[37549]: CONFIG: readconfig: parsing file: /etc/ntpsec/ntp.conf
Feb 28 20:00:09 debian ntpd[37549]: CLOCK: leapsecond file ('/usr/share/zoneinfo/leap-seconds.list'): good hash signature
Feb 28 20:00:09 debian ntpd[37549]: CLOCK: leapsecond file ('/usr/share/zoneinfo/leap-seconds.list'): loaded, expire=2023-12-28T00:00Z last=2017-01-01T00:00Z ofs=37
Feb 28 20:00:09 debian ntpd[37549]: INIT: Using SO_TIMESTAMPNS(ns)
Feb 28 20:00:09 debian ntpd[37549]: IO: Listen and drop on 0 v6wildcard [::]:123
Feb 28 20:00:09 debian ntpd[37549]: IO: Listen and drop on 1 v4wildcard 0.0.0.0:123
Feb 28 20:00:09 debian ntpd[37549]: IO: Listen normally on 2 lo 127.0.0.1:123
Feb 28 20:00:09 debian ntpd[37549]: IO: Listen normally on 3 enp1s0 10.2.11.18:123
Feb 28 20:00:09 debian ntpd[37549]: IO: Listen normally on 4 enp1s0 10.2.11.14:123
Feb 28 20:00:09 debian ntpd[37549]: IO: Listen normally on 5 enp2s0 192.168.12.195:123
Feb 28 20:00:09 debian ntpd[37549]: IO: Listen normally on 6 enp2s0:0 192.168.100.195:123
Feb 28 20:00:09 debian ntpd[37549]: IO: Listen normally on 7 lo [::1]:123
Feb 28 20:00:09 debian ntpd[37549]: IO: Listen normally on 8 enp1s0 [fe80::204:5fff:fe7e:3bd9%2]:123
Feb 28 20:00:09 debian ntpd[37549]: IO: Listen normally on 9 enp2s0 [fe80::204:5fff:fe7e:3bda%3]:123
Feb 28 20:00:09 debian ntpd[37549]: IO: Listening on routing socket on fd #26 for interface updates
Feb 28 20:00:09 debian ntpd[37549]: REFCLOCK: refclock_newpeer: clock type 0 invalid
Feb 28 20:00:09 debian ntpd[37549]: PROTO: 127.127.0.1 unlink local addr 127.0.0.1 -> <null>
Feb 28 20:00:09 debian ntpd[37549]: INIT: MRU 10922 entries, 13 hash bits, 65536 bytes
Feb 28 20:00:09 debian ntpd[37549]: INIT: OpenSSL 3.0.9 30 May 2023, 30000090
Feb 28 20:00:09 debian ntpd[37549]: NTSc: Using system default root certificates.
Feb 28 20:00:09 debian ntpd[37549]: statistics directory /var/log/ntpsec/ does not exist or is unwriteable, error No such file or directory
Feb 28 20:00:10 debian ntpd[37549]: DNS: dns_probe: tik.cesnet.cz, cast_flags:1, flags:20801
Feb 28 20:00:10 debian ntpd[37549]: DNS: dns_check: processing tik.cesnet.cz, 1, 20801
Feb 28 20:00:10 debian ntpd[37549]: DNS: Server taking: 195.113.144.201
Feb 28 20:00:10 debian ntpd[37549]: DNS: dns_take_status: tik.cesnet.cz=>good, 0
Feb 28 20:00:11 debian ntpd[37549]: DNS: dns_probe: tak.cesnet.cz, cast_flags:1, flags:20801
Feb 28 20:00:11 debian ntpd[37549]: DNS: dns_check: processing tak.cesnet.cz, 1, 20801
Feb 28 20:00:11 debian ntpd[37549]: DNS: Server taking: 195.113.144.238
Feb 28 20:00:11 debian ntpd[37549]: DNS: dns_take_status: tak.cesnet.cz=>good, 0