[ntp:questions] NTP not working after server crash

2010-08-18 Thread Andrew Kilham

 Hi,

I have a server running VMWare Server, which contains a number of  
virtual machines. The host VM and guest VM's are all running CentOS 5 64bit.


I installed NTP about a year ago and got it working on all of the 
virtual machines on this server, and it was working fine. However, I've 
just noticed that the time on one of my virtual servers is out, but it 
is still working fine on all of the other virtual machines.  I checked 
the NTP log file on the virtual machine that is having problems and it 
just stopped doing anything in April:



16 Apr 12:34:49 ntpd[680]: no servers reachable
16 Apr 12:43:28 ntpd[680]: synchronized to 192.168.15.1, stratum 3
16 Apr 12:49:45 ntpd[680]: time reset +119.777502 s
16 Apr 12:55:03 ntpd[680]: synchronized to 192.168.15.1, stratum 3
16 Apr 13:30:30 ntpd[680]: time reset -0.350146 s
16 Apr 13:34:54 ntpd[680]: synchronized to 192.168.15.1, stratum 3
16 Apr 14:39:21 ntpd[680]: no servers reachable
16 Apr 14:50:03 ntpd[680]: synchronized to 192.168.15.1, stratum 3
12 Aug 16:26:08 ntpd[2187]: ntpd exiting on signal 15
12 Aug 17:52:39 ntpd[2440]: ntpd exiting on signal 15
12 Aug 20:35:29 ntpd[3009]: ntpd exiting on signal 15


I have verified that NTP is still running, and as you can see by the 
last three lines it is still logging to the log file when I restart it. 
My memory is a little sketchy, but I believe that on April 16th (the 
date NTP stopped working on this virtual machine), VMWare crashed and I 
had to do a forced reboot of the server (along with all the VM's). I'm 
not sure how or why this would cause the problem, but I assume that it 
is related.


Here is my /etc/ntp.conf file:

# ntpd.conf

tinker panic 0
restrict 127.0.0.1
#restrict default notrust nomodify nopeer
server 192.168.15.1

driftfile /var/lib/ntp/drift
logfile /var/log/ntp.log


This config file is completely identical to all of the other virtual 
machines that do work. I have verified that the file permissions on 
/var/lib/ntp/drift are correct and I have confirmed that there is no 
firewall causing problems. Running ntpq -p on the broken VM returns:


 remote   refid  st t when poll reach   delay   
offset  jitter

==
 192.168.15.1.INIT.  16 u-   6400.000
0.000   0.000


And on one of the other VM's that is working:

 remote   refid  st t when poll reach   delay   
offset  jitter

==
*192.168.15.1173.201.38.853 u  886 1024  3771.263   
28.732  57.120


I have confirmed that I can ping 192.168.15.1 (which is the internal IP 
address for the host machine) from the VM that isn't working.


Does anyone know what could be wrong?

Cheers,

Andrew


___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


[ntp:questions] running NTP as server only

2010-08-18 Thread folkert
Hi,

Is it possible to run the NTP daemon only as a server and not as a
local-clock maintainer?
Reason: I have a virtual machine which gets its time via the vmware
tooling from the hardware server it is running on. Now this virtual
machine needs to distribute the time to clients.


Folkert van Heusden

-- 
Multitail es una herramienta flexible que permite visualizar los log
file y seguir la ejecución de comandos. Permite filtrar, añadir
colores, combinar archivos, la visualización de diferencias (diff-
view), etc.  http://www.vanheusden.com/multitail/
--
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] use ntpd, how to know unsync status on linuxsystem

2010-08-18 Thread 赵颖科

 I`m using ntpd(ntp4.2.6p1) as client in linux(2.6.26). I have some 
 questions about my user app how to know the ntp client sync status.

 1. I use ntp_gettime, is there other way?

That depends on what you want to know about the state of ntpd.  You
probably should want to know the error bound, in which case it is an
appropriate method.  If you really want to know whether it is synched,
you need to use the NTP protocol to either check the stratum (note that
this may take a long time to go to 16, when the last server stops
responding, or more detailed state variables.

   Thank you, David.
I just forcus on the return value of ntp_getime, but don`t know 
the stratum. I think the stratum means the time quality, is right?


 2. If there is no server alive, when I start ntp client, why ntptime 
 show :ntp_gettime() returns code 0, but not code 5?

