ntpd on dial up machine: no DNS resolving => giving up on all servers

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by Arno Wal » Mon, 08 Jun 2009 06:33:44



Hello,

i am using ntpd (4.2.4p6+dfsg-1; debian/sid) on a PC with dial up
connection. The PC is not online at boot time, but is turned online manually
when required via pppd.

ntpd is started at boot time and automatically can handle interfaces that
are brought up or down while ntpd is running since 4.2.4p0+dfsg-1. But the
problem is, that ntpd cannot resolve the ntp-server names at startup
(because the PC is offline) and gives up on them. When the ppp interface is
brough up, ntpd does recognize this, but does not retry to resolve the
servers.

I cannot find a configuration option to change this. Is there something I
can do to make ntpd look up the servers again when the PC is going online?

An alternative was to (re)start ntpd on ip-up instead of starting it at boot
time. The problem with this is that (if I am not wrong) ntpd does a big time
step instead of just little time adjustments once. This can make the mail
server dovecot stop if time is set back by too many seconds. So is there an
option to forbid ntpd such a big time step at startup?

Thanks,
Arno
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by Harlan Ste » Mon, 08 Jun 2009 07:49:31

>>> In article <h0enbo$cme$ XXXX@XXXXX.COM >, Arno Wald < XXXX@XXXXX.COM > writes:

Arno> ntpd is started at boot time and automatically can handle interfaces
Arno> that are brought up or down while ntpd is running since
Arno> 4.2.4p0+dfsg-1. But the problem is, that ntpd cannot resolve the
Arno> ntp-server names at startup (because the PC is offline) and gives up
Arno> on them. When the ppp interface is brough up, ntpd does recognize
Arno> this, but does not retry to resolve the servers.

There is an option to have ntpd retry failed DNS lookups for "longer". This
is in ntp-dev however (which is about to become ntp-4.2.6).

Arno> I cannot find a configuration option to change this. Is there
Arno> something I can do to make ntpd look up the servers again when the PC
Arno> is going online?

Use IP numbers instead of names.

Get a reasonably inexpensive GPS device and use that for time (or if
geographically convenient, one of the radio refclocks).

Arno> An alternative was to (re)start ntpd on ip-up instead of starting it
Arno> at boot time. The problem with this is that (if I am not wrong) ntpd
Arno> does a big time step instead of just little time adjustments
Arno> once. This can make the mail server dovecot stop if time is set back
Arno> by too many seconds. So is there an option to forbid ntpd such a big
Arno> time step at startup?

You really only want to prevent ntpd from stepping the time backwards.

This topic is one for wider discussion. Ideally, we'd get something useful
out of POSIX or some other standard. Or we could all agree on a useful spec
and motivate OS vendors and Standards groups to implement it.
--
Harlan Stenn < XXXX@XXXXX.COM >
http://www.yqcomputer.com/ - be a member!

 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by Richard B. » Mon, 08 Jun 2009 08:33:02


Whether or not ntpd steps the clock depends on how far off it is. If
the clock was off by 15 minutes, most people would want it corrected
immediately rather than having the offset amortized over three or four
days! I believe that the default threshold is 128 seconds; less than
that, the clock will slew. If more than 128 seconds the clock will step.

If exact time and/or close agreement among a number of systems is
wanted, it's best to try to keep the systems up 24x7; the reason being
that NTPD may need as long as ten hours to synchronize the clock from a
cold start. Once synchronization has been achieved, NTPD should be able
to maintain it with little effort. Keeping the systems running also
tends to stabilize the temperature which can be most helpful in keeping
accurate time.
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by Richard B. » Mon, 08 Jun 2009 11:20:34


If you need to SET the time, do it before starting anything else.

Also, keep in mind that NTPD can need many hours to set both phase
(time) and frequency accurately! It works best if you run it 24x365.
Once set, NTPD should maintain the correct time. Some sites, for one
reason or another, cannot run 24x365. If this is the case with your
site you should investigate tools other than NTP.
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by Arno Wal » Mon, 08 Jun 2009 18:24:50


It would be good if a retry for a lookup would be started in case of a new
network interface is showing up, too.

Also if a ntp-server is no longer reachable it would be good to recheck the
IP address. E.g. if you are using a ntp-server-pool name and retrieve a
"random" IP address from this pool and the server is going offline after
some days, it would be a good idea to retrieve a new IP address.


I do not like to hard wire IP addresses in configs. It is less robust IMHO.
Also you drop the functionality of using server-pools.


This is a nice idea. But maybe it is a little bit oversized for just a
simple working PC? But I keept it in mind.


Yes, right.

Thanks,
Arno
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by David Wool » Mon, 08 Jun 2009 18:26:33


More like three or four weeks, if the clock frequency error is << 500ppm.


