Archive

Posts Tagged ‘ntpdate’

Make Sure Your Machine Is On The Correct Time With ntpdate

February 19th, 2007 8 comments

I have been doing a lot of ssh connections between my machines lately and noticed that the times were different between each. I had assumed that each would be fairly close but one was even five minutes off. Well, that was an easy fix using ntpdate. From the man page for ntpdate:

ntpdate sets the local date and time by polling the Network Time Protocol (NTP) server(s) given as the server arguments to determine the correct time. It must be run as root on the local host. A number of samples are obtained from each of the servers specified and a subset of the NTP clock filter and selection algorithms are applied to select the best of these. Note that the accuracy and reliability of ntpdate depends on the number of servers, the number of polls each time it is run and the interval between runs.

A simple method of manually updating your system time is by using the command below:

sudo ntpdate ntp.ubuntu.com (or an ntp server of your choice)

This will quickly check the time server for the appropriate time and synchronize your system accordingly. The whole process generally only takes a few seconds.

This command can be run manually as above or setup to run via cron for automation.

This can also be done using a GUI method via the clock generally found in the corner of your desktop.  right-click and select “Adjust Date and Time”.  You will then be presented with a window such as this one:

adjust date and time settings ubuntu To activate and install the ntpdate service you’ll want to check the box as seen in the picture “Keep clock synchronized with Internet servers”.

This will ask you if you want the ntp packages installed.  Go ahead and install these.

When that is finished you can select the “Select Servers” to select which local servers you want to use.  Any should work but something local should be a bit quicker and possibly more reliable.

At this point you can use either method of updating your machines time and date.  This GUI method should keep it synchronized for you so its setup and forget.  The console method would be primarily used for server machines, etc.

Categories: Linux Tags: ,