Configure Network Time Protocol (NTP) on CentOS 6.3

As opposed to the manual setup, it is possible to synchronize the system clock with a remote server over the Network Time Protocol (NTP). NTP is an Internet protocol used to synchronize the clocks of computers or servers to some NTP server on internet or intranet.

Steps A
1. To synchronization immediately or for the one-time synchronization only, use the ntpdate command as below :

[root@centos63 ~]# ntpdate -q

2. Enable running the ntpdate at boot time:

[root@centos63 ~]# chkconfig ntpdate on

Steps B
However, there are alternative way to set the ntpd daemon to synchronize the time at boot time automatically :

1. Install ntpd service daemon :

[root@centos63 ~]# yum install ntp -y

2. Open the NTP configuration file /etc/ntp.conf :

[root@centos63 ~]# vi /etc/ntp.conf

3. Now add or edit the list of public NTP servers.


4. Set the proper permissions, giving the unrestricted access to localhost only:

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict -6 ::1

5. Restart the NTP daemon:

[root@centos63 ~]# service ntpd restart
Shutting down ntpd:                                        [  OK  ]
Starting ntpd:                                             [  OK  ]

6.Set ntpd daemon is started at boot time :

[root@centos63 ~]# chkconfig ntpd on