Tool-BarfreeBSD ArticlesSearch Our SiteHOMEfreeBSD LinksContribute to FreeBSD HelpFreeBSD FilesFreeBSD Script Corner

Making your system's clock as accurate as possible

File Information: This text document may be copied, deleted, and published as desired provided credit is given to the author. If any alterations are made, each and every change must be commented as change to the original document, thank you.- Purpose: Shory and simple explanation of how to make your system's clock as accurate as possible.

Part One:  
Before we start, you should select servers which are closest to you ignored to update your system's clock. A complete list of primary servers can be retrieved from: . Considering most people are lazy I list a few of what I find to be the popular ones here:

 * (  
 * ( CNAME:  
 * (

I do urge you to look at the complete list and find sites in your area; it helps the net run smoother, and will give you better results.

Part Two:
 Now that we have our personalized list of servers, let's take a look at HowTo update our system's clock from the command line. If you aren't already, login as root, because for practical reasons, it is the only user allowed to modify the system's clock. We will be using multiple servers in our example because it will provide better overall performance. It is very simple to just use the defaults in ntpdate, just type:

  [zartik@spot]:~$ ntpdate navobs1.usnog
  28 Jan 20:28:30 ntpdate: bind() fails: Permission denied  [zartik@spot]:~$

 As you can see we we not successful and received an error. But alas, I was just a peon little user w/o the permissions of mighty old root. So after su'ing into root, here are my results:

  [root@spot]:/usr/home/zartik# ntpdate
28 Jan 20:28:45 ntpdate: step time server offset 0.003293  [root@spot]:/usr/home/zartik#  

 If you desire to see how ntpdate is working, before listing the servers,add a -d option in there and it will print to the screen it's behind the scenes workings.

Part Three:
  Now that we have the command line down, it is generally common practice to both crontab this procedure as well as adding it to your /etc/rc.local startupfile. To avoid annoying test from suddenly popping up, we will be tossing in the-s option to send output to the syslog rather then console. To run ntpdate onboot, add the following line to your /etc/rc.local file:

  echo 'Updating system's clock from an atomic clock site....'  ntpdate -s  

 Great, now on startup our clock will be accurate, but what about when we have those amazing 100 day uptime and we want to avoid our clock from driftingtoo far? Just add that same line from the rc.local file to ROOT's crontab file. If you do not know how to use crontab file, get a Howto on it.


© 1997 - 20013 Defcon1, , Copyrights for all materials on this web site are held by the individual authors, artists, photographers or creators. Materials may not be reproduced or otherwise distributed without permission of and the content's original author.

Tool-Bar-2Defcon1  Webmail