Table of Contents
This instructions explain, how to make shure, you have the exact time (UTC) on your router and to act as a timeserver for the local net. We use openntpd, a very small ntp package, to achieve that goals.
It is assumed, that you have a basic knowledge about how add packages, edit and save files with Bering-uClibc.
[OpenNTPD is a FREE, easy to use implementation of the Network Time Protocol. It provides the ability to sync the local clock to remote NTP servers and can act as NTP server itself, redistributing the local clock.]
The openntpd package has been provided on the ISO images and packages page for quite a while. Beginning with Bering-uClibc v3.1 openntpd has been added to the floppy images as a feature-enhanced replacement for rdate.
If you do not use a new floppy image, you'll have to add the
openntpd package to your boot media and add it to the packages list in
leaf.cfg
. You can now either reboot and configure
later, or install the package (apkg -i), configure it and save the
configuration.
There are the two configuration files
/etc/default/openntpd
and
/etc/openntpd/ntpd.conf.
In the first file the start options of openntpd are defined. The default for the Bering-uClibc package is "-s", which sets the time immediately at startup if the local clock is off by more than 180 seconds. Allows for an unusual large time correction.
All other start options are documented in the man page for ntpd, available for online reading on the openntpd web pages.
In the second configuration file,
/etc/openntpd/ntpd.conf
, you can define the server(s)
you take the time off and the network (adresses) the ntpd daemon listens
to (which means: the network (adresses) ntpd acts as server to requests by
clients asking for the exact time).
It's a good idea to sync the time with the pool of stratum 2 timeservers pool.ntp.org. This setting is default, and usually there is no need to change it.
# use a random selection of 8 public stratum 2 servers # see http://twiki.ntp.org/bin/view/Servers/NTPPoolServers servers pool.ntp.org
If you want to serve the exact time you get from pool.ntp.org (or whatever time service you haven choosen) to your local network, you have to add the ip address of the local interface in the with the keyword "listen".
# Addresses to listen on (ntpd does not listen by default) #listen on * #listen on 127.0.0.1 #listen on ::1 listen 192.168.1.254
You can add more than one interface if you have more than one net you want to serve with time.
openntpd needs open ports for ntp from the firewall to the net, to sync your router with the pool of stratum servers on the net, and to allow a connection from your LAN clients to your timeserver on the router.
The first one is open by default with recent versions of
Bering-uClibc, to allow access from the LAN to the firewall/router you
have to outcomment the according entry in
/etc/shorewall/rules.
# timeserver (allow syncing with time servers (default: pool.ntp.org)) NTP/ACCEPT fw net # timeserver (allow LAN clients to sync with the time service on this machine) ) # NTP/ACCEPT loc fw
For more information see:
ntp.org - the home of the Network Time Protocol project with an extensive documentation.
The NTP FAQ and HOWTO - "A first try on a non-technical Mini-HOWTO and FAQ on NTP"
openntpd.org - the home of openntpd with some specific documentation (incl. the man page).