Como instalar un servidor NTP en centos 7

En servidores como en equipos de escritorio es importante tener correctamente configuradas la fecha y la hora del sistema y para hacer eso siempre es útil hacerlo por medio de un servidor NTP (Network Protocol Time) y aquí te digo como instalar un servidor NTP en Centos 7.

centos ntp server

Como instalar NTP en centos 7

Según Wikipedia la definición de NTP se puede leer como sigue:

Network Time Protocol es un protocolo de Internet para sincronizar los relojes de los sistemas informáticos a través del enrutamiento de paquetes en redes con latencia variable.

Y en Centos 7 puedes instalar un servidor NTP que permita sincronizar la hora y fecha de los sistemas de otros equipos ya sean servidores o equipos de escritorio.

Para instalar un servidor NTP en Centos 7 puedes ejecutar el siguiente comando:

# yum install ntp ntpdate

Una vez que se encuentre instalado el servidor puede configurar el reloj del sistema mediante el siguiente comando:

# ntpdate -u 0.pool.ntp.org

Luego se pueden definir las direcciones IP a las que se dará permiso para obtener los datos del horario. Para esto edita el archivo /etc/ntp.conf asi:

# vi /etc/ntp.conf

y agrega las direcciones que consideres adecuada para tu LAN o para las redes que consideres adecuadas.

# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1 
restrict ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
restrict 192.168.70.0 mask 255.255.255.128 nomodify notrap
restrict 172.16.1.0 mask 255.255.255.240 nomodify notrap
restrict 10.0.1.0 mask 255.255.255.248 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

#broadcast 192.168.1.255 autokey	# broadcast server
#broadcastclient			# broadcast client
#broadcast 224.0.1.1 autokey		# multicast server
#multicastclient 224.0.1.1		# multicast client
#manycastserver 239.255.254.254		# manycast server
#manycastclient 239.255.254.254 autokey # manycast client

# Enable public key cryptography.
#crypto

includefile /etc/ntp/crypto/pw

# Key file containing the keys and key identifiers used when operating
# with symmetric key cryptography. 
keys /etc/ntp/keys

# Specify the key identifiers which are trusted.
#trustedkey 4 8 42

# Specify the key identifier to use with the ntpdc utility.
#requestkey 8

# Specify the key identifier to use with the ntpq utility.
#controlkey 8

# Enable writing of statistics records.
#statistics clockstats cryptostats loopstats peerstats

# Disable the monitoring facility to prevent amplification attacks using ntpdc
# monlist command when default restrict does not include the noquery flag. See
# CVE-2013-5211 for more details.
# Note: Monitoring will not be disabled with the limited restriction flag.
disable monitor

Cuando hayas agregado las IPs o segmentos de IP adecuados graba el archivo y reinicia el servicio.

# systemctl enable ntpd
# systemctl start ntpd

Para configurar los servidores o equipos de escritorio puedes ejecutar el comando ntodate con la IP del servidor NTP con el nombre de host que pueda ser resuelto correctamente.

# ntpdate -u mi-servidorntp.local
# ntpdate -u 172.16.0.2

Espero que te sea de mucha utilidad y puedas configurar tu servicio NTP en Centos 7.

Tu Servidor y Amigo

luis armando medina

Sígueme en Twitter: @larmedina

This entry was posted in Centos and tagged , , , . Bookmark the permalink.

One Response to "Como instalar un servidor NTP en centos 7"

Responder a Guisela Fernandez Cancelar la respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *


*


Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.