Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
configurazione server ntpd
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian)
View previous topic :: View next topic  
Author Message
pigreco
Apprentice
Apprentice


Joined: 16 Nov 2005
Posts: 223
Location: Italia

PostPosted: Mon Sep 16, 2013 11:52 am    Post subject: configurazione server ntpd Reply with quote

Salve,
sto cercando senza successo di mettere su un server ntp per sincronizzare vari server fra loro.
Ottengo sempre uno stratum=16 per il server che ho preparato e non riesco a capire dove stia il problema, il firewall dovrebbe essere ok e non ho nessun errore nei log.

qui di seguito un pò di info:
ntpd.conf:
Code:
server 212.45.144.16 iburst
server 212.121.88.250 iburst
server 127.127.1.0
fudge  127.127.1.0 stratum 10

# you should not need to modify the following paths
driftfile   /var/lib/ntp/ntp.drift

# logfile defaults to /var/log/messages
logfile /var/log/ntp.log

# 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

# Allow local lans to sync
restrict 192.168.1.0 mask 255.0.0.0 nomodify notrap


risultato:
Code:
ntpq -c pe
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 saguaro.bilink. .INIT.          16 u    - 1024    0    0.000    0.000   0.000
 212.121.88.250  .INIT.          16 u    - 1024    0    0.000    0.000   0.000
*LOCAL(0)        .LOCL.          10 l   50   64  377    0.000    0.000   0.000


i server ntp sono raggiungibili:
Code:
ntpdate -d 212.121.88.250
16 Sep 13:47:02 ntpdate[12248]: ntpdate 4.2.6p5@1.2349-o Wed Sep 11 14:31:08 UTC 2013 (1)
transmit(212.121.88.250)
receive(212.121.88.250)
transmit(212.121.88.250)
receive(212.121.88.250)
transmit(212.121.88.250)
receive(212.121.88.250)
transmit(212.121.88.250)
receive(212.121.88.250)
server 212.121.88.250, port 123
stratum 2, precision -20, leap 00, trust 000
refid [212.121.88.250], delay 0.03352, dispersion 0.00012
transmitted 4, in filter 4
reference time:    d5e1690d.98d18648  Mon, Sep 16 2013 13:25:01.596
originate timestamp: d5e16e3e.984a086c  Mon, Sep 16 2013 13:47:10.594
transmit timestamp:  d5e16e3d.11b29f28  Mon, Sep 16 2013 13:47:09.069
filter delay:  0.03352  0.03462  0.03395  0.03380
         0.00000  0.00000  0.00000  0.00000
filter offset: 1.521704 1.522278 1.521833 1.521629
         0.000000 0.000000 0.000000 0.000000
delay 0.03352, dispersion 0.00012
offset 1.521704

16 Sep 13:47:09 ntpdate[12248]: step time server 212.121.88.250 offset 1.521704 sec



ntpq -crv:
Code:
associd=0 status=0515 leap_none, sync_local, 1 event, clock_sync,
version="ntpd 4.2.6p5@1.2349-o Wed Sep 11 14:31:06 UTC 2013 (1)",
processor="x86_64", system="Linux/3.7.5-hardened-r1", leap=00,
stratum=11, precision=-23, rootdelay=0.000, rootdisp=11.151,
refid=LOCAL(0), reftime=d5e16e9e.1e8b5fbe  Mon, Sep 16 2013 13:48:46.119,
clock=d5e16ead.8b335f1d  Mon, Sep 16 2013 13:49:01.543, peer=23637, tc=6,
mintc=3, offset=0.000, frequency=0.000, sys_jitter=0.000,
clk_jitter=0.000, clk_wander=0.000


lo stratum 11 è generato dal settaggio

Code:
 server 127.127.1.0
fudge  127.127.1.0 stratum 10


altrimenti sarebbe =16,
ogni suggerimento è mooooooooolto gradito, grazie,

Maurizio
Back to top
View user's profile Send private message
xdarma
l33t
l33t


Joined: 08 Dec 2003
Posts: 719
Location: tra veneto e friuli (italy)

PostPosted: Tue Sep 17, 2013 7:30 pm    Post subject: Re: configurazione server ntpd Reply with quote

Se non ho capito male, tu vuoi che una macchina "master" si sincronizzi via internet e faccia da time server per le altre macchine "slave" nella tua rete, giusto?
Secondo il wiki se una macchina fa da master deve avere:
Code:

# To allow machines within your network to synchronize
# their clocks with your server, but ensure they are
# not allowed to configure the server or used as peers
# to synchronize against, uncomment this line.
#
restrict 192.168.0.0 mask 255.255.255.0 nomodify nopeer notrap


