NTP Configuration in CentOS 6

Network Time Protocol (NTP) is a protocol to synchronize a computer's system clock with a remote server. The remote time server can be another server on your local network or one of the publically accessible NTP servers.

Click here for a list of public NTP servers.

NTP in Linux is implemented by the ntpd daemon. This article demonstrates how to configure ntpd on Centos / RHEL 6.

1. Install ntpd

Install ntpd if it's not installed already

# yum install ntp

2. Edit configuration

Save the original ntp.conf file.

# mv /etc/ntp.conf /etc/ntp.conf.original

Create a new ntp.conf file which contains the following minimal configuration parameters

# Set the NTP server name or IP address. (Replace xxx.xxx.xxx.xxx with the NTP server address)
  server xxx.xxx.xxx.xxx	
  
# Set default access restriction
  restrict default limited kod nomodify notrap nopeer
  
# Allow unrestricted access from localhost
  restrict 127.0.0.1 
  
# Allow access on a subnet (Replace xxx.xxx.xxx.0 with your network address)
  restrict xxx.xxx.xxx.0 mask 255.255.255.0 nomodify notrap nopeer

# The restrict access on IPv6 connections. 
# This is required only if you have IPv6 enabled in your system
  restrict -6 default kod nomodify notrap nopeer noquery
  restrict -6 ::1	

# Drift file contains the exact drifting of your local clock from the time server.
  driftfile /var/lib/ntp/drift

3. Restart ntpd service

# service ntpd restart

4. Enable ntpd on boot

# chkconfig ntpd on

6. View ntp status

Run any of the following commands

# ntpq -p 
# ntpstat
# ntpdc -c sysinfo

Post a comment

Name

Your Comment

Email (We dont publish it)

Comments

Nothing yet..be the first to share wisdom.