NTP (Network time Protocol) server: Temporal server

Source: Internet
Author: User

NTP (Network time Protocol) server: Temporal server
GMT (Greenwich Mean time,gmt time): Greenwich Mean Time
Summer saving time (or daylight saving time): Daylight savings (DST)
UTC (coordinated Universal time): Concord Standard Times
The most standard time is calculated by atomic clocks, according to the Atomic Oscillation cycle
UTC and GMT time are 16 minutes apart due to different timing methods

Software Clock: The total number of seconds calculated by the Linux operating system starting from 1970/01/01;
Hardware clock: The clock above the host hardware system, such as the time of the BIOS recording
DTSS (Digitally time synchronization Protocol) Digital Timing Synchronization Protocol

NTP is a port 123 connected (using UDP packets), using the ntpdate provided by the NTP software for Port 123 online

The hierarchy (stratum) concept of the NTP server, similar to the master-slave DNS
NTP server installation and setup: Yum or rpm install NTP
Tzdata: The software name is an abbreviation for [Time zone Date], which provides the display format for each timezone
/etc/ntp/conf: Is the NTP server's main configuration file, is also the only one;
/usr/share/zoneinfo/: Provided by Tzdata, the time format for each time zone corresponds to the file
/etc/sysconfig/clock: Set the time zone and whether to use UTC time Clock configuration file, after each boot Linux will automatically read this file to set their own system to display the default times, and/usr/share/zoneinfo/under the file related
/etc/localtime: Local-side time profile

There are a few of the following directives that are commonly used for time servers and modification times:
/bin/date: Instructions for modification and display of Linux time (software clock);
/sbin/hwclock: For the BIOS clock (hardware clock) modification and display instructions, only the root can execute, the modified time to write to the BIOS; hwclock-w synchronize the BIOS time with the system current time
/USR/SBIN/NTPD: The program that mainly provides the NTP service, the configuration file is/etc/ntp.conf
/usr/sbin/ntpdate: Time correction for the client

Main configuration file ntp.conf: The main parameters in the ntp.conf are as follows
Restrict can be used to manage rights control within the ntp.conf file:
1. Restrict [your IP] mask [netmask_ip] [parameter]
The main parameters of parameter are:
Ignore: Deny all types of NTP online;
Nomodify: The client cannot use the NTPC and NTPQ to modify the time parameters of the server, but it can still be used to network school through this non-host;
Noquery: The client can not use NTPQ, NTPC and other instructions to query the time server, equal to not provide NTP network school;
Notrap: does not provide the ability to trap this remote event login (logging)
Notrust: Deny clients that are not authenticated
If no parameter is added to the parameter, it means [the IP or network segment is not subject to any restrictions]
such as: Restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

2, the upper level NTP server setting mode:
server [IP or hostname] [prefer]; Prefer represents a [preferred] server, such as Iburst
The original 0|1|2 server project needs to be annotated (#) off
such as: Server 0.centos.pool.ntp.org Iburst

3. Record time differences with driftfile (no changes required):
Driftfile [Directories and archives that can be ntpd written]
Files that follow the Driftfile are automatically updated by NTPD, such as/var/lib/ntp/drift
The owner of NTPD is NTP, which can be consulted/etc/sysconfig/ntpd

4, keys [Key_file] (do not need to move): Through the key system to the client authentication, reference Ntp-keygen instructions
After setting up ntp.conf to start the NTPD service, it usually takes 15 minutes to connect to the upper NTP server successfully.
, search for updates through the following instructions: ntpstat directive, ntpq-p
Firewall settings in NTP service ports Port 123 to open

How the client time is updated:
1, Linux Manual School Time: date, Hwclock
Date mmddhhmmyyyy, for example: Date 072816332011, modified to this time
Options and Parameters:
MM: Month
DD: Date
HH: Hours
MM: Minutes
YYYY: The Public

Hwclock [-RW]
Options and Parameters:
-R: That is, read the current time parameters in the BIOS;
-W: Write, writes the current Linux system time to the BIOS
For example: Writes the current time to the BIOS, hwclock-w; Soft time and hard time synchronization
Each time the system starts, it will be read out by the BIOS and the BIOS is the important time basis

NTP server time synchronization with the upper-level time server, so the default NTP server can not use Ntpdate, that is, ntpdate and NTPD cannot be enabled simultaneously
directive: ntpdate [-DV] [NTP Ip/hostname]
Options and Parameters:
-D: Enter debug mode to display more useful information
-V: Display with more information

Scheduled tasks for timed sync time: Add a row to the/etc/crontab
5 * Root (/usr/sbin/ntpdate upper time server name &&/sbin/hwclock-w) &>/dev/null
The time error between NTP servers cannot exceed 1000 seconds, otherwise the NTP service will shut down automatically
Ntptrace is used to track the connection time of the upper time server
Ntpdate Time.server.ip && hwclock-w can be used for network time proofreading directly on the client side:

NTP (Network time Protocol) server: Temporal 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.