Chapter 19. Time in Bering

Revision History
Revision 0.52002-10-20JN, EW
initial revision

Table of Contents

Objectives
Define your timezone
Set the system date/time
Edit the contents of /etc/timezone (optional)
Activate daily clock updating (optional)
Internal network NTP clients
Miscellaneous

Objectives

These instructions are for those who want to setup properly the system time of their Bering box either using the old "rdate" function (available on the Bering floppy) or using the more precise, up-to-date ntpdate client (available as a separate package). You will also learn how to transform your Bering box in a time server in order to synchronize time of your internal network.

Many thanks to Jeff Newmiller from whom we stole a significant part of a mail contribution to the leaf-user list and for the time he spent improving and proofreading the initial version of this chapter.

Comments on this section should be addressed to the maintainers: Jacques Nilo or Eric Wolzak .

Define your timezone

a/ Obtain the appropriate zoneinfo file for your timezone.

This binary file will contain generalized rules for converting between GMT and your local time. One location where these files are kept is here, but their format has not changed in a long time and is not expected to change anytime soon so you can pull one from the Linux distribution of your choice.

b) Copy this file to the Bering ramdisk as /etc/localtime. On most conventional Linux distributions, /etc/localtime would be a symbolic link to the appropriate file in /usr/share/zoneinfo/, but that directory is not contained in etc.lrp and having symbolic links across packages is not recommended.

c) Use the "date" command to confirm that the zoneinfo file is behaving as desired.

Set the system date/time

There are three common methods to do that:

  • Method 1: Reboot the machine and set the time in the BIOS. Note that for a pure linux machine like a router it only makes sense to set the bios clock to UTC (GMT0).

  • Method 2: Set the Linux time with the "date [MMDDhhmm[[CC]YY][.ss]]" command and back it up to the CMOS clock with "hwclock". For example, if it is 9:05:15 pm on Jan 31, 2002, then you would use:

    # date 013121052002.15
    # hwclock --systohc
    

    hwclock will set the CMOS clock to UTC.

  • Method 3: Set the Linux time with "rdate {timeserver}" and back it up to the CMOS clock with "hwclock". For example, if you have a Linux box at 192.168.1.3 (see step f), you can use:

    # rdate -s 192.168.1.3
    # hwclock --systohc
    

    Note that if you don't have a Linux workstation available, you can use a program like AboutTime for Windows to set the Windows machine time correctly, and while AboutTime is running and its server options are enabled you can use "rdate" against that machine.

    Important

    For the rdate command to work you will have to open the "time" service (tcp/37) from your firewall to the internet. Edit the Shorewall rules file and add:

    ACCEPT		fw	net	tcp	time
    

Edit the contents of /etc/timezone (optional)

This will describe your timezone. I am not aware of any packages used with Bering that depend on this file, but it might as well be consistent.

Activate daily clock updating (optional)

Here you have to choose one of the three following options (mutually exclusive):

  • You can activate daily clock updating via rdate (tcp port 37) to a nearby "time" protocol server. This service is handled internally by the inetd daemon on a *nix workstation. To activate rdate updating, edit /etc/lrp.conf to specify the ip number of the desired time server for lrp_DATE_SERVER, and uncomment this variable (See the "configure your system" chapter of the Bering installation guide). The main advantage of this option is that you do not need an extra package to synchronise time on your Bering box. The main drawbacks are a/ rdate is not accepted by every public time servers and b/ rdate is less precise than NTP (see below).

  • Download the ntpdate.lrp package from the Bering package download area and add it to your syslinux.cfg file. It will provide you with the NTP client from http://www.ntp.org. Then go to the ntpdate configuration menu and declare the timeservers you want to query and, optionally the frequency of the update in the ntpdate cronjob parameters (default= every hour)

  • Activate your own time server. In this scenario you will have to download the ntpsimpl.lrp and the libm.lrp packages from the Bering packages download area and add them to your syslinux.cfg file. You will have the ntpd daemon from http://www.ntp.org (ntpd is a more recent version of xntpd). Then go to the ntpsimpl configuration menu and declare the timeservers you want to query.

Important

Do not forget to adjust your firewall to allow access to NTP services:

ACCEPT		fw	net	udp	ntp    (if you want to query an external NTP server from your Bering box)
ACCEPT		loc	fw	udp	ntp    (if you want to query your Bering box time server from the internal network)

Note

A list of available public timeservers is available here. All of them will accept request from ntpd or ntpdate. Only a few of them will accept rdate requests.

Internal network NTP clients

If you have a time server running on your Bering box, you might be looking for NTP clients for your internal network machines.

For your internal network linux boxes, ntpdate will do.

If you are running Windows machine of any variety, you can have a look at Tardis or Automachron.

Miscellaneous

  • All lines in /etc/tzvalue can be commented out if you provide proper zoneinfo file. See section 2 of this chapter.

  • Either reboot, or restart logging (svi sysklogd restart) to cause times recorded by the system logger to use the new timezone information.