I believe there was a policy decision some time ago never to declare a
failure to this interface.

  I trace the  function loop_config in the file ntpd/ntp_loopfilter.c 
 :
 I think it should be :
 ntv.maxerror = (u_int32)(MAXDISPERSE * 1e6);
 ntv.esterror = (u_int32)(MAXDISPERSE * 1e6);

I tend to agree.

 or not?

 3. If ntp server no answer for 1h or shortter time, ntpd can mark 
 unsync stat? how could I config ntpd?


Why is this important to you?  The time should still be very accurate at
that point.


 My project is about receive sample value for the merge unit, by 
IEC61850-9-2. The merge unit (MU) only show the sample count in one second. eg: 
0 -- 3999. So, my PC must get the SOC  and associated with sample value.
 When the ntpd, which run on my PC as client, cann`t receive the reply from 
ntp server, the SOC got from my PC clock will offset about 10s in 24h. So, I`m  
apt to mark the unsync stat for the sample value so qickly.

this is app map:  ntpd  ---  linux system    my app ---  MU

So, I realy want to know the unsync, as fast as I can, by some API. By your 
answer, I`ll try to check the stratum, and use local server 127...stratum 
16. When remote server no reply received, can ntpd use the local server`s 
stratum?

Maybe it help to  change the stratum so qickly as I wash?


 When I waited the help, I try to write a simple sntp client for my 
project. When I use ntp_adjtime to adjust the offset, I see ntptime show:

ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset -535.000 us, frequency -500.000 ppm, interval 1 s,
  maximum error 42516 us, estimated error 16 us,
  status 0x1 (PLL),
  time constant 2, precision 1.000 us, tolerance 500 ppm,

next to change :

ntp_adjtime() returns code 0 (OK)
  modes 0x0 (),
  offset 0.000 us, frequency -500.000 ppm, interval 1 s,
  maximum error 454516 us, estimated error 16 us,
  status 0x1 (PLL),
  time constant 2, precision 1.000 us, tolerance 500 ppm,


my function is :

static inline __attribute__((always_inline))
int sntp_adjtime(double offset)
{
struct timex ntpx;

ntpx.modes = 0;
ntp_adjtime(ntpx);

if ((ntpx.statusSTA_UNSYNC) || (fabs(offset) = 0.128)){
ntpx.modes = MOD_STATUS|MOD_MAXERROR|MOD_ESTERROR|ADJ_OFFSET;
ntpx.status = STA_PLL;
ntpx.maxerror = MAXDISPERSE;
ntpx.esterror = MAXDISPERSE;
ntpx.offset = (uint32_t)(offset*1e6);
ntp_adjtime(ntpx);

printf(sntp adjtime %f\n, offset);
}


return 0;
}

