%SECTION{summary}%Setting up an NTPD time server.
See:
Contents
from Linc Fessenden's Weblog
Copied from
Linc Fessenden's weblog
, because it's good, and because I don't know if a link to his log (or this specific "date" log) will be "permanent". (Will write to him later to ask about that.)
Posted by Linc | #
January 06, 2004 10:22 AM
What time is it?
One of the things I have ben meaning to do for a long time is to set up a time server on my network. I have often had to update the time on my computers there by running "ntpdate" because I personally think it's critical for my data to have the correct file creation dates and times. Not to mention my email messages. So, today I set about to get ntpd working on a machine on my network as a time server. The most logical machine in my network was my file/mp3/dhcp/dns server, which happens to run NetBSD. What I found was that it is very easy to get ntpd running on NetBSD. And here's how ya do it:
Log in as root on your box and edit the /etc/defaults/rc.conf file and change the "ntpd=NO" to "ntpd=YES". Then, go and edit the /etc/ntp.conf file and add a server or three to the bottom of the file. The format for that is "server tick.usno.navy.mil" with the "tick.usno.navy.mil" part being replaced with your favorite public ntp server(s). You can find a list of them Here - for stratum 1 servers or Here - or stratum 2 servers. For those of you who don't know, the "stratum" is basically how many servers you are removed from the actual clock. So if you get your time from a server which has immediate access to an atomic clock or other accurate time source, that server would be a stratum 1 server and so on. After you have those 2 files changed, simply issue a "/etc/rc.d/ntpd start" command or reboot your machine and your ntp service will start. Be aware that your server will not be immediately acessable for setting time until it syncs with one or more of the servers you listed in your /etc/ntp.conf file. This may take several minutes and you can check the status of that by running "ntpq -p" on your ntp server. The result will look something like:
remote refid st t when poll reach delay offset jitter
==============================================================================
ntp0.usno.navy. .USNO. 1 u 610 1024 377 230.371 -5.494 7.492
And it would look like:
remote refid st t when poll reach delay offset jitter
==============================================================================
*ntp0.usno.navy. .USNO. 1 u 610 1024 377 230.371 -5.494 7.492
When it's ready to serve up time to you. Notice the little asterisk in the front there? After that's there, it's in sync and you are ready to poll it for time on your other machines. This can be accomplished ni a variety of ways, but the one I like most is simply to add "ntpdate" to root's crontab once a day. Violla! Correct time!
Contributors
- () RandyKramer - 15 Jan 2004
- If you edit this page: add your name here; move this to the next line; and if you've used a comment marker (your initials in parenthesis), include it before your WikiName.
Revision Comment
%SECTION{last_revision}%
Page Ratings