CentOS6.5 NTP Service

Source: Internet
Author: User

Outline

I. INTRODUCTION of NTP

Second, the Environment preparation

Third, install NTP

Iv. Configuring NTP

V. Start NTP

Vi. Client Synchronization


I. INTRODUCTION of NTP

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.

It allows the computer to synchronize time with its servers or clock sources (such as quartz clocks, GPS, etc.), which can provide a high degree of accuracy in time correction, and can be used to protect against malicious protocol attacks using cryptographic acknowledgments.


Second, the Environment preparation

Centos6.5 x86_64 192.168.44.130


Third, install NTP

1). First check to see if NTP is installed

[Email protected] ~]# rpm-q ntppackage NTP is not installed


2). Install NTP now (skip this step if installed)

[[email protected] ~]# Yum install-y NTP



Iv. Configuring NTP

1). master configuration file/etc/ntp.conf

In the ntp.conf file can use "Restrict" to control the authority, this parameter is set up in the following way:

Restrict [your_ip] mask [netmask_ip] [parameter]


The main parameters of parameter are the following:

    • nomodify: The client cannot use NTPC and NTPQ to modify the server's time parameters, However, the client can still use this host for network school;

    • noquery: Clients cannot use NTPQ, NTPC and other instructions to query the time server, is equivalent to not providing NTP network school;

If you do not add any parameters to the parameter, it means "The IP or network segment is not subject to any restrictions". In general, we can first turn off the permissions of NTP and then one more to enable the network segment that is allowed to log in.


2). Modify the main configuration file/etc/ntp.conf, add the following line

Example

[Email protected] ~]# vim/etc/ntp.confrestrict 192.168.44.130 mask 255.255.255.0 nomodify notrap


V. Start NTP

1). Start the service

[[Email protected] ~]# service ntpd startstarting ntpd: [OK]



2). Join the Boot up service list

[Email protected] ~]# chkconfig ntpd on



3). Add Firewall rule

[Email protected] ~]# Vim/etc/sysconfig/iptables

-A input-d 192.168.44.130-p UDP--dport 123-m State--state new-j ACCEPT


[[email protected] ~]# ss -unlp|grep  "NTPD" state       recv-q send-q                             Local Address:Port                                Peer Address:Port UNCONN      0      0                                   192.168.44.130:123                                            *:*        Users: (("ntpd", 23537,18)) unconn     0      0                                        127.0.0.1:123                                            *:*       users: (("ntpd", 23537,17 )) unconn     0      0                              &Nbsp;                *:123                                             *:*       users: (("ntpd", 23537,16)

5). View NTP Service status

[[email protected] ~]# Ntpstat synchronised to NTP server (202.118.1.130) @ Stratum 3 time correct to within MS P Olling server every S


Vi. Client Synchronization

1). Client Manual Synchronization

[[email protected] ~]# ntpdate 192.168.44.13029 Sep 22:59:31 ntpdate[5323]: Adjust time server 192.168.44.130 offset 0.034 930 sec

2). Add Crontab Task Scheduler

[[email protected] ~]# crontab-e# update time from 192.168.44.130 one hour* */1 * * * ntpdate 192.168.44.130 &>/V Ar/log/ntpdate.log



At this point, a basic NTP server is built to complete, this article reference

Bird's-cousin's private dish NTP server article: HTTP://VBIRD.DIC.KSU.EDU.TW/LINUX_SERVER/0440NTP.PHP#PS4

This article is from the "Hello,linux" blog, make sure to keep this source http://soysauce93.blog.51cto.com/7589461/1699336

CentOS6.5 NTP service

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.