NTP

Gentoo HOWTO & Notes

12/07/2009


It is essential that your system knows the correct time. Fortunately we are provided a neat little program that synchronises the system time with an outside clock. Or at the very least, NTP makes sure that all the systems on your network agree on what time it is.

Installation

gentoo ~ # emerge net-misc/ntp

Configuration

The configuration of NTP is stored in /etc/ntp.conf, so let’s edit it:

gentoo ~ # nano -w /etc/ntp.conf

# /etc/ntp.conf driftfile /var/lib/ntp/ntp.drift restrict default nomodify nopeer restrict 127.0.0.1 server sella.groenheide.org.za

The configuration above sets NTP as a client that synchronises with a time server, in this case my primary server. To configure NTP to act as a server for your network adapt the following configuration:

# /etc/ntp.conf driftfile /var/lib/ntp/ntp.drift restrict default nomodify nopeer notrap restrict 127.0.0.1 restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap # South African Time Servers server ntp-nld.mweb.co.za server tick.meraka.csir.co.za server time.nmisa.org

Start NTP and check /var/log/messages for any errors. If everything seems OK, add NTP to the default runlevel.

gentoo ~ # /etc/init.d/ntpd start

gentoo ~ # rc-update add ntpd default

Discussion

There is really not much to discuss regarding NTP, as it is a very simple program that works flawlessly most of the time.