La versione con:
Code:

# To deny other machines from changing the
# configuration but allow localhost:
restrict default nomodify nopeer
restrict 127.0.0.1

Va sostanzialmente usata con macchine "standalone" che si sincronizzano via internet ma non fanno da "master" per la rete locale.

Per quello che mi risulta, gli "slave" dentro /etc/ntp.conf devono avere solo:
Code:

server master_name_or_address

Se gli "slave" hanno indirizzi dinamici assegnati da un server dhcp, dovresti essere in grado di mandare l'ip del time server insieme all'indirizzo di rete configurando opportunamente dhcpd.conf

Ciao.
_________________
proud user of faKeDE-4.7.3 -> back to windowmaker -> moved to LXQt
Back to top
View user's profile Send private message
pigreco
Apprentice
Apprentice


Joined: 16 Nov 2005
Posts: 223
Location: Italia

PostPosted: Wed Sep 18, 2013 7:54 am    Post subject: Reply with quote

ciao xdarma,grazie per l'aiuto

si, hai capito bene, voglio che un mio server faccia da master per gli altri collegati attraverso una loro LAN,
se hai visto il mio file conf ho una linea del tutto simile a quella che mi hai indicato:
Code:
# Allow local lans to sync
restrict 192.168.1.0 mask 255.0.0.0 nomodify notrap


mentre la parte del localhost
Code:
restrict default nomodify nopeer
restrict 127.0.0.1

dovrebbe servire al master per utilizzare il clock locale come ultima risorsa e non dovrebbe influire su altro.

Il mio problema è che il mio master non si sincronizza con i server ntp quindi non può assumere la sua funzione

Maurizio
Back to top
View user's profile Send private message
eleaffar
n00b
n00b


Joined: 09 May 2011
Posts: 43

PostPosted: Wed Sep 18, 2013 9:56 am    Post subject: Reply with quote

pigreco wrote:
ciao xdarma,grazie per l'aiuto

...

Il mio problema è che il mio master non si sincronizza con i server ntp quindi non può assumere la sua funzione

Maurizio



Scusate l'intervento, ma sei certo che :
# /etc/init.d/ntp-client status
* status: started

anche sul server ntpd ?
:D
_________________
Ho visto il film Memento ... non me lo ricordo !
Back to top
View user's profile Send private message
pigreco
Apprentice
Apprentice


Joined: 16 Nov 2005
Posts: 223
Location: Italia

PostPosted: Wed Sep 18, 2013 11:11 am    Post subject: Reply with quote

yes sono sicuro:
Code:
/etc/init.d/ntpd status
 * status: started


e altrimenti non risponderebbe alle interrogazioni ntpq

Maurizio
Back to top
View user's profile Send private message
xdarma
l33t
l33t


Joined: 08 Dec 2003
Posts: 719
Location: tra veneto e friuli (italy)

PostPosted: Wed Sep 18, 2013 7:09 pm    Post subject: Reply with quote

Occhio che eleaffar ti suggeriva di verificare che sia stato lanciato ntp-client, non ntpd.
Quote:

Il mio problema è che il mio master non si sincronizza con i server ntp quindi non può assumere la sua funzione

Beh, puoi provare a forzare la sincronizzazione sul "master" con:
Code:
ntpdate -b 212.121.88.250

Che grossomodo è quello che fa ntp-client all'avvio.
Ti restituisce degli errori?

Ciao
_________________
proud user of faKeDE-4.7.3 -> back to windowmaker -> moved to LXQt
Back to top
View user's profile Send private message
pigreco
Apprentice
Apprentice


Joined: 16 Nov 2005
Posts: 223
Location: Italia

PostPosted: Wed Sep 18, 2013 7:40 pm    Post subject: Reply with quote

si vero chiedo scusa ho frainteso eleaffar, diceva ntp-client.


ecco:
Code:
ntpdate -b 0.europe.pool.ntp.org
18 Sep 21:37:33 ntpdate[2907]: the NTP socket is in use, exiting


però si dice nella doc per l'istruzione -b:

-b Force the time to be stepped using the settimeofday() system call, rather than slewed (default)
using the adjtime() system call. This option should be used when called from a startup file at boot
time.


