Setup NPTD Server and client for CENTOS 6

Network Time Protocol is used to synchronize the time on Linux Server. NTP continuously sync and adjusts the time setting of the client by querying the NTP server. It is recommended to be used by systems which need very fine tuned time synchronization requirements (milliseconds). Recommended setup to use is to have a common NTPD server on your LAN and then configure other devices to sync to it.

Install NTP packages

Use yum to install NTP Package for the server and client:
# yum install ntp

We need to force a time update to correct the time on the ntp server. Run the following command at least 3 times to get an accurate time from the timeservers. Be sure the ntp service is stopped.
# ntpdate

Update NTP config

Edit the /etc/ntp.conf file on the server. Add the following line to allow machines on your own network to synchronize with your NTP server.
# restrict mask nomodify notrap

Under the default servers section, add the local clock to the ntp.conf file so that if the NTP server is disconnected from the internet, NTP server provides time from its local system clock.
# server # local clock
# fudge stratum 10

Now start the NTP service on the server and it will sync time on the ntp server of CentOS or Red Hat.
# /etc/init.d/ntpd start
# ntpq -c lpeer

Now on the client ntp servers. First run ntpdate 3 times on to manually sync time on the local NTP server. Be sure the ntpd service is not running when you use this command.
# ntpdate

Now edit the /etc/ntp.conf file and add the IP address of the local ntp server. Put it above other ntp server lines.
# server prefer

Start the ntp service and check for the status. After a few minutes of starting the ntpd service, you should see an asterisk (*) on you ntpq output. This indicates that the ntp is currently synced on that server.
# /etc/init.d/ntpd start
# ntpq -c lpeer

remote refid st t when poll reach delay offset jitter
+server2.ntp 2 u 4 64 37 32.457 1.289 0.140
+server1.ntp 2 u 7 64 37 30.796 1.794 0.135
* .ACTS. 1 u 3 64 37 58.377 0.724 0.648
LOCAL(0) .LOCL. 10 l 6 64 37 0.000 0.000 0.001

– masterkenneth

Leave a Reply

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