Article Title: simple configuration of NTP servers in Linux. Linux is a technology channel of the IT lab in China. Including desktop applications, Linux system management, kernel research, embedded systems, open source, and other basic categories about time services
Network Time Protocol (NTP, Network Time Protocol) is used to synchronize all of its client clock services. The NTP server synchronizes the clock of the local system with a public NTP server and then serves as a time host so that all clients on the local network can synchronize the clock.
The biggest benefit of clock synchronization is the data in the log files on the relevant system. If you use the central log host to centrally manage logs in the network, the log results will better reflect the real situation. In a network that synchronizes the clock, the centralized performance monitoring and service monitoring systems can reflect system information in real time, and the system administrator can quickly detect and solve system errors.
Install and configure the NTP service
The following describes the simple configuration of the NTP server:
Generally, the Linux release will contain the ntp software package. If your system is not installed, run the rpm command to install the package. The following uses the fedora core 6 system as an example to configure a time server:
[Root@supersun.biz root] # rpm-ivh ntp-4.2.2p1-3.i386.rpm warning: ntp-4.2.2p1-3.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60ePreparing... ######################################## ### [100%] 1: ntp ####################################### #### [100%] edit the configuration file/etc/ntp. confrestrict default nomodify notrap noqueryrestrict 127.0.0.1 restrict 192.168.1.0 mask 255.255.255.0 nomodify notraprestrict 192.168.0.0 mask 255.255.255.0 nomodify notrapserver 0.asia. pool. ntp. orgserver 1.asia. pool. ntp. orgserver 2.asia. pool. ntp. orgserver 3.asia. pool. ntp. orgserver 127.127.1.0fudge 127.127.1.0 stratum 10
|
The ITALIC part is the part I added. It sets the Intranet address of the two network segments of the time server and the external time server. Now we will give a brief explanation of the Configuration:
The first line of restrict and default defines the default access rules. nomodify prohibits remote hosts from modifying local server configurations, and notrap rejects special ntpdq To Capture messages, noquery rejects btodq/ntpdc queries (the query here is the server's own status query ).
The last two lines of the configuration file are used to provide the time service for the client at the local time when the server is out of contact with the public time server.
Port
Ntp uses udp. Remember to open port 123.
Start NTPD
Start the ntpd daemon:
Service ntpd start
Client Configuration
Run periodic tasks as root:
[Root @ supersun root] # crontab-e
Add the following content and update the time every 15 minutes:
*/15 * ntpdate ntp. supersun. biz
The ntpdate command is included in the ntp package. Check whether the system is installed.