pare sia utilizzabile al boot, mentre con l'istruzione di debug -d:
Code:
ntpdate -d 0.europe.pool.ntp.org
18 Sep 21:37:12 ntpdate[2894]: ntpdate 4.2.6p5@1.2349-o Wed Sep 11 14:31:08 UTC 2013 (1)
transmit(46.29.176.115)
receive(46.29.176.115)
transmit(78.46.197.35)
receive(78.46.197.35)
transmit(80.90.43.162)
receive(80.90.43.162)
transmit(193.225.118.163)
receive(193.225.118.163)
transmit(46.29.176.115)
receive(46.29.176.115)
transmit(78.46.197.35)
receive(78.46.197.35)
transmit(80.90.43.162)
receive(80.90.43.162)
transmit(193.225.118.163)
receive(193.225.118.163)
transmit(46.29.176.115)
receive(46.29.176.115)
transmit(78.46.197.35)
receive(78.46.197.35)
transmit(80.90.43.162)
receive(80.90.43.162)
transmit(193.225.118.163)
receive(193.225.118.163)
transmit(46.29.176.115)
receive(46.29.176.115)
transmit(78.46.197.35)
receive(78.46.197.35)
transmit(80.90.43.162)
receive(80.90.43.162)
transmit(193.225.118.163)
receive(193.225.118.163)
server 46.29.176.115, port 123
stratum 1, precision -22, leap 00, trust 000
refid [shm0], delay 0.05896, dispersion 0.00075
transmitted 4, in filter 4
reference time:    d5e47f68.32f4fabd  Wed, Sep 18 2013 21:37:12.199
originate timestamp: d5e47f75.9dff6da5  Wed, Sep 18 2013 21:37:25.617
transmit timestamp:  d5e47f73.2b3d9105  Wed, Sep 18 2013 21:37:23.168
filter delay:  0.05896  0.05954  0.05988  0.05946
         0.00000  0.00000  0.00000  0.00000
filter offset: 2.432290 2.431458 2.431652 2.431332
         0.000000 0.000000 0.000000 0.000000
delay 0.05896, dispersion 0.00075
offset 2.432290

server 78.46.197.35, port 123
stratum 2, precision -23, leap 00, trust 000
refid [78.46.197.35], delay 0.05698, dispersion 0.00017
transmitted 4, in filter 4
reference time:    d5e47ed7.46a93fc1  Wed, Sep 18 2013 21:34:47.276
originate timestamp: d5e47f75.d0cc98be  Wed, Sep 18 2013 21:37:25.815
transmit timestamp:  d5e47f73.5e6faea4  Wed, Sep 18 2013 21:37:23.368
filter delay:  0.05728  0.05711  0.05698  0.05704
         0.00000  0.00000  0.00000  0.00000
filter offset: 2.431264 2.431316 2.431263 2.430938
         0.000000 0.000000 0.000000 0.000000
delay 0.05698, dispersion 0.00017
offset 2.431263

server 80.90.43.162, port 123
stratum 2, precision -22, leap 00, trust 000
refid [80.90.43.162], delay 0.08635, dispersion 0.00168
transmitted 4, in filter 4
reference time:    d5e47c06.1ce94720  Wed, Sep 18 2013 21:22:46.112
originate timestamp: d5e47f76.05c06b04  Wed, Sep 18 2013 21:37:26.022
transmit timestamp:  d5e47f73.91a2b6e4  Wed, Sep 18 2013 21:37:23.568
filter delay:  0.09390  0.09451  0.08635  0.08893
         0.00000  0.00000  0.00000  0.00000
filter offset: 2.419354 2.418929 2.422655 2.421861
         0.000000 0.000000 0.000000 0.000000
delay 0.08635, dispersion 0.00168
offset 2.422655

server 193.225.118.163, port 123
stratum 2, precision -20, leap 00, trust 000
refid [193.225.118.163], delay 0.07649, dispersion 0.00005
transmitted 4, in filter 4
reference time:    d5e47eac.e400e808  Wed, Sep 18 2013 21:34:04.890
originate timestamp: d5e47f76.3b78a648  Wed, Sep 18 2013 21:37:26.232
transmit timestamp:  d5e47f73.c4d694b2  Wed, Sep 18 2013 21:37:23.768
filter delay:  0.07681  0.07666  0.07649  0.07657
         0.00000  0.00000  0.00000  0.00000
filter offset: 2.437802 2.437834 2.437913 2.437888
         0.000000 0.000000 0.000000 0.000000
delay 0.07649, dispersion 0.00005
offset 2.437913

18 Sep 21:37:23 ntpdate[2894]: step time server 46.29.176.115 offset 2.432290 sec


mi sembra tutto in regola, sbaglio?

grazie
Back to top
View user's profile Send private message
pigreco
Apprentice
Apprentice


Joined: 16 Nov 2005
Posts: 223
Location: Italia

PostPosted: Wed Sep 18, 2013 7:44 pm    Post subject: Reply with quote

