Configure NTP Client and Server Centos
The ntp package is same for client and server. This package will synchronize your server’s time via NTP protocol. In my example server’s address is 192.168.0.1 and client’s address is 192.168.0.2.
# yum -y install ntp
Configure NTP server
Make sure the following lines exists in
/etc/ntp.conf. Stratum is used to synchronize the time with the server based on distance.
server ntp.server.com server 127.127.1.0 furge 127.127.1.0 stratum 10
Start the NTP service
For SysVinit based systems run:
service ntpd start
For Systemd systems run:
systemctl start ntpd.service
Configure NTP client
Make sure the following line exists in
Now start the NTP service same as above.
Debug the NTP service
There are several useful commands you can use when working with NTP. Here are some of them.
To sync the clock:
service ntpd stop && ntpd -dgq && service ntpd start
Show ntp sync status: