Jak nakonfigurovat NTP clienta?

Jak nakonfigurovat NTP clienta?
« kdy: 21. 01. 2012, 18:56:11 »
Ahoj potreboval bych poradit s konfiguraci NTP klienta. Podle tohoto http://www.linuxexpres.cz/praxe/seridte-linuxu-hodinky clanku neni pouzivani ntpdate vhodne takze jsem si chtel nastavit ntpd, ale nedari se:( Vsechny servery mam stratum 2.

Kód: [Vybrat]
ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*tik.cesnet.cz   .GPS.            1 u  346 1024    1    5.706    0.305   0.32

tady je moje konfigurace NTP clienta:
Kód: [Vybrat]
# /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


# You do need to talk to an NTP server or two (or three).
#server ntp.your-provider.example

# 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: <http://www.pool.ntp.org/join.html>

#zakomentoval jsem ...
#server 0.debian.pool.ntp.org iburst
#server 1.debian.pool.ntp.org iburst
#server 2.debian.pool.ntp.org iburst
#server 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
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


#pridane servery vsechny stratum 2
server clock1.zcu.cz # TEN, ČR
server clock2.zcu.cz # TEN, ČR
server ntp1.ctt.cz
server ntp2.ctt.cz
server ntp3.ctt.cz



V souboru /etc/ntp.conf mam na konci uvedeno
Kód: [Vybrat]
#pridane servery
ntp1.ctt.cz
ntp2.ctt.cz
ntp3.ctt.cz
clock1.zcu.cz # TEN, ČR
clock2.zcu.cz # TEN, ČR

Tzn. i prikaz ntpq -p by tento stav mel reflektovat a uvedene NTP servery by se mely zobrazit ne?


trubicoid2

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #1 kdy: 21. 01. 2012, 23:13:29 »
no ja nejak nechapu, kde mas problem? proc nepouzivas ty pool?
ja mam treba totok:
Kód: [Vybrat]
server 0.ch.pool.ntp.org
server 1.ch.pool.ntp.org
server 2.ch.pool.ntp.org
server 3.ch.pool.ntp.org

server 0.europe.pool.ntp.org
server 1.europe.pool.ntp.org
server 2.europe.pool.ntp.org
server 3.europe.pool.ntp.org
a ntpq -p ukazuje totok:
Kód: [Vybrat]
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+192.33.214.57   192.33.214.12    2 u  537 1024  377   23.621   -1.998   7.178
*ntp0.as34288.ne .PPS.            1 u 1031 1024  377   18.743   -1.782   7.309
+ns1.nexellent.n 194.242.34.149   2 u  686 1024  377   21.129   -0.229   2.305
+khyber.madduck. 131.188.3.222    2 u  856 1024  377   15.213   -0.838   2.289
+ntp.tuxfamily.n 195.220.94.163   2 u  944 1024  377   51.320    0.329   2.484
-virtueledoos.nl 213.239.154.12   3 u   89 1024  377   29.675    1.530   2.990
-ntp1.adviseo.ne 192.53.103.104   2 u  909 1024  377   34.922   -3.814   2.083
-mail.topfactori 80.96.120.253    2 u   50 1024  377   68.710    8.210   1.124

trubicoid2

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #2 kdy: 21. 01. 2012, 23:19:05 »
jinak ntpdate nebo lepe sntp je zahodno pustit ve startovacim skriptu jednou a seridit cas a pak pustit ntpd.

Lol Phirae

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #3 kdy: 21. 01. 2012, 23:45:14 »
no ja nejak nechapu, kde mas problem? proc nepouzivas ty pool?
ja mam treba totok:

Taky tomu nerozumím...

Kód: [Vybrat]
driftfile /var/lib/ntp/ntp.drift
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 0.cz.pool.ntp.org iburst
server 1.cz.pool.ntp.org iburst
server 2.cz.pool.ntp.org iburst
server 3.cz.pool.ntp.org iburst
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery
restrict 127.0.0.1
restrict ::1

