Subject: Re: ntpd What is my best plan of attack?
To: None <netbsd-help@netbsd.org>
From: Jonathan A. Kollasch <jakollasch@mcleodusa.net>
List: netbsd-help
Date: 07/06/2004 14:33:53
--Boundary-00=_h6v6A7+kmvKYibl
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
On Tuesday, June 29, 2004 03:14 pm, Glen Johnson wrote:
> Dear netbsd-help,
> I have a small home network with a 486 as my NetBSD box. I am in the
> process of making it do more for me. One of the things I want to do with
> it is have it run as my time server that all my other computers synchronize
> from. I read through most of the ntpd man page and the ntpdate man
> page. I do understand that it is a bad idea to run them both
> simultaneously. The man pages do a fine job of describing every possible
> flag or setting available. What I can't find is something that pulls it
> all together to tell me what I need to do to have my 486 operate as a time
> server and yet when I dial up my ISP then sync to a real time server, or
> three.
> Should I:
> 1. Run ntpd when I am not connected to my ISP.
> 2. Disable ntpd before connecting to my ISP.
> 3. Run ntpdate.
> 4. R enable ntpd after the update.
This is sort of how MandrakeLinux 10's /etc/rc.d/init.d/ntpd initscript
(attached) operates. (However, I never actively sync my server (see below))
> OR is there some special line up of flags and such that tells ntpd to do
> such a thing when I connect. I suppose I would put such a thing in my
> ip-up script.
>
> Any help would be very helpful!
> Thanks,
> Glen
The simplest is to just run ntpd constantly (on both your server _and_ your
clients).
- With this setup your server will sync itself to an upstream server(s) when
nessescary/possible.
- Setup your clients so that their only time servers are themselves and your
server (486).
Jonathan Kollasch
--Boundary-00=_h6v6A7+kmvKYibl
Content-Type: application/x-shellscript;
name="ntpd"
Content-Transfer-Encoding: 7bit
Content-Description: MandrakeLinux 10's /etc/rc.d/init.d/ntpd
Content-Disposition: attachment;
filename="ntpd"
#!/bin/sh
#
# ntpd This shell script takes care of starting and stopping
# ntpd (NTPv4 daemon).
#
# chkconfig: 2345 55 10
# description: ntpd is the NTPv4 daemon.
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
[ -x /usr/sbin/ntpd -a -f /etc/ntp.conf ] || exit 0
# See how we were called.
case "$1" in
start)
# Adjust time to make life easy for ntpd
if [ -f /etc/ntp/step-tickers ]; then
gprintf "Syncing time for ntpd. "
/usr/sbin/ntpdate -s -b -p 8 -u `cat /etc/ntp/step-tickers`
fi
# Start daemons.
gprintf "Starting ntpd: "
daemon ntpd -A
echo
touch /var/lock/subsys/ntpd
;;
stop)
# Stop daemons.
gprintf "Shutting down ntpd: "
killproc ntpd
echo
rm -f /var/lock/subsys/ntpd
;;
status)
status ntpd
;;
restart)
$0 stop
$0 start
;;
reload)
$0 stop
$0 start
;;
condrestart)
if [ -f /var/lock/subsys/ntpd ]; then
$0 stop
$0 start
fi
;;
*)
gprintf "Usage: ntpd {start|stop|restart|status}\n"
exit 1
esac
exit 0
--Boundary-00=_h6v6A7+kmvKYibl--