Linux under installation Configure NTP time synchronization server

Source: Internet
Author: User

In the computer world, time is very important, for example, the rocket launch of this scientific activity, the unity and accuracy of time requirements is very high, is the time of the computer according to a, or the time of this computer B? NTP is used to solve this problem, and NTP (Network time Protocol, the Internet Protocol) is a protocol that is used to synchronize the time of each computer in the network. Its purpose is to synchronize the computer clock to the World coordinated UTC, its accuracy in the LAN up to 0.1ms, in most places on the Internet its accuracy can reach 1-50ms.

Of course, there is a common use is that when the intranet servers are not able to connect directly to the Internet, they can only through a small number of export servers to connect to the Internet. In order to allow the network of servers in time to synchronize with the Internet time, to avoid some inexplicable problems caused by the time is not unified, then we can export the server installed on the NTP synchronization server, and then to some machines in the intranet set the timer task to install the NTP server on the update time.

(PS: The above contents refer to the Baidu Encyclopedia)

installation of an NTP server:

1 Installing NTP:

[email protected] ~]# yum install-y ntp[[email protected] ~]# ntpdate time.nist.gov

2 NTP server configuration:

(1) Modify the ntp.conf configuration file:

[Email protected] ~]# vim/etc/ntp.conf

Locate the "Restrict default nomodify notrap noquery" line in this configuration file and change it to:

Restrict default nomodify

This configuration is the original "default time synchronization for all IPs is denied"changed it."allows clients of any IP to synchronize time". Of course, if you just want the specified client to be able to synchronize time, the above configuration does not have to be modified, and below it can add something like the following:

Restrict 192.168.100.0 mask 255.255.255.0 nomodify

Indicates that only clients that are allowed to 192.168.100.* this segment can synchronize time

At the same time, in this file we can see a configuration similar to the following:

Server 0.rhel.pool.ntp.org iburstserver 1.rhel.pool.ntp.org iburstserver 2.rhel.pool.ntp.org iburstserver 3. Rhel.pool.ntp.org Iburst

These configurations indicate the time synchronization of this NTP server with which server on the Internet. There is no need to modify this, or you can add this time synchronization server:

Server cn.pool.ntp.org Iburst

(2) Set power On self-start:

[Email protected] ~]# chkconfig ntpd on

(3) Restart NTPD:

[Email protected] ~]# service ntpd restart

You can then use the following command to see the details of the Internet time synchronization:

[email protected] ~]# Watch Ntpq-p

the configuration of the client in the two intranet:

(1) Close ntpd:

[[Email protected] ~]# service NTPD stop

(2) Synchronization time:

[Email protected] ~]# ntpdate-s 192.168.100.2

Note: This IP refers to the machine that was just configured with the NTP time synchronization server

(3) Add timed time synchronization task:

[Email protected] cron]# Vim/var/spool/cron/root

Add the following content:

0-59/10 * * * */usr/sbin/ntpdate-s 192.168.100.20-59/10 * * * */usr/sbin/ntpdate-s 192.168.100.3

Note: Several NTP time synchronization servers have just been configured here to add a few. This command also refers to a time synchronization with the configured NTP server every 10 minutes

To view tasks:

[Email protected] ~]# crontab-l

(4) View time:

[[Email protected] ~]# Date


This article is from "Zifangsky's personal blog" blog, make sure to keep this source http://983836259.blog.51cto.com/7311475/1789797

Linux under installation Configure NTP time synchronization server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.