I don`t know the particular about how to use the ntp_adjtime.

I want to know how the ntpd adjust the local clock, or where can I get the 
doc about ntpd work logic?









___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions



本电子邮件及附件都属机密文件,并且仅供标明地址的个人或团体使用。
如果本电子邮件与您无关,请删除全部原始信息(包括任何原始信息的备份),并通知发件人。
This email and its attachments may be confidential and are intended solely for 
the use of the individual to whom it is addressed.
If you are not the intended recipient of this email and its attachments, you 
must take no action based upon them, nor must you copy or show them to anyone. 
Please contact the sender if you believe you have received this email in error.
___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions

[ntp:questions] phantom server with MacOSX

2010-08-18 Thread ntpquestions
I've stumbled on a weird problem with NTP 4.2.6 on MacOSX. I compiled
and installed the code myself. The box is not running whatever NTP code
is shipped with the OS. All is well (sort of). The server is chiming
away quite happily.

However it's peering with an Apple NTP server that I didn't configure.
Can anyone suggest what's caused that or how to fix it? This phantom NTP
server persists across restarts of ntpd and reboots, even though it's
not listed in /etc/ntp.conf. I have no idea where it's picking up the
name of this server from = how to get rid of it.

Although this is no big deal, I am puzzled and a bit annoyed that Apple
appear to be stamping over my NTP setup and not explaining how or why
they do that. It's the thin edge of the wedge. If His Steveness doesn't
like my NTP configuration, what else might he take exception to?

My guess is there's something buried deep in Apple's DirectoryServer.
But even if there is some secret NTP stuff there, I don't understand how
it's getting picked up by my own instance of ntpd. Unless perhaps it's
using one of Apple's shared libraries which pulls in the DirectoryServer
stuff by default.

Any suggestions?

Here's what's in /etc/ntp.conf

#
#   Clocks for {gromit,wallace}.rfc1035.com
#
server  shaun.rfc1035.com   # 93.186.33.42
server  hutch.rfc1035.com   # 195.54.233.70
server  uchiawase.rfc1035.com   # 90.155.4.149

And here's what ntpq is reporting for my ntp server:

gromit% ntpq
ntpq peers
 remote   refid  st t when poll reach   delay   offset jitter
==
-time6.apple.com 17.254.0.49  2 u   91  128  377  231.236  -15.714 1.668
+shaun.rfc1035.c 192.36.133.252 u  103  128  377   52.237   -7.862 1.401
+hutch.rfc1035.c 195.66.241.102 u   12  128  3770.104   -7.524 1.367
*uchiawase.6uk.o 157.44.176.4 2 u7  128  377   53.420   -3.990 2.236
 LOCAL(0).LOCL.   6 l 1733   6400.0000.000 0.000
___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] running NTP as server only

2010-08-18 Thread Rob
folkert folk...@vanheusden.com wrote:
 Hi,

 Is it possible to run the NTP daemon only as a server and not as a
 local-clock maintainer?
 Reason: I have a virtual machine which gets its time via the vmware
 tooling from the hardware server it is running on. Now this virtual
 machine needs to distribute the time to clients.

Did you study the vmware technical note about keeping time in virtual
machines?
It suggests that turning off this time synchronization in the vmware
tools and running normal ntp in the virtual machine is better...

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] running NTP as server only

2010-08-18 Thread Chuck Swiger
Hi--

On Aug 17, 2010, at 7:58 AM, folkert wrote:
 Is it possible to run the NTP daemon only as a server and not as a
 local-clock maintainer?
 Reason: I have a virtual machine which gets its time via the vmware
 tooling from the hardware server it is running on. Now this virtual
 machine needs to distribute the time to clients.

Virtual machines make terrible timesources-- 10's to 100's of milliseconds of 
jitter are not unusual.  If you need to run ntpd on that specific hardware, run 
it in the host ESX or Xen's Dom0 instead, and not in one of the hosted 
virtual machines.

Regards,
-- 
-Chuck

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] phantom server with MacOSX

2010-08-18 Thread Chuck Swiger
Hi, RFC-1035--

On Aug 17, 2010, at 4:32 AM, ntpquesti...@rfc1035.com wrote:
 I've stumbled on a weird problem with NTP 4.2.6 on MacOSX. I compiled
 and installed the code myself. The box is not running whatever NTP code
 is shipped with the OS. All is well (sort of). The server is chiming
 away quite happily.

You didn't mention which version of MacOS X you were running (uname -a or 
sw_vers).  The default config under 10.6 looks something like:

% ps auxww | grep ntpd | grep -v grep
root55   0.0  0.0  2435208   1144   ??  Ss5Aug10   0:52.39 
/usr/sbin/ntpd -c /private/etc/ntp-restrict.conf -n -g -p /var/run/ntpd.pid -f 
/var/db/ntp.drift

% cat /private/etc/ntp-restrict.conf
# Access restrictions documented in ntp.conf(5) and
# http://support.ntp.org/bin/view/Support/AccessRestrictions
# Limit network machines to time queries only

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

# localhost is unrestricted
restrict 127.0.0.1
restrict -6 ::1

includefile /private/etc/ntp.conf

% cat /private/etc/ntp.conf
server time.apple.com

 However it's peering with an Apple NTP server that I didn't configure.
 Can anyone suggest what's caused that or how to fix it? This phantom NTP
 server persists across restarts of ntpd and reboots, even though it's
 not listed in /etc/ntp.conf. I have no idea where it's picking up the
 name of this server from = how to get rid of it.

Pay attention to the launch arguments of ntpd; make sure you are running the 
binary you expect and pointing to the config file you expect.  If need be, run 
ntpd -d, make sure it returns your 4.2.6 version rather than something like 
ntpd 4.2@1.1520-o which would be the base OS binary; and pay attention to 
newpeer events.

If that's still not enough, dtruss /usr/sbin/ntpd -n -d (or whatever the path 
to your binary is) should return output like:

write_nocancel(0x1, addto_syslog: Listening on routing socket on fd #27 for 
interface updates\n\0, 0x4A) = 74 0
write_nocancel(0x1, local_clock: time 0 offset 0.00 freq 0.000 state 
0\n\0, 0x37) = 55 0
open_nocancel(/etc/ntp.conf\0, 0x0, 0x1B6) = 3 0
fstat64(0x3, 0x7FFF5FBFED60, 0x7FFF5FBFEE2C) = 0 0
read_nocancel(0x3, server time.apple.com\n\0, 0x1000) = 22 0

...and that will show you exactly which config file is being opened and what 
was read from it.

 Although this is no big deal, I am puzzled and a bit annoyed that Apple
 appear to be stamping over my NTP setup and not explaining how or why
 they do that. It's the thin edge of the wedge. If His Steveness doesn't
 like my NTP configuration, what else might he take exception to?

I admire the humor behind the notion that Steve would care about your NTP 
configuration; if the issue comes down to a user configuration issue, you'll 
hopefully retain this sense of humor.  :-)

Regards,
-- 
-Chuck

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] running NTP as server only

2010-08-18 Thread Maarten Wiltink
folkert folk...@vanheusden.com wrote in message
news:20100817145830.gh5...@belle.intranet.vanheusden.com...

 Is it possible to run the NTP daemon only as a server and not as a
 local-clock maintainer?
 Reason: I have a virtual machine which gets its time via the vmware
 tooling from the hardware server it is running on. Now this virtual
 machine needs to distribute the time to clients.

server 127.127.1.0 comes to mind.

Groetjes,
Maarten Wiltink


___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] use ntpd, how to know unsync status on linuxsystem

2010-08-18 Thread E-Mail Sent to this address will be added to the BlackLists
ÕÔÓ±¿Æ wrote:
 I just forcus on the return value of ntp_getime,
   but don`t know the stratum.
  I think the stratum means the time quality, is right?

