October 11, 2024

ntp howto

ntp is a time server you can use to synchronize the time across multiple machines connected to it. If you run a bunch of servers and they don’t all sync to the same time server, your logs will be screwy on them, especially if you try to reconstruct a network event using the logs by looking at the time stamp. This howto is done on Debian Wheezy, but will be similar on other distro’s

su
apt-get install ntp

Now make sure it’s getting times from the upstream time servers:

ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 y.ns.gin.ntt.ne 204.123.2.72     2 u    1   64    1   22.974  446456.   0.222
 x.ns.gin.ntt.ne 204.123.2.72     2 u    -   64    1   21.040  446455.   0.536
 15.185.186.215  198.153.152.52   2 u    1   64    1   52.064  446456.   1.268
 clock1.albyny.i .CDMA.           1 u    -   64    1   84.155  446452.   0.168

This means it’s working. Now login to your other machines and use the IP of this NTP server as your time server, and check to see if it worked.