Set up NTP time server and ntp server

Source: Internet
Author: User
Tags aliyun

Set up NTP time server and ntp server
1.1 NTP Introduction

Network Time Protocol (NTP) is a Protocol used to synchronize Time between computers in the Network. Its purpose is to synchronize the computer clock to the Coordinated Universal Time UTC, and its accuracy can reach 0.1 ms in the LAN. In most places on the Internet, its accuracy can reach 1-50 ms.

The NTP server uses the NTP protocol to provide time synchronization services.

System Version

1 [root@test ~]# cat /etc/redhat-release 2 CentOS release 6.9 (Final)

 

1.2 NTP server Installation

 

1 [root@test ~]# rpm -qa ntp2 ntp-4.2.6p5-10.el6.centos.2.x86_64

If not, install yum install ntp-y.

1.3 Configure NTP service

Backup configuration file

1 [root@test ~]# cp /etc/ntp.conf{,.bak}2 3 [root@test ~]# ll /etc/ntp.conf*4 5 -rw-r--r--. 1 root root 1778 Jan 11  2017 /etc/ntp.conf6 7 -rw-r--r--  1 root root 1778 Oct 23 23:10 /etc/ntp.conf.bak

Simplify configuration files

1 [root@test ~]# egrep -v "^$|#" /etc/ntp.conf.bak  >/etc/ntp.conf

Modify configuration file

1 [root @ test ~] # Cat/etc/ntp. conf 2 3 # driftfile/var/lib/ntp/drift 4 5 # restrict default kod nomodify notrap nopeer noquery 6 7 # restrict-6 default kod nomodify notrap nopeer noquery 8 9 # restrict 127.0.0.110 11 # restrict-6:: 112 13 # server route iburst14 15 # server 1.centos.pool.ntp.org iburst16 17 # server route iburst18 19 # server route iburst20 21 # includefile/etc/ntp/crypto/pw22 23 # keys/etc/ntp/ keys24 25 # The nomodify client can synchronize 26 27 # change the default time synchronization source annotation to available source 28 29 restrict default nomodify30 31 server ntp1.aliyun. com32 33 server time.nist.gov
1.4 Start the NTP server

Note: If a scheduled task with a synchronization time needs to be canceled, otherwise the task will conflict.

1 [root@test ~]# /etc/init.d/ntpd start2 Starting ntpd:                                             [  OK  ]

Show node list

1 [root@test ~]# ntpq -p2      remote           refid      st t when poll reach   delay   offset  jitter3 ==============================================================================4  time5.aliyun.co 10.137.38.86     2 u   28   64    3    5.092  6241215 185.6235 6  132.163.96.4    .INIT.          16 u    -   64    0    0.000    0.000   0.000
1.5 Client Time Synchronization

The client will wait several minutes to synchronize time with the newly started ntp server. Otherwise, a prompt will be displayed.

No server suitable for synchronization found Error

1 [root@client ~]# ntpdate 10.0.0.2502 24 Oct 16:46:58 ntpdate[26694]: adjust time server 10.0.0.250 offset 0.320652 sec

 

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.