On Jan 23, 2007, at 2:53 PM, Bruno Voigt wrote:
Jacques Normand wrote:
I'm running debian/unstable on my laptop and often the LAN/WLAN
is not connected (yet)
when the system is starting up - including NTPD.
NTPD then seems to discard all unreachable server entries and
ends up with no peers left.
In some googled doc I found the ntp.conf option "dynamic" to tell
it that some peers may become available later on,
but the debian ntpd doesnt't seem to understand it - or I don't
know how to use it correctly.
What is the best way to configure the ntpd in such an environment ?
How about calling the init.d script from /etc/network/interfaces?
I mean, there is little need for having the deamon running while
offline and providing that your clock does not drift too much, that
should do it.
That is hard to configure reliable because of stuff like openvpn
that also needs a varying timespan to settle etc..
So I would really like to know a way to tell ntpd to not give up on
a server entry if it is not reachable/resolvable on the first try:
Jan 23 21:06:27 europa ntpd_initres[5255]: host name not found:
0.debian.pool.ntp.org │
Jan 23 21:06:27 europa ntpd_initres[5255]: couldn't resolve
`0.debian.pool.ntp.org', giving up on it │
Try replacing the symbolic name in one of the "server" lines in /etc/
ntp.conf with an absolute IP address. Then comment out (or simply
remove) all the other servers to minimize clutter. It might also be
a good idea to add the "minpoll 10" option to the server you keep.
E.g.
The default /etc/ntp.conf file has (just the server lines):
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
Replace them with the single line:
server xx.yy.zz.ww minpoll 10 iburst
Where xx.yy.zz.ww is chosen from one of the numeric IP addresses
returned by doing
host pool.ntp.org
This will avoid the "can't resolve, so giving up" phenomenon because
the IP address is already known and doesn't need to be resolved.
It will also tell ntpd to poll no more than often than once every
1024 seconds (about 17 minutes), which will reduce the frequency of
useless ntp packets that can't be delivered. Without the "minpoll
10" it will default to "minpoll 6" which will poll every 64 seconds
(about 1 minute). If you don't usually stay connected to the
internet for longer than a half-hour or so at a time, try "minpoll 8"
which will poll every 256 seconds (4-5 minutes). The object is to
get a few polls out to the server and back during each period of
internet connectivity.
The downside is that you have to pick one of the pool.ntp.org servers
and stick with it. If it goes down or leaves the net, you have to be
aware of that possibility and be ready to choose a different server
when it happens. Using a symbolic DNS address (default for those
with reliable internet connections, but not a viable option for you)
will get a random choice from a known-good list each time ntpd is
started up.
I've deliberately avoided giving a particular IP address (used
xx.yy.zz.ww, instead) to avoid having a bunch of novices bombarding
some unfortunate single server in the case that this advice gets
posted to a wiki and used by lots of folks. So, "some assembly
required" is the price of life in the real world.
Hope this helps!
Rick