ooops dimenticavo che ntpclient non funziona assieme al server ntpd

Code:
/etc/init.d/ntpd stop
 * Stopping ntpd ...                                                                                                     [ ok ]


ntpdate -b 0.europe.pool.ntp.org
18 Sep 21:41:33 ntpdate[3123]: [b]no server suitable for synchronization found[/b]


questo non lo capisco, non dovrebbe funzionare neanche in debug, no?
Back to top
View user's profile Send private message
xdarma
l33t
l33t


Joined: 08 Dec 2003
Posts: 719
Location: tra veneto e friuli (italy)

PostPosted: Thu Sep 19, 2013 5:58 pm    Post subject: Reply with quote

pigreco wrote:
Code:

ntpdate -b 0.europe.pool.ntp.org
18 Sep 21:41:33 ntpdate[3123]: [b]no server suitable for synchronization found[/b]


questo non lo capisco, non dovrebbe funzionare neanche in debug, no?

Per le prove, puoi usare il flag -q.
Prova un server indicando l'indirizzo ip (magari è un problema di risoluzione dei nomi) tipo:
Code:
ntpdate -q 46.29.176.115

Se funziona, fermi ntpd e poi forzi la sincronizzazione con il flag -b e l'indirizzo numerico.

Puoi provare anche:
Code:
ntpdate -q localhost

così vedi se ntpd lavora correttamente almeno per la macchina su cui gira.

Ma gli "slave" sono sincronizzati con il "master"?

Ciao.
_________________
proud user of faKeDE-4.7.3 -> back to windowmaker -> moved to LXQt
Back to top
View user's profile Send private message
pigreco
Apprentice
Apprentice


Joined: 16 Nov 2005
Posts: 223
Location: Italia

PostPosted: Thu Sep 19, 2013 11:24 pm    Post subject: Reply with quote

il risultato delle istruzioni che mi hai indicato con ntpd stop:
Code:
ntpdate -q 46.29.176.115
server 46.29.176.115, stratum 1, offset 2.883639, delay 0.05803
20 Sep 01:18:02 ntpdate[7216]: step time server 46.29.176.115 offset 2.883639 sec

# ntpdate -b 46.29.176.115
20 Sep 01:18:28 ntpdate[7259]: no server suitable for synchronization found
 


l'esecuzione con '-b' fallisce

il localhost con ntpd in esecuzione:
Code:
ntpdate -q localhost
server ::1, stratum 11, offset -0.000003, delay 0.02565
server 127.0.0.1, stratum 11, offset -0.000010, delay 0.02567
20 Sep 01:21:25 ntpdate[7572]: adjust time server ::1 offset -0.000003 sec


poi per la domanda sugli "slave", no, non si sono mai sincronizzati ritengo che la causa sia il "master" che ha sempre uno stratum troppo elevato
Back to top
View user's profile Send private message
xdarma
l33t
l33t


Joined: 08 Dec 2003
Posts: 719
Location: tra veneto e friuli (italy)

PostPosted: Fri Sep 20, 2013 2:26 pm    Post subject: Reply with quote

pigreco wrote:
il risultato delle istruzioni che mi hai indicato con ntpd stop:
Code:
ntpdate -q 46.29.176.115
server 46.29.176.115, stratum 1, offset 2.883639, delay 0.05803
20 Sep 01:18:02 ntpdate[7216]: step time server 46.29.176.115 offset 2.883639 sec

# ntpdate -b 46.29.176.115
20 Sep 01:18:28 ntpdate[7259]: no server suitable for synchronization found
 


l'esecuzione con '-b' fallisce

Mi sembra insolito che in modalità di test riesca a contattare il server esterno mentre in modalità di impostazione non riesca più a contattare lo stesso server.

Non saprei cos'altro suggerirti se non di ri-configurare da zero ntpd. Magari parti dalla configurazione del wiki, quindi lasciando fuori opzioni tipo noquery.

pigreco wrote:

poi per la domanda sugli "slave", no, non si sono mai sincronizzati ritengo che la causa sia il "master" che ha sempre uno stratum troppo elevato

Puoi postare la configurazione dei client?

Ciao.
_________________
proud user of faKeDE-4.7.3 -> back to windowmaker -> moved to LXQt
Back to top
View user's profile Send private message
pigreco
Apprentice
Apprentice


Joined: 16 Nov 2005
Posts: 223
Location: Italia

PostPosted: Fri Sep 20, 2013 3:02 pm    Post subject: Reply with quote

conf degli "slave":
Code:

 cat /etc/ntp.conf
# NOTES:
# DHCP clients can append or replace NTP configuration files.
# You should consult your DHCP client documentation about its
# default behaviour and how to change it.

