Network Time Protocol (NTP) is a internet protocol to synchronize the clocks of the computer systems through the routing of packets in networks with latency variable. NTP uses UDP like your transport layer, using the port 123. It is designed to resist the effects of variable latency.
We install the necessary software
Redhat and derivatives
yum install ntpdate ntpDebian and derivatives
apt-get install ntpWe make a backup of the configuration
cp /etc/ntp.conf /etc/ntp.conf-bckWe access the configuration file and comment on the servers that are configured by default and add ours.
#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
server 3.es.pool.ntp.org
server 0.europe.pool.ntp.org
server 2.europe.pool.ntp.orgWe can also restrict the clients which can query our NTP server:
# Hosts on local network are less restricted.
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrapWe allow port 123 on the firewall
iptables -A INPUT -m state – -state NEW -m udp -p udp – -dport 123 -j ACCEPTWe start the service
chkconfig ntpd on
We add it to the beginning
Redhat and derivatives
chkconfig ntpd onDebian and derivatives
update-rc.d ntp enableWe check the operation
ntpq -p
remote refid st t when poll reach delay offset jitter
============================================================================
ntp.redimadrid. 193.147.107.33 2 u 32 64 7 2.310 489875. 13.455
fry.celeborn.de 152.103.15.66 2 u 38 64 7 36.664 489872. 13.327
mail.grain.ru 89.109.251.21 2 u 42 64 7 102.040 489877. 20.947All the best
:wq!
Comments