Delorean not included, NTP 101

It’s 1am, and your blissfully asleep, dreaming of how in memory databases can make your life easier, when you awoken by the cutting sound of your cell phone. The application systems are breaking, users are complaining  that the financial close is broken. The database is reporting data from the future, and they don’t know where the Delorean is.

How did this happen? Your not running NTP!

Network Time Protocol (NTP)  is a system that keeps all your systems on the same time.

The default /etc/ntp.conf  file that is deployed with most Linux systems requires only a small change to enable NTP.  By default most system are  initially configured to use the Red Hat NTP pool of servers. For systems with internet access, this should keep your time in sync. The following is the server portion of the ntp configuration file /etc/ntp.conf, with the NTP server pointing to the Red Hat NTP pool.

# Use public servers from the pool.ntp.org project.

# Please consider joining the pool (http://www.pool.ntp.org/join.html).

server 0.rhel.pool.ntp.org

server 1.rhel.pool.ntp.org

server 2.rhel.pool.ntp.org

 For many companies  this is fine, but on occasion you might  have your own NTP infrastructure. In this case the server lines should be commented out, and lines added that point to the client’s NTP servers.

# Use public servers from the pool.ntp.org project.

# Please consider joining the pool (http://www.pool.ntp.org/join.html).

#server 0.rhel.pool.ntp.org

#server 1.rhel.pool.ntp.org

#server 2.rhel.pool.ntp.org

server 192.168.0.20

server 192.168.1.20

 

Once the /etc/ntp.conf file is changed, the ntp daemon will need to be restarted using the “service ntpd restart” command. This will stop the daemon, synchronizing the clock to the NTP source, and start the daemon back up. Please be aware that the ntp daemon will need approximately 6 minutes to synchronize to the NTP server and start the process of calculating the frequency error.

Once you verify that the servers are the correct ones, you can verify communication using the ntpq-p command. This will show all the ntp servers the appliance is currently using, and the time offset experience with each server.

remote refid st t when poll reach delay offset jitter

===============================================
205-196-146-72. 209.51.161.238 2 u 62 64 1 26.872 -2.682 0.001
name1.glorb.com 128.174.38.133 2 u 61 64 1 17.005 -2.099 0.001
ntp1.rescomp.be 169.229.128.214 3 u 60 64 1 77.270 3.740 0.001
LOCAL(0) .LOCL. 10 l 59 64 1 0.000 0.000 0.001

In this example, we see three external servers and the system clock in use. The system clock offset is approximately -2 to 3 seconds off. The NTP daemon will now drift the time to get the system clock within a one to two hundred milliseconds of real time.

More often than naught, this  will resolve the time issue, however; there is another case that requires a little more digging.

Leave a Reply

Your email address will not be published. Required fields are marked *

*