Network Time Protocol (NTP) is a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks.
$ yum install ntp
$ apt-get install ntp
NTP uses UDP port 123 to sync time with NTP servers, either connecting out to another NTP server or accepting incoming connections.
If your iptables filtering incoming traffic on the main NTP server in your cluster you need to open port 123 to UDP traffic to allow the other servers to connect to it.
After installing NTP, daemon will started automatically. First you need to stoop ntp to sync time with ntp server.
To stop NTP use following command:
$ service ntpd stop
To sync time with NTP server run following command:
$ ntpdate pool.ntp.org
To sync you can use any of the NTP servers specified in /etc/ntp.conf file or you can use poolntp.org.
After running ntpdate you can start ntp server again that will sync date and time automatically.
To start NTP use following command:
$ service ntpd start
To restart NTP use following command:
$ service ntpd restart