Keeping Time With NTPd
Updated: 07/15/2005
General Information
Many services on your FreeBSD either workstation or server benefit from knowing the time accurately, whether they are cron tasks or if you are sharing files around your network and you need the timestamps to be consistent across the network. The NTP daemon and the ntpdate program allow you to keep accurate time on your FreeBSD machine via the Network Time Protocol. The ntpdate program is being slowly replaced by NTPd, and indeed ntpd -q will act the same as ntpdate, so it is on its way out. Also the ntpdate program has reduced accuracy when compared to the ntpd. This guide will show you how to setup your machine to keep time using the NTP daemon, and also show you how you can setup the NTP daemon to act as a Time Server for your local network.Requirements
Installation
We need to tell the machine that we want ntpd started at boot so login or su to root.ntpd_enable="YES" to your rc.conf file manually or enter the below command to append it to the end| # | echo 'ntpd_enable="YES"' >> /etc/rc.conf |
Note: This was changed to ntpd_enable in FreeBSD 5.x if you have a previous version use xntpd_enable
Create the Drift file which ntpd will use| # | touch /var/db/ntpd.drift |
Configuration
Firstly you should find a ntp server reasonably local to you. It's not required, but it seems like a good idea.|
# nano -w /etc/ntp.conf server chronos.csr.net prefer driftfile /var/db/ntpd.drift restrict default ignore |
|
restrict 10.10.10.4 mask 255.255.255.0 notrust nomodify notrap |
| # | ntpd -c /etc/ntp.conf -f /var/db/ntpd.drift |
Author: Geffy
w00t at stealth-ninja dot co dot uk