[ntp:questions] Local clock question with dialup connection

Steve Kostecke kostecke at ntp.isc.org
Mon Apr 16 02:09:02 UTC 2007


On 2007-04-15, Nigel Henry <cave.dnb at tiscali.fr> wrote:

> On Sunday 15 April 2007 18:58, David Woolley wrote:
>
>> In article <200704151700.57526.cave.dnb at tiscali.fr>,
>>
>> cave.dnb at tiscali.fr (Nigel Henry) wrote:
>>
>> > ntpd is still running, but has timed out on trying to contact the
>> > Internet timeservers. If I stop, then restart ntpd, the timeservers
>> > are contacted ok,
>>
>> I'm not sure what you mean by timed out. If a server becomes
>> unreachable, it will continue to be polled and will start to be used
>> again when it becomes reachable again.

Using 'iburst' on your server lines speeds up the initial polls of a
remote time server once it becomes reachable again.

> I presumed that was a limit to the times that the servers would be
> polled, and if there was no response, as in the case of no Internet
> connection, that there would be be what I would describe as a time
> out.

ntpd will attempt to poll using the current poll interval.

>> However, if you are on a dynamic IP address, the servers will never
>> be re-acquired, and you will have to unconfigure them and reconfigure
>> them, or re-start the daemon, to get their addresses resolved again,
>> regardless of whether you have the local clock configued.
>
> Based on this i'm fairly well stuffed, apart from restarting the
> daemon when I an reconnected to the Internet with a new dynamic IP
> address.

If your ntpd is able to run long enough to populate your drift.file with
a good PLL frequency value, and you're not attempting to maintain single
microsecond offsets, there is little harm in restarting ntpd.

> So what I'm looking for is a script that will run when an Internet
> connection is re-established, and will then do a /etc/init.d/ntp stop,
> followed by a /etc/init.d/ntp start.

If you are connecting via ppp you may have a directory such as
/etc/ppp/ip-up.d/ where you can place a script that will restart ntpd
when your ppp interface is brought up.

The script is nothing more than

#!/bin/sh
/etc/init.d/ntp stop
/etc/init.d/ntp start

Another solution is to run your "local master" ntpd (i.e. the one with
the LocalCLK) on a machine that is behind your firewall/NAT system. That
will insulate it from the dynamic IP address changes. The only drawback
is that your internet connection may have to be up for as long as 17
minutes before ntpd will attempt to poll the remote time servers.

-- 
Steve Kostecke <kostecke at ntp.isc.org>
NTP Public Services Project - http://ntp.isc.org/




More information about the questions mailing list