http://en.wikipedia.org/wiki/Network_Time_Protocol#Clock_strata
http://www.eecis.udel.edu/~mills/ntp/html/index.html

-- 
E-Mail Sent to this address blackl...@anitech-systems.com
  will be added to the BlackLists.

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] use ntpd, how to know unsync status on linuxsystem

2010-08-18 Thread E-Mail Sent to this address will be added to the BlackLists
ÕÔÓ±¿Æ wrote:
 I want to know how the ntpd adjust the local clock,
  or where can I get the doc about ntpd work logic?

http://www.ietf.org/rfc/rfc5905.txt
http://www.eecis.udel.edu/~mills/ntp/html/index.html

http://www.ntp.org/downloads.html
http://support.ntp.org/bin/view/Main/SoftwareDownloads


-- 
E-Mail Sent to this address blackl...@anitech-systems.com
  will be added to the BlackLists.

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] running NTP as server only

2010-08-18 Thread folkert
Hi,

  Is it possible to run the NTP daemon only as a server and not as a
  local-clock maintainer?
  Reason: I have a virtual machine which gets its time via the vmware
  tooling from the hardware server it is running on. Now this virtual
  machine needs to distribute the time to clients.
 Virtual machines make terrible timesources-- 10's to 100's of
 milliseconds of jitter are not unusual.

