Configure a system to use NTP

Author: Grzegorz Czapliński gregory at systemics dot pl FreeBSD

Reviewer: Cezary Morga cm@therek.net FreeBSD

Reviewer: name contact BSD flavour


Concept

Be familiar with the concepts in RFC 868, the importance of synchronizing time(((time, network))) on server systems and which services in particular are time sensitive. Be able to configure NTP and manually synchronize with a time server as required.

Introduction

TODO: following are some contributed notes. Some can be removed as refer to too advanced. Also may be FreeBSD-specific.

ntpd: Network time protocol (NTP) daemon

ntp.conf: NTP daemon configuration file (/etc/ntp.conf). OpenBSD uses /etc/ntpd.conf

ntpdc: special NTP query program

ntpq: standard NTP query program

ntpdate: set the date and time via NTP

files:

/etc/ntp.conf default name of the configuration file

/etc/ntp.drift default name of the drift file

/etc/ntp.keys default name of the key file

/usr/local/etc/ntp.keys private md5 keys

/ntpkey RSA private key

/ntpkey_host RSA public key

ntp_dh Diffie-Hellman agreement parameters

which services are time sensitive:

configuring NTP:

/etc/ntp.conf:

""server ntp-1.cso.uiuc.edu iburst prefer ""server ntp1.cs.wisc.edu iburst ""server neptune.sg.depaul.edu iburst

(TODO: use generic example host names or use pool.)

""driftfile /var/db/ntp.drift ""restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

To start ntpd the first time without rebooting:

""ntpd -p /var/run/ntpd.pid

After already started:

""/etc/rc.d/ntpd [start | stop | restart | etc...]

Manually synchronize NTP:

""ntpd -q

TODO: be sure to document for different implementations

Examples

Practice Exercises

More information

ntpd(8), ntp.conf(5) or ntpd.conf(5), rc.conf(5), rdate(8)