Configuring NTP Server in Intranet

Keywords: Linux CentOS network less yum

In this paper, we mainly configure NTP service for the scenario where the server can not connect with the outside world in the intranet. We need a machine to connect with the outside network, and other services to connect with the outside network service.

NTP Server (Network Time Protocol (NTP) is a protocol used to synchronize computer time. It can synchronize the computer to its server or clock source (such as quartz clock, GPS, etc.). It can provide high precision time correction (the difference between LAN and standard is less than 1 millisecond, tens of milliseconds on WAN), and can prevent malicious by encryption confirmation. Protocol attack. Time propagates at the NTP server level. All servers are grouped into different Stratum (Layer) according to the distance from the external UTC source.

Clock servers are tree-like structures, and the top layer is provided by national (international) authorization time center, which expands downward layer by layer.


(1) NTP package installation: yum install ntp
If the network does not work, you need to install it through a proxy or download the rpm package
(2) Configuration file path: / etc/ntp.conf
(3) Intranet service settings
1. Intranet NTP service:

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

Clock information can be obtained by PING through the clock service to see if it can be connected.

 service ntpd stop
 0.centos.pool.ntp.org
 service ntpd start

2. Other intranet services:
Need NTP service to allow specified segment access

restrict 127.0.0.1 
restrict ::1
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

Major configuration associated with NTP services

Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 192.168.1.93
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

(4) View port listening: netstat-anptu | grep 123 to determine whether NTP services are started

tcp        0      0 0.0.0.0:9123            0.0.0.0:*               LISTEN      16350/haproxy       
udp        0      0 192.168.1.93:123        0.0.0.0:*                           1359/ntpd           
udp        0      0 127.0.0.1:123           0.0.0.0:*                           1359/ntpd           
udp        0      0 0.0.0.0:123             0.0.0.0:*                           1359/ntpd           
udp6       0      0 fe80::f816:3eff:fee:123 :::*                                1359/ntpd           
udp6       0      0 ::1:123                 :::*                                1359/ntpd           
udp6       0      0 :::123                  :::*                                1359/ntpd

(5) Start up:

service ntpd start(stop,restart Empathy)

(6) Set up boot start:

chkconfig ntpd on

(7) Instruct ntpstat to display connection information with NTP service in a few minutes

Posted by mrfritz379 on Thu, 21 Mar 2019 20:03:51 -0700