Quickly build NTP time synchronization server under Linux

Source: Internet
Author: User

quickly build NTP time synchronization server under Linux

Background:

server more, time consistency and readiness is particularly important, although this problem is always ignored, but the unification of time is very necessary, because the time problem caused by service problems is also commonplace, this article briefly introduce the rapid construction and use of NTP.

1. Installing NTP

Yum-y Install NTP(direct yum installation)

2, Modify The configuration of ntp.conf

1) vim/etc/ntp.conf

① Configuration Method One: Only allow the client of the 192.168.100.0 network segment to synchronize time

Add a line after restrict default Kod nomodify notrap nopeer noquery(which means that all IP is denied the time synchronization):

Restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap

② Configuration Method Two: Allow clients of any IP to be able to synchronize time

Modify the Restrict default Kod nomodify notrap nopeer noquery to the following line:

Restrict default Nomodify

The setting of the permission is mainly set by the Restrict parameter, the main syntax is:

Restrict IP address mask subnet mask parameter

which IP can be an IP address or default, anddefault refers to all IP

The main parameters are as follows:

ignore : Close all NTP
nomodify : The client cannot change the time parameters on the server side, but the client can do this via the server.
notrust
noquery : Do not provide a time query for the client  

2 ), using the server parameter to set the parent time server, the syntax is:
Server IP address or domain name [prefer]
The IP address or domain name is the parent time server we specified, and if the server parameter is finally added prefer, it means that our NTP server is mainly calibrated with the host time of the unit.
3), to resolve the NTP server calibration time delivery delay
Use the Driftfile parameter setting:
Driftfile file name  
The time that is spent in contacting the parent time server is recorded in the file following the Driftfile parameter.
Note: The files that follow the driftfile need to use the full path file name, cannot be a link file, and the permissions of the file need to be set to NTPD daemon can write.

/usr/share/zoneinfo This directory is stored in each time zone corresponding to the settings file

/etc/localtime Local System Time setting file

/etc/sysconfig/clock Local Settings file

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/3E/3C/wKioL1PGlXCRBuE1AAMKs4_cNTw728.jpg "title=" Blog.png "alt=" Wkiol1pglxcrbue1aamks4_cntw728.jpg "/>

In order for the NTP service to start automatically when the system boots, execute:

Chkconfig ntpd on

Write the synchronized time to the CMOS inside.

Vim/etc/sysconfig/ntpd

Sync_hwclock=yes

Remember to restart the service each time you modify the configuration file to make the configuration effective, you can use the following command to check if the NTP service is started, you can get a process ID number when you start;

Pgrep ntpd

Use the following command to check the status of the time server synchronization

Ntpq-p

Ntpstat can also be used to view some synchronization status information,

The client will take 5-10 minutes to update the time from the server side after installation.

Client settings:

Crontab-e

Join a row

*/15 * * * */usr/sbin/ntpdate 192.168.100.102 (server-side IP)

This article is from the "Sea Width Sky" blog, please be sure to keep this source http://il23f.blog.51cto.com/8620950/1439218

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.