Post details: Network Time Protocol Daemon
08/12/06
Network Time Protocol Daemon
NTP is designed to keep clocks on multiple servers synchronized to Atomic TimeNTPd is part of the FreeBSD base files. You can install the daemon from ports but that is not covered in this document
A CLI editor such as eeNTPd this file is a must. There are two parts to this file; however, the second part is not necessary since it is covered in the start command. Below I have listed my ntp.conftime serversNTPd as soon as the server starts up. To do this, open the file with your favorite editor and add the following lines to the end. The first line tells the the system to enable NTPd. The second line instructs the server to sync when initially started. Pretty simple stuff.
# NTPd
ntpd_enable="YES"
ntpd_sync_on_start="YES"
Starting NTPd
Now there's not much left to do except start the server. That can be accomplished by using the RC script /etc/rc.d/ntpd.
baku# /etc/rc.d/ntpd status
ntpd is not running.
baku# /etc/rc.d/ntpd start
Starting ntpd.
baku# /etc/rc.d/ntpd status
ntpd is running as pid 50037.
baku#
You can verify that the server is running with a couple of quick checks. You can tail the log file or you can look in the process list. Another check is using the date command.
baku# ps x | grep ntp
50037 ?? Ss 0:00.10 /usr/sbin/ntpd -g -p /var/run/ntpd.pid -f /var/db/ntpd.drift
50045 ?? S 0:00.00 /usr/sbin/ntpd -g -p /var/run/ntpd.pid -f /var/db/ntpd.drift
baku# date
Fri Aug 11 18:25:52 CDT 2006
baku#
Earlier I mentioned that the second part of the configuration file wasn't necessary. The reasoning for this is because of the command issued from the RC script to start the daemon above. The switch and file (-f /var/db/ntpd.drift) are there to keep a log of your clock's tendency to drift and compensates for it.
Conclusion
See, that wasn't very hard now was it? Keeping your time accurate is very useful. There are more things you can do with NTPd like securing your daemon so that your network is the only one with access to it. You can also leave it open to share your daemon as a Stratum 2 server. These are more advanced techniques, but that's for another article.
References
ntp.confNetwork Time ProtocolNTP Public Services ProjectClock Synchronization with NTP
Comments:
This post has 2 feedbacks awaiting moderation...
Leave a comment: