Title: Configure NTP
Course: CIS 208: Linux/UNIX III: Intermediate System Administration, Networking, and Security ~ For IGNITE Review > Section: Learning Modules

Configure NTP

The Network Time Protocol (NTP) is the standard for keeping time synchronized on networked devices.  By running one or two ntp servers on a physical network it is possible to keep accurate time within milliseconds of the international standard time.

When implementing an ntp server, be sure that it connects to several servers on the Internet and the "Undisciplined Local Clock."  This will ensure accuracy even when the Internet servers are unavailable.  The "server" option determines its peers, and the "restrict" option grants access.

Here is a basic ntp.conf file to allow access to a subnet and use 3 Internet servers as a time source.

restrict 127.0.0.1
restrict -6 ::1
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
server        127.127.1.0        # local clock
fudge         127.127.1.0 stratum 10

If there were two ntp servers on the physical network, simply add the other server to each of the configuration files.  For example, the server lines may be like this.

server ntp2.sample.org
server 0.centos.pool.ntp.org
server 1 centos.pool.ntp.org
server 2 centos.pool.ntp.org
server        127.127.1.0        # local clock
fudge         127.127.1.0 stratum 10

After implementing each server, use the "ntpq -p" command to verify that the service is running and that the offset is less than 10 for each time source.

Note: See the RHEL 6 Deployment Guide for more information about the ntp protocol and its usage.