I don't think that is in all situations the case. Depends on the
scheduling by the hypervisor. iirc ibm pseries lpars don't have this
problem. That is why they have (x)ntp running in each of them normally.

 If you need to run ntpd on that specific hardware, run it in the
 host ESX or Xen's Dom0 instead, and not in one of the hosted
 virtual machines.

Yes, that is what I propose:
- let the hypervisor sync to a reliable accure timesource
- sync the vms to the hypervisor with some mechanism. e.g. on vmware you
  have the vmware tooling which runs in the vm and syncs time to the
  hypervisor (and also things like memory ballooning etc)
- let the vm then distribute the notion of time it got from the
  hypervisor to clients

Somewhere this week I'll test how this works: I put together what I was
asking, a program which picks the time from the local clock and then
sends this via ntp. Then I'll have two systems (which run directly on
hardware, not a vm) that will have a couple of low-stratum servers to
sync against as well as my vm. If they then declare my solution as a
falseticker and/or with a high jitter, I then know it won't works.
Agree?


Folkert van Heusden

-- 
Ever wonder what is out there? Any alien races? Then please support
the s...@home project: setiathome.ssl.berkeley.edu
--
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] running NTP as server only

2010-08-18 Thread Chuck Swiger
Hi--

On Aug 18, 2010, at 2:01 PM, folkert wrote:
 Virtual machines make terrible timesources-- 10's to 100's of
 milliseconds of jitter are not unusual.
 
 I don't think that is in all situations the case. Depends on the
 scheduling by the hypervisor.

It depends on the hypervisor, the hardware, the workload, etc.

 iirc ibm pseries lpars don't have this
 problem. That is why they have (x)ntp running in each of them normally.

The type of latency you might see from a lightly loaded box might well be a lot 
better than what you see from a virtual webhosting company which jams as many 
VMs as it possibly can before the clients yell about slow web performance...

 If you need to run ntpd on that specific hardware, run it in the
 host ESX or Xen's Dom0 instead, and not in one of the hosted
 virtual machines.
 
 Yes, that is what I propose:
 - let the hypervisor sync to a reliable accure timesource
 - sync the vms to the hypervisor with some mechanism. e.g. on vmware you
  have the vmware tooling which runs in the vm and syncs time to the
  hypervisor (and also things like memory ballooning etc)
 - let the vm then distribute the notion of time it got from the
  hypervisor to clients

I agree up to the last part.  The quality of time you get from querying ntpd 
running in the hypervisor should be noticably / obviously better than what you 
would get from ntpd running in a VM.  Set up both and compare the jitter your 
clients see for yourself.

 Somewhere this week I'll test how this works: I put together what I was
 asking, a program which picks the time from the local clock and then
 sends this via ntp. Then I'll have two systems (which run directly on
 hardware, not a vm) that will have a couple of low-stratum servers to
 sync against as well as my vm. If they then declare my solution as a
 falseticker and/or with a high jitter, I then know it won't works.
 Agree?

Yes, testing is a fine idea.

Regards,
-- 
-Chuck

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions


Re: [ntp:questions] phantom server with MacOSX

2010-08-18 Thread Seth Goodman
In article 1657.1282044...@gromit.rfc1035.com,  wrote:

 
 Any suggestions?
 

Chuck gave you the A answer.  The short-cut answer, at least in 10.6, 
is:

System Preferences - Date  Time

UNcheck Set date and time automatically.

Your Mac will now stop infecting, er, injecting time.apple.com into your 
config file.

I'm actually impressed, being fairly new to the Mac, that they're using 
NTP, instead of some Apple created utility, to set the time.

And remember:

Steve loves you


-- 
Seth Goodman

___
questions mailing list
questions@lists.ntp.org
http://lists.ntp.org/listinfo/questions