The threshold is 128ms. Anything more than 0.5seconds disables the,
higher accuracy, kernel discipline.

Note, if one doesn't mind backwards steps of less than many seconds, one
would need ntpd offline for many days to have problems.

I believe the issue is keeping the internet connection running, rather
than keeping the machine running.
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by Arno Wal » Mon, 08 Jun 2009 18:29:32


Yes, ok. But in my configuration this is a problem.


Ok. I have found the tool "chrony", which seems to be a good solution, as
long as the PC-clock is not jumping around (perhaps because of an empty
BIOS-battery, etc.) but always is running wrong for the same amount of time.
This tool learns about the usual speed of the clock and corrects it, even if
the PC is offline. So I hope not to have big time differences anymore, so
that the time can be corrected in small adjustments always.

Thanks,
Arno
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by David Wool » Mon, 08 Jun 2009 18:38:23


So does ntpd. I think chrony may also monitor the time of year clock to
allow it to correct for when the machine, rather than just the network
is down.

Note that ntpd only saves the clock frequency every hour, and I am
becoming quite sympathetic to the idea that chrony behaves better than
ntpd in real world conditions.
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by David Lor » Mon, 08 Jun 2009 19:28:06


I used chrony on dial-on-demand firewalls (486 running NetBSD). Some of
chrony features weren't supported by NetBSD so I had two of these
running 24/7 and they just worked. Somewhere I still have the stats as
to offsets but best I can remember is they were more consistent than I
get now with always-on adsl broadband and ntpd (due I guess to
assymetric connection badly affected by heavy load). As already
suggested, a gps or radioclock is best solution, that's what I'm
going for, once I can work out getting good signals into my
'Faraday Cage' of a house surrounded by hills. :-)

David
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by E-Mail Sen » Tue, 09 Jun 2009 07:12:58


> if a ntp-server is no longer reachable it would be good
> to recheck the IP address. E.g. if you are using a
> ntp-server-pool name and retrieve a "random" IP address
> from this pool and the server is going offline after
> some days, it would be a good idea to retrieve a new
> IP address.

Isn't that what the preempt option is for?
e.g. pool pool.ntp.org preempt


--
E-Mail Sent to this address < XXXX@XXXXX.COM >
will be added to the BlackLists.
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by E-Mail Sen » Tue, 09 Jun 2009 07:13:00


> i am using ntpd (4.2.4p6+dfsg-1; debian/sid) on a PC with
> dial up connection. The PC is not online at boot time,
> but is turned online manually when required via pppd.
>
> ntpd is started at boot time and automatically can handle
> interfaces that are brought up or down while ntpd is
> running since 4.2.4p0+dfsg-1.
> But the problem is, that ntpd cannot resolve the
> ntp-server names at startup (because the PC is offline)
> and gives up on them.
> When the ppp interface is brough up, ntpd does recognize
> this, but does not retry to resolve the servers.
>
> I cannot find a configuration option to change this.
> Is there something I can do to make ntpd look up the
> servers again when the PC is going online?

Would the (not currently implemented) dynamic option help with
that? Perhaps used with the preempt option?

e.g. server ntp.netcologne.de dynamic preempt
or pool pool.ntp.org dynamic preempt

--
E-Mail Sent to this address < XXXX@XXXXX.COM >
will be added to the BlackLists.
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by E-Mail Sen » Tue, 09 Jun 2009 11:26:56


> ntpd is started at boot time and automatically can handle
> interfaces that are brought up or down while ntpd is
> running since 4.2.4p0+dfsg-1.
> But the problem is, that ntpd cannot resolve the ntp-server
> names at startup (because the PC is offline) and gives up
> on them.
> When the ppp interface is brough up, ntpd does recognize
> this, but does not retry to resolve the servers.
>
> Is there something I can do to make ntpd look up the servers
> again when the PC is going online?

Put a script into ip-up.d to restart ntp when the link comes up?
< http://www.yqcomputer.com/ ;

--
E-Mail Sent to this address < XXXX@XXXXX.COM >
will be added to the BlackLists.
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by Arno Wal » Tue, 09 Jun 2009 16:14:51


Maybe!? I do not understand the description of "preempt", "persistent" and
"mobilized", etc. in the man page.

--
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by Arno Wal » Tue, 09 Jun 2009 16:17:12


The dynamic option is obsolete and no longer required as a recent ntpd
handles servers automatically as dynamic if required.


I will try to understand the preempt option again later.

--
 
 
 

ntpd on dial up machine: no DNS resolving => giving up on all servers

Post by Arno Wal » Tue, 09 Jun 2009 16:19:43


This is one solution that I thought about. But ntpd does set the clock hard
(in one big step if required) at startup. This is ok if it is done at boot
time before other services are started, but in my case it would bring
dovecot to stop if the time step is to big and backward.

--