Kód: [Vybrat]
$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*miriel.vsobotka 195.113.144.201  2 u  154  256  377   42.238    1.723   0.526
+ntp1.kajot.cz   193.85.174.5     2 u   34  256  377   46.994    0.897   0.556
-2a01:5f0:100d:1 147.231.19.43    2 u   88  256  377  109.470    5.676   5.236
+first.blesmrt.n 195.113.144.201  2 u   30  256  377   46.390    2.052   1.273

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #4 kdy: 22. 01. 2012, 17:11:58 »
No ja myslel ze NTP servery si muzu sam vybrat...
Co je ale divne, ze vy mate ve vypisu ntpq -p tolik serveru koilik mate polozek(serveru) v konfiguraku. Zatim co ja mam ve vypisu jen jeden server. Schvalne si zkuste zmenit servery v konfiguraku na ty co mam ja a pak overit vypisem ntpq -p jestli se neco zmeni.


Lol Phirae

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #5 kdy: 22. 01. 2012, 17:22:05 »
A co kdybys radši ty zkusil jiný servery a přišel nám poreferovat? (Máš tam tři servery Contactelu, které nikdy pořádně nefungovaly a asi taky nikdy pořádně fungovat nebudou, tak asi tak...)

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #6 kdy: 22. 01. 2012, 18:03:53 »
Tak jsem tu kvuli tem referencim...:) Dal jsem tam servery:
Kód: [Vybrat]
server 0.cz.pool.ntp.org iburst
server 1.cz.pool.ntp.org iburst
server 2.cz.pool.ntp.org iburst
server 3.cz.pool.ntp.org iburst

a vysledek je porad stejny....

Kód: [Vybrat]
ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 tik.cesnet.cz   .GPS.            1 u    2   64    1    7.171   -0.042   0.188



Lol Phirae

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #7 kdy: 22. 01. 2012, 18:10:18 »
Prosímtě, a už jsi to ntd někdy po těch úpravách restartoval?

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #8 kdy: 22. 01. 2012, 18:23:00 »
Samozrejme, restartuju ho po kazde uprave...

Lol Phirae

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #9 kdy: 22. 01. 2012, 18:27:27 »
Samozrejme, restartuju ho po kazde uprave...

Aha, no tak asi holt čte jinej konfigurační soubor nebo ti ho přepisuje DHCP server nějakou pitomostí.

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #10 kdy: 22. 01. 2012, 18:48:44 »
Ok, takze pokud mi ho prepisuje DHCP a ja nemam moznost DHCP konfigurovat, ale potrebuju od DHCP adresu tak jak mu mam "rict", at si od DHCP serveru bere jen adresu, dns... proste vse krome NTP serveru? Asi to bude opravdu tim DHCP. Na to jsem uplne zapomnel ...

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #11 kdy: 22. 01. 2012, 18:57:26 »
V konfiguraku /etc/dhcp/dhclient.conf jsem narazil na polozku
Kód: [Vybrat]
request ntp-serversZakomentuju a zkusim - snad to pojede,...

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #12 kdy: 22. 01. 2012, 19:08:42 »
Mel jsi nakonec pravdu - bylo to tim DHCP serverem, prideloval mi i NTP servery. Ted uz to funguje.

Lol Phirae

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #13 kdy: 22. 01. 2012, 19:12:29 »
V konfiguraku /etc/dhcp/dhclient.conf jsem narazil na polozku
Kód: [Vybrat]
request ntp-serversZakomentuju a zkusim - snad to pojede,...

Ano, ale to tam defaultně není, tak nevím, kdo to tam napsal. :D A mohl bys kontaktovat majitele toho DHCP serveru a sdělit mu, že používání restricted stratum 1 NTP serveru je přinejmenším nevhodné?

Re:Jak nakonfigurovat NTP clienta?
« Odpověď #14 kdy: 22. 01. 2012, 19:19:44 »
Majitele kontaktuju, konfigurak byl nezmeneny. Bylo to tam defaultne. Nebyla tam jen ta jedna polozka... byla jich tam hromada - ja jsem pouze odstranil tu 
Kód: [Vybrat]
ntp-serversV kazdem pripade diky za pomoc!:)