NTP is the Network Time Protocol. This protocol allows servers (or desktops) to communicate to very reliable sources to keep their time synchronized. There are two reasons why you would want to employ NTP: 1) You're a geek and you want your time to be perfect. 2) You need your servers all synchronized with the correct time.
Naturally the second reason is far more important than the first. But either way, you might very well be driven to keep your machine on the exact time. To that end you can either constantly monitor the time on your machine (manually changing it when necessary) or you can set up NTP to handle your time corrections for you.
Installing and configuring NTP is actually quite easy. It will, however, require the use of the command line. With that in mind, lets' get busy.
You could open up your Add/Remove Software utility, do a search for "ntp" (no quotes) and install the matching results. Or you can open up a terminal window and install ntp with one of the following commands (remember, you will need either root access or sudo):
One of the above commands will install the ntp daemon and the configuration file /etc/ntp.conf.
Before you fire up the daemon you will need to take a look at the /etc/ntp.conf to make sure you have the ntp servers you want to use configured.
Most likely your NTP installation will already have a configuration file that is ready to go. My Debian-based NTP install had such a .conf file. All I had to do was start the daemon. But you might have special needs or your install might not have been as complete.
The section of the ntp.conf that you will want to take a look at is the server section. Each line in this section is set up like so:
server IP_ADDRESS OPTION(S)
Where IP_ADDRESS is the actual address of the server you want to use and OPTION(S) is/are the option(s) you want to use.
There are two options that you might want to use for every server. These are:
iburst: This option is used when the configured server is unreachable. When your machine can not contact its NTP server it will send out bursts of eight packets (instead of just one).
dynamic: This option allows a server to be configured even if the server is not reachable during configuration. This option assumes that at some point the server will be reachable.
If you look at my /etc/ntp.conf file you will see the following in the server section:
server 0.debian.pool.ntp.org iburst dynamic
server 1.debian.pool.ntp.org iburst dynamic
server 2.debian.pool.ntp.org iburst dynamic
server 3.debian.pool.ntp.org iburst dynamic
If you are not sure what servers to use visit the official NTP organization NTP.org to find a list of trusted servers.
Starting the Daemon
Once you have everything up and running go back to the root terminal and issue the command:
which will start the ntp daemon. NTP will now slowly start to adjust the time on your server. But don't worry, it makes the adjustment slowly. First the daemon waits for at least ten packets of information before trusting a source.
Now test to make sure your installation is working by issuing the following command:
which should give you a listing like:
remote refid st t when poll reach delay offset jitter =========================================================
+point2.adamants 126.96.36.199 2 u 44 64 377 75.955 -7.045 2.992
*station.mars.or 188.8.131.52 2 u 10 64 377 75.477 -1.144 0.977
-www.broadbandja 184.108.40.206 3 u 56 64 377 72.764 3.766 0.977
+pxe.lax-noc.com 220.127.116.11 2 u 25 64 377 65.686 -7.753 2.539
If you see zeros for the values you know ntp is not connecting. As you can see above my setup is connecting.
NTP is an easy way to ensure your servers or your desktop is always using the correct time. In mission-critical machines, this can be quite important. Employing NTP will give you the security of knowing your machine's right "on time".
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats (video ads) or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.