[olug] NTPd w/modem support

Jeff Hinrichs jlh at cox.net
Tue Feb 3 05:47:14 UTC 2004


----- Original Message ----- 
From: "Tim Bornholtz" <tim at bornholtz.com>
To: "Omaha Linux User Group" <olug at olug.org>
Sent: Monday, February 02, 2004 7:48 PM
Subject: Re: [olug] NTPd w/modem support


>
> PS wrote:
>
> > Has anyone had any experience setting up a time server to update time
> > using a modem? Our network does not have internet access and we need
> > to use a modem to dial the time server in Boulder, Co.
> > Thanks in advance,
> > Patrick
> >
> <rant>
>
> Am I the only one who sees all of the responses to this as a *serious*
> sledgehammer approach to a problem?  NIST has a web page explaining the
> number to call and the response that is received at:
> http://www.boulder.nist.gov/timefreq/service/acts.htm
>
> Then you should be able to set ntpd up in burst mode or with a -q to
> exit ntpd after the first sync.
>
> I guess that I don't really know the answer to the question but the
> question was how to use ntpd with current hardware, I don't think the
> answers of "Go buy a few hundred dollars worth of hardware to solve
> this" is a very good answer.
>
> </rant>
>
> sorry.
>
> -Tim
No, you are right, imho.  I googled and found:
 http://www.eecis.udel.edu/~mills/ntp/html/drivers/driver18.html

and then
http://www.ntp.org/ntpfaq/NTP-s-trouble.htm

The following solution has been donated by Eric W. Bates:

When using PPP on FreeBSD or NetBSD (Linux kernel does not properly support
pppd's demand dialing; so you will have to solve this another way), I
configured my pppd options to ignore traffic on the NTP port (snippet):

### demand dialing options
demand                          # only actually connect ppp on demand
holdoff         10              # after connection drops, wait 10
                                #   seconds before dialing again
idle            1500            # drop connection after 25 minutes of
                                #   no traffic
active-filter   'not port ntp'  # don't regard ntp packets as link
activityThen in the scripts ip-up and ip-down I start and stop xntpd
(respectively):

# Start any IP activity here that should only run while the modem is
#   connected
/usr/sbin/xntpd -p /var/run/xntpd.pid# During boot, when pppd is first
initialized a connection is always
# made (not clear why -- named?), but when xntpd is started at that
# time it does not write the PID file (not clear why -- filesystem not
# writable?); so there is a case where the PID file is not readable.

PIDFILE=/var/run/xntpd.pid
if [ -r $PIDFILE ]; then
    kill -TERM $(cat $PIDFILE)
    rm $PIDFILE
else
    # Get the process ID (do the "grep -v" to exclude this search from
    #  the result.
    kill -TERM $(ps ax | grep xntpd | grep -v grep | cut -c 1-5)
fiThis results in a ppp0 interface which is configured at boot and dials
only when there is demand for IP on its route. Upon dial-up NTP is started
and the sync traffic does not prevent the dial-up from timing out, allowing
the modem to hang up. Upon hang-up, the NTP daemon is stopped.

This has worked nicely for me for some years. I recognize that frequent
connect/disconnects tend to mess with ntpd's ability to sync, but my work
habits are such that once the PPP is up and live, it tends to stay up for
long periods. Good enough for a workstation at home.



Not exactly everything they were looking for but no need to buy hardware
either.



hth,

Jeff





More information about the OLUG mailing list