Network Time Protocol (NTP) is a standard Internet protocol used for time synchronization on the Internet. NTP is used to synchronize computer time to certain time standards. The current time standard is Universal Time coordinated ). The primary developer of NTP is Professor David L. Mills from the University of Delaware.
What is the use of NTP for us? Simply put, when your computer time is not accurate, you can access the Internet and synchronize the time from the Internet.
For enterprises, if you have hundreds of thousands of computers that cannot directly connect to the Internet, time does not affect your business. If one computer is modified, it cannot be exhausted. At this time, the establishment of an NTP server will show its advantages.
Configure the relevant Yum source to ensure that your NTP server can connect to the network.
[[Email protected] ~] Vim/etc/resolv. conf
# Add a gateway. You can view the gateway under mongown and view the default gateway under ipconfig.
Nameserver 10.17.1.1
1. Install NTP service in yum
[[Email protected] ~] Yum install-y NTP
2. Compile the NTP configuration file/etc/NTP. conf and add the following two lines,
Restrict 10.17.1.0 mask limit 255.0 nomodify
Server 210.72.145.44 prefer
For the time servers provided on the Internet, you can find them online. There are time servers provided by many countries.
After the NTP server is configured, restart the service. The listening port is UDP port 123 and can be used.
# SS-autnl port viewing
After the restart, you have to wait a few minutes or ten minutes to synchronize time,
[[Email protected] ~] # Ntpdate 10.17.1.60
11 Aug 11:38:30 ntpdate [7619]: adjust time server 10.17.1.60 offset 0.000178 Sec
If the test is performed immediately after the restart, the following occurs:
[[Email protected] ~] # Ntpdate 10.17.1.60
11 Aug 11:05:28 ntpdate [1, 7326]: No server suitable for synchronization found
You can use this command parameter to view:
[[Email protected] ~] # Ntpdate-D 10.17.1.60
NTP configuration file:
The configuration file of/etc/NTP. conf NTP service.
1) permission settings are mainly set by the restrict parameter. The main syntax is:
Restrict IP Address Mask subnet mask parameter
The IP address can be an IP address or a default IP address.
The following parameters are provided:
Ignore: Disable all NTP online services.
Nomodify: the client cannot change the time parameter of the server, but the client can perform network calibration on the server.
Notrust: the client source is considered as a untrusted subnet unless it passes authentication.
Noquery: no client Time query is provided.
2) use the server parameter to set the upper-level time server. Syntax:
Server IP address or domain name [prefer]
The IP address or domain name is the designated upper-level time server. If prefer is added to the server parameter, the NTP server is calibrated based on the host time.
3) solves the transfer delay during NTP server Calibration Time
Use the driftfile parameter settings:
Driftfile file name
The time spent in contacting the upper-level time server is recorded in the file after the driftfile parameter.
Note: driftfile must be followed by a complete path file name, not a link file, and the file permission must be set to ntpd daemon for writing.
The/usr/share/zoneinfo/directory stores the setting files corresponding to each time zone.
/Etc/localtime local system time setting file.
/Etc/sysconfig/clock local time zone setting file.
This article from the "warm boiled frog" blog, please be sure to keep this source http://tanxw.blog.51cto.com/4309543/1538496