Using NTPD and NTPDATE

These instructions are intended to help users ensure that their local system time is the same as the server time, preventing unwanted rebuilds from occurring.

ntpdate

The command used to sync your local time to the server time is ntpdate. It is usually invoked like so:

sudo ntpdate ccmlab,

where ccmlab is the name of the local time server. On machines in the lab, this frequently fails with an error that goes something like this:

date ntpdate[number]: the NTP socket is in use, exiting.

Catastrophe?! Disaster?! No, actually this is a good thing. What it probably means is that your machine is running the NTP server (ntpd), which should be keeping your computer's time up-to-date to begin with. If you would like to turn off the server so that you can check the output from ntpdate, continue reading.

ntpd

The NTP daemon connects to various time servers (as specified in /etc/ntp.conf) and figures out what time it is. To stop the NTP server, try this command:

sudo /etc/init.d/ntp stop

If this command fails, you likely do not have the NTPD server installed. Run this command to install it:

sudo apt-get install ntp

Once the NTP package is installed, the daemon should automatically start. If not, use:

sudo /etc/init.d/ntp start

To make sure that your time is kept correct, make sure your /etc/ntp.conf file looks something like the following:

# /etc/ntp.conf, configuration for ntpd

server vtserf.cc.vt.edu
server time.apple.com
server time-a.nist.gov
server ntp-2.vt.edu
server ntp-3.vt.edu
server ntp-4.vt.edu

# By default, exchange time with everybody, but don't allow configuration.
# See /usr/share/doc/ntp-doc/html/accopt.html for details.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

I have removed most comments, and some other setting lines from the example ntp.conf above. The important part to have is the server section. When aptitude installs the NTP package, those servers default to a group of debian.org servers; I changed them to mirror the servers that are listed in ccmlab='s =ntp.conf.

Note: specifying ccmlab as the only server in the ntp.conf does NOT seem to work.

-- AlexMarschner - 07 Sep 2007

Topic revision: r1 - 07 Sep 2007 - 13:19:49 - AlexMarschner
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback