Next Previous Contents

8. Testing Environment

8.1 What do you use to sync time on your FreeBSD boxes?

We use ntpd.

For each cluster, we have one monitoring system and a number of clients and servers. We configure the clients and servers to use the monitoring system as a time server. The client and server /etc/ntp.conf file looks like this:

driftfile /etc/ntp.drift
Where is the IP address of the monitoring PC.

To start ntpd, use this command:

# ntpd -p /var/run/
Note, on FreeBSD-4.0, they have dropped the leading 'x', so the command is just ntpd.

To make ntpd start each time FreeBSD boots, add this to /etc/rc.conf:


Configuring the monitoring PC is a little more complicated. We have to tell ntpd that the monitoring PC's internal clock is ``correct.'' This is done with a fudge line:

driftfile /etc/ntp.drift
fudge stratum 10
In this case, there are two ``servers.'' One is another host ( and the second is the internal clock. The internal clock is fudged to have stratum 10. If the other server has a higher stratum, then it takes precedence. This allows us to disconnect and reconnect the monitoring PCs from a network without affecting clock stability.

You don't need to have an external server on the monitoring PC if you don't want to. If you want all clocks to to be synchronized with a global time source, then you do want it. However, the most important thing is to have all cluster members synchronized with each other, but not necessarily to the correct time.

8.2 How can I use NTP to synchronize my system clocks?

The quick-and-dirty way is to use the ntpdate command. A better way is to run the ntpd or xntpd daemon. In both cases you will need an NTP server whose clock has already been synchronized.

To use ntpdate simply run the ntpdate command and give the IP address of your NTP server. For example:

# ntpdate
If the command is successful, you will see a message like:
ntpdate: adjust time server offset 0.064761
If you see the message ``no server suitable for synchronization found'' then there is some problem with the NTP server system. For example, maybe the ntpd process is not running.

To make sure your clocks always remain sycnhronized, run the ntpd daemon on each of your machines. To do this create a file named /etc/ntp.conf and put this inside:

driftfile /etc/ntp.drift

Of course, you will need to replace ``'' with the IP address of your own NTP server. Then simply run the ntpd command as root. NOTE: ntpd only makes small adjustments to your system's clock. If the initial time difference is large, ntpd exits and instructs you to change the time manually, for example with ntpdate as described above.

You can use the ntpq command to check if your clock is synchronized. One easy way is with ntpq's rv command:

% echo rv | ntpq
status=06f4 leap_none, sync_ntp, 15 events, event_peer/strat_chg,
version="ntpd 4.0.99k23 Mon Apr 16 13:10:46 MDT 2001 (1)",
processor="i386", system="FreeBSD4.1-RC", leap=00, stratum=2,
The important thing to look for is the ``stratum='' line. If stratum is equal to 16, then your clock is not synchronized. If it is a number less than 16, your system clock is synchronized with the server.

You must have some patience when running ntpd for the first time. It may take 10 minutes or so for your system to syncrhonize with the server.

If you don't know of any NTP servers, ask your local system administrator for advice. If your network/system administrator is good, your network routers will also be NTP servers. In that case you can simply try ntpdate with your router's IP address. If you're still stuck, consult the list of public NTP servers hosted by

Next Previous Contents