1- Primeiro iremos instalar os pacotes ntp.
#yum install ntp
Listar comandos ntp disponiveis, apenas para conhecimento
Ou:
#yum install ntp
Listar comandos ntp disponiveis, apenas para conhecimento
#ntp [tab tab]
2 - Iniciar serviço ntp
# service ntpd startOu:
# /etc/rc.d/init.d/ntpd start
3- Após iniciar o serviço visualize o log
# tail /var/log/messages
Dec 31 09:46:58 CentOS ntpd[10338]: Listen normally on 2 lo 127.0.0.1 UDP 123
Dec 31 09:46:58 CentOS ntpd[10338]: Listen normally on 3 eth0 10.0.0.19 UDP 123
Dec 31 09:46:58 CentOS ntpd[10338]: Listen normally on 4 lo ::1 UDP 123
Dec 31 09:46:58 CentOS ntpd[10338]: Listen normally on 5 eth0 fe80::c8db:cbff:fe62:5b61 UDP 123
Dec 31 09:46:58 CentOS ntpd[10338]: peers refreshed
Dec 31 09:46:58 CentOS ntpd[10338]: Listening on routing socket on fd #22 for interface updates
Dec 31 09:47:04 CentOS ntpd[10338]: 0.0.0.0 c016 06 restart
Dec 31 09:47:04 CentOS ntpd[10338]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM
Dec 31 09:47:04 CentOS ntpd[10338]: 0.0.0.0 c011 01 freq_not_set
Dec 31 09:47:11 CentOS ntpd[10338]: 0.0.0.0 c614 04 freq_mode
4- Configurar para que o ntp inicie no boot
# chkconfig --level 35 ntpd on
5 - Definir a lista de servidores NTP que serão utilizados para sincronizar a hora,
5.1 Abra o arquivo de configuração do serviço ntp.
# vi /etc/ntp.conf
Modifique as linhas iniciadas com server e adicione os servidores de sua preferencia, aqui ja vai a sugestão dos servidores do projeto ntp.br, o parâmetro iburst serve para acelerar a sincronização inicial.
# servidores publicos do projeto ntp.br
server a.st1.ntp.br iburst
server b.st1.ntp.br iburst
server c.st1.ntp.br iburst
server d.st1.ntp.br iburst
server gps.ntp.br iburst
server a.ntp.br iburst
server b.ntp.br iburst
server c.ntp.br iburst
6- Verificar se NTP está configurado e funcionando.#ntpq -c peersSe a resposta for semelhante a esta o serviço não esta funcionando
CentOS:# timed out, nothing received ***Request timed out
Mas se a resposta for semelhanto a esta o serviço NTP esta okremote refid st t when poll reach delay offset jitter=====================================================*a.st1.ntp.br .ONBR. 1 u 51 64 17 13.943 -4.243 1.295+201.49.148.135 .ONBR. 1 u 50 64 17 20.849 -3.545 1.858-c.st1.ntp.br .ONBR. 1 u 48 64 17 20.655 -3.867 1.353+d.st1.ntp.br .ONBR. 1 u 47 64 17 23.787 -4.315 1.546gps.ntp.br 146.164.48.5 2 u 48 64 17 15.295 -4.874 3.302a.ntp.br 200.160.7.186 2 u 47 64 17 15.118 -4.516 1.664b.ntp.br 200.20.186.76 2 u 43 64 17 21.597 -5.278 1.379c.ntp.br 200.160.7.186 2 u 40 64 17 41.269 -4.095 0.824Para mais detalhes sobre este serviço, existe um ótimo tutorial em: