End the NTP service for Linux servers

Source: Internet
Author: User

Ntp:network Time Protocol is a protocol used to synchronize the timing of a computer, which allows the computer to synchronize its server or clock source (such as a quartz clock, GPS, and so on) to provide a high-precision time correction (less than 1 milliseconds between the LAN and the standard difference, Dozens of MS on the WAN), and can be referred to as a cryptographic acknowledgment to prevent malicious protocol attacks.

1. Installation:

Yum Install Ntpyum Install Tzdata

The NTP protocol uses the udp,port:123

2. Configuration file:

/etc/ntp.conf #NTF服务器的主配置文件.

/usr/share/zoneinfo #由tzdata所提供的为各时区的时间格式式对应的文件.

/etc/sysconfig/clock #设置时区是否使用UTC时钟的配置文件. Our general choice of time zone is/usr/share/zoneinfo/asia/shanghai

/etc/localtime #本地终端的时间配置文件, if the clock file specifies that the time setting file used for the/usr/share/zoneinfo/asia/shanghai,linux operating system will Shanghai that file Copying a copy is/etc/localtime, so the time display of the system will be based on the Shanghai time setting file.

Driftfile: Record time Variance in the format: driftfile [Full path name], which is defined in/etc/ntp.conf.

3. Configuration

Configuring an upstream NTP server

vim/etc/ntp.conf# Add the following content restrict 133.100.11.8restrict 192.168.1.0 mask 255.255.255.0 nomodifyserver 133.100.11.8 prefer# allows the upstream server to 133.100.11.8 through, and specifies that the upstream server is 133.100.11.8 and is set to the first server.

Restrict administrative rights control

Ignore: Deny all types of connections

Nomodify: The client cannot use the NTPC and NTPQ to modify the server's time parameters, but the client can still access the network via this host.

Noquery: The client cannot use both NTPC and NTPQ to query the time server, which is equal to not providing NTP network.

Notrap: does not provide the ability to trap this remote event login (logging).

Notrust: Denies clients that are not authenticated.

4. Start

Start NTP after configuration is complete

Service NTPD Start

5. View status

NETSTAT-TUNLP | grep NTP

Ntpstat: Lists whether to connect to the upstream server

Ntpq-p: Lists the connection status of our NTP server to the upstream server,

Ntpq-p Remote refID St T when poll reach delay offset jitter======================================================== ======================*133.100.11.8 133.100.53.51 2 u 194.077 48.430 57.956+dns2.synet.edu. 202.118.1.46 2 U 177 60.418 9.773 53.180dns.sjtu.edu.cn. Init. u-1024 0 0.000 0.000 0.000+dns1.synet.edu. 223.255.185.2 2 U 210 128 176 104.460-22.500 25.028

REMOT:NTP the IP or domain name of the upstream host, * indicates that the upper ntp,+ currently in use indicates a successful connection and can be used as a candidate for the next delivery time update.

refID: Reference to the previous layer of NTP server address

ST: it is the stratum stratum

When: A few seconds ago there was time to synchronize the update operation.

Poll: The next update is after a few seconds.

Reach: The number of times the update has been requested for the upper NTP server.

Delay: The time that is delayed during network transmission, in units of 10-6 seconds

Offset: The result of the time compensation, in 10-3 seconds.

Jitter:linux the time difference between the system time and the BIOS hardware time.

6. Time correction

The time in Linux is divided into:

Software clock: Linux own system time, starting from January 1, 1970 to record the time parameters. Modified with date.

Hardware clock: The actual time recorded by the computer system in the BIOS, which is the time recorded by the hardware. Modified with Hwclock.

Hwclock-r: Read the time parameters of the BIOS

Hwclock-w: Writes the current system time to the BIOS.

Network School-time Method:

1. Manual Time: Ntpdate ntp_server

2. Automatic School Hours:

A. Scripting:

B. Scheduled tasks:

CRONTAB-E10 * * * * Root (/usr/sbin/ntpdate 192.168.1.107 &&/bin/hwclock-w) &>/dev/null

C. The client initiates the NTP service, which is automatically calibrated. In/etc/ntp.conf configuration,

Restrict 192.168.1.107server 192.168.1.107

Start the service

Service NTPD start; Chkconfig ntpd on

Note: The NTP service will run normally after the boot is complete, and I will wait for almost 5 minutes, otherwise Windows would provide the following error.

650) this.width=650; "Style=" background-image:none;margin:0px;padding-left:0px;padding-right:0px; border-top-width:0px;border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" clipboard "border=" 0 "alt=" clipboard "src=" Http://img1.51cto.com/attachment/201407/20/151632_1405831945eLee.png "width=" 244 "height=" 164 "/>

The update was successful.

650) this.width=650; "Style=" background-image:none;padding-left:0px;padding-right:0px;border-top-width:0px; border-bottom-width:0px;border-left-width:0px;padding-top:0px; "title=" clipboard[1] "border=" 0 "alt=" clipboard[1] "Src=" Http://img1.51cto.com/attachment/201407/20/151632_1405831945L9Lu.png "width=" 244 "height=" 158 "/>

Attached: Available Timing Center Address:

133.100.11.8 prefer
210.72.145.44
203.117.180.36
131.107.1.10

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.