# Name of the servers ntpd should sync with
# Please respect the access policy as stated by the responsible person.
#server      ntp.example.tld      iburst

# Common pool for random people
#server pool.ntp.org

#=============================ETAROMUNO.ETAROM:COM
server 192.168.1.8 iburst

# you should not need to modify the following paths
driftfile   /var/lib/ntp/ntp.drift

#server ntplocal.example.com prefer
#server timeserver.example.org

# Warning: Using default NTP settings will leave your NTP
# server accessible to all hosts on the Internet.

# If you want to deny all machines (including your own)
# from accessing the NTP server, uncomment:
#restrict default ignore


# To deny other machines from changing the
# configuration but allow localhost:
restrict default nomodify nopeer
restrict 127.0.0.1


# To allow machines within your network to synchronize
# their clocks with your server, but ensure they are
# not allowed to configure the server or used as peers
# to synchronize against, uncomment this line.
#
restrict 192.168.1.0 mask 255.255.255.0 nomodify nopeer notrap


"slave" ntpq -c rv:
Code:
ntpq -c rv [/quote]

associd=0 status=0628 leap_none, sync_ntp, 2 events, no_sys_peer,
version="ntpd 4.2.6p5@1.2349-o Thu Feb 28 09:54:25 UTC 2013 (1)",
processor="x86_64", system="Linux/3.7.5-hardened-r1", leap=00,
stratum=12, precision=-20, rootdelay=0.264, rootdisp=32.204,
refid=192.168.1.8,
reftime=d5e6de51.cf918a5c  Fri, Sep 20 2013 16:46:41.810,
clock=d5e6e107.dfc17668  Fri, Sep 20 2013 16:58:15.874, peer=29958, tc=9,
mintc=3, offset=-0.117, frequency=-23.590, sys_jitter=0.000,
clk_jitter=0.762, clk_wander=0.151



il "master" è stratum=11 e lo "slave" stratum="12" , direi corretto

per l'istruzione "ntpdate -b 46.29.176.115 " che fallisce sul master non riesco a farmi una idea,
proverò a riconfigurare ntpd da capo ma non sono convinto, le istruzioni non sono così tante e varie, ed è un bel pò che faccio tentativi,

possibile che influisca hardware o kernel senza che me ne renda conto?

grazie
Back to top
View user's profile Send private message
xdarma
l33t
l33t


Joined: 08 Dec 2003
Posts: 719
Location: tra veneto e friuli (italy)

PostPosted: Fri Sep 20, 2013 4:13 pm    Post subject: Reply with quote

pigreco wrote:
conf degli "slave":
Code:

# To allow machines within your network to synchronize
# their clocks with your server, but ensure they are
# not allowed to configure the server or used as peers
# to synchronize against, uncomment this line.
#
restrict 192.168.1.0 mask 255.255.255.0 nomodify nopeer notrap


Quella riga credo vada commentata, in modo da avere solo 192.168.1.8 come time server interrogabile nella lan.

Se non riesci a far sincronizzare il "master" con un server ntp esterno, secondo me dovresti cercare di sincronizzare gli "slave" con il "master". Almeno saranno tutti sbagliati uguale. ;-)
Prova a forzare la sincronizzazione di uno slave con il master con: ntpdate -b 192.168.1.8

pigreco wrote:

possibile che influisca hardware o kernel senza che me ne renda conto?

Non credo. Anche nel wiki una errata configurazione del kernel non sembra impedire la possibilità di sincronizzarsi.

Ciao.
_________________
proud user of faKeDE-4.7.3 -> back to windowmaker -> moved to LXQt
Back to top
View user's profile Send private message
pigreco
Apprentice
Apprentice


Joined: 16 Nov 2005
Posts: 223
Location: Italia

PostPosted: Fri Sep 20, 2013 5:58 pm    Post subject: Reply with quote

si quella della sincronizzazione 'tutti sbagliati uguale' è probabile che sarà la fine della questione

se avrò novità le segnalerò

grazie
Back to top
View user's profile Send private message
eleaffar
n00b
n00b


Joined: 09 May 2011
Posts: 43

PostPosted: Wed Feb 26, 2014 3:19 pm    Post subject: Reply with quote

pigreco wrote:
si quella della sincronizzazione 'tutti sbagliati uguale' è probabile che sarà la fine della questione

se avrò novità le segnalerò

grazie

Il server di da la data corretta ?
Se imposti manualmente la data sul server e fai partire ntp-client di da la data corretta ?
_________________
Ho visto il film Memento ... non me lo ricordo !
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum