Sida 1 av 1

Kolla om ntpd fungerar

Postat: 16 maj 2008, 10:59
av perhagge
Kör ntpd på en mythbuntu 7.1 maskin

Hur vet jag att det fungerar?
Hur kan man stoppa ntpd ?
Om jag kör ntpdate så säger den att "the NTP socket is in use and exeting"

/Pär

Re: Kolla om ntpd fungerar

Postat: 16 maj 2008, 11:03
av Lars
Kommandona ntpq -p och ntpdc -c loopinfo är bra:

Kod: Markera allt

$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+ntp1-sn2.hy.ska 192.36.133.17    2 u   31   64  367   10.235  -13.876   0.515
-ntp1.sp.se      .PPS.            1 u   45   64  377   23.237  -11.073   0.318
 ntp2.sp.se      .INIT.          16 u    - 1024    0    0.000    0.000   0.000
 ntp3.sp.se      .INIT.          16 u    - 1024    0    0.000    0.000   0.000
*ntp1.sth.netnod .PPS.            1 u   46   64  377   10.016  -13.864   0.430
+ntp2.sth.netnod .PPS.            1 u   31   64  377   10.075  -13.609   0.609
-ntp1.gbg.netnod .PPS.            1 u   21   64  377   16.783  -13.115   0.319
+ntp2.gbg.netnod .PPS.            1 u   30   64  377   17.495  -13.442   0.825
+ntp1.mmo.netnod .PPS.            1 u   38   64  377   20.268  -13.978   0.379
+ntp2.mmo.netnod .PPS.            1 u    8   64  367   19.937  -14.354  42.592
$ ntpdc -c loopinfo
offset:               -0.013834 s
frequency:            -35.808 ppm
poll adjust:          -30
watchdog timer:       319 s

Re: Kolla om ntpd fungerar

Postat: 16 maj 2008, 13:19
av perhagge
ntpq -p ger:
No association ID's returned
ntpdc -c loopinfo ger:
offset: 0.000000 s
frequency: 0.000 ppm
poll adjust: 0
watchdog timer: 308684 s
Är osäker om den kontaktar någon server för att ta reda på tiden

ntp.conf enligt nedan
# /etc/ntp.conf, configuration for ntpd

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.ubuntu.com

# By default, exchange time with everybody, but don't allow configuration.
# See /usr/share/doc/ntp-doc/html/accopt.html for details.
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
server time1.stupi.se
Tips på bra sevrar att ha med?

/Pär

Re: Kolla om ntpd fungerar

Postat: 16 maj 2008, 13:41
av Lars
Det kan bli så om man startar ntpd innan nätverket är uppe ordentligt, kör sudo /etc/init.d/ntp restart för att fixa det tillfälligt. De bästa servrarna att använda i Sverige är de som är listade på http://www.netnod.se/time_servers.shtml Man behöver 3-4 stycken för att få bra resultat.

Re: Kolla om ntpd fungerar

Postat: 17 maj 2008, 13:33
av perhagge
Jag gjorde en restart och nu verkar det fungera. Stoppade ntp och körde en ntpdate och drog kloackan rätt en gång, (låg ca 75 sekunder fel) och har startat om ntp igen.

Ska lägga till några till servrar.

Problem löst

Tack för hjälpen

/Pär