NTP server configuration under Linux

Source: Internet
Author: User

    1. Brief introduction
    2. Principle
    3. Configuring the NTP server
    4. To synchronize

Brief introduction

When calculating the time, the most accurate calculation should be the use of "atomic oscillator cycle" calculated by the physical clock (Atomic clock, also known as atomic clock), which is also defined as the standard Time (international Atomic times). And the UTC that we often see is coordinated Universal time (Concord Standard) is the correct time defined by this Atomic Clock. This UTC standard time is based on GMT, the time zone. So the difference between local time and UTC time is the difference between local time and GMT time.

The internal BIOS of the computer host contains an atomic clock, because the atomic clock is mainly used in the calculation chip (crystal) of the atomic oscillator cycle to time, each chip has its own unique oscillation cycle. And the computer is mainly in the BIOS internal time as the main time basis, but this time may be due to the BIOS internal chip itself problem, and lead to the BIOS time and Standard Time (UTC) difference exists, so, in order to avoid the host time due to long-term operation caused by the time deviation, it is necessary The network time Protocol NTP function is synchronized.

Principle

1. The host will of course need to start daemon

2. The Client sends a message with the tuning time to the NTP Server

3. NTP Server will send the current standard time to the Client

4. After the Client receives the time from the Server, it adjusts its own time.


However, there is a time lag and delay of synchronization between client side and server side, and in the daemon part, the server/client and Master/slave architectures are provided to provide the user with the action of network alignment to ensure the calibration times are more accurate.


Installation configuration
  1. install NTP service

    # Yum install-y NTP ntpdate

     

  2. Configuring the NTP Service

    Editing a configuration file/etc/ntp.conf

    Ignore: Turn off all NTP online services

    Nomodify: Indicates that the client side cannot change the server-side time parameter, but the client side can still synchronize time through the server side

    Notrap: Rejecting a special NTPDQ capture message

    Noquery: Reject BTODQ/NTPDC Query

    Server: Add settings for upper-level hosts or add as NTP servers on the Internet

    The annotations in the configuration file are also very clear.

    (This figure is just another example)

  1. add firewall rules and start NTP service

    #iptables –A input–p udp–i eth0–s 10.0.7.0/24–dport 123–j ACCEPT

    #systemctl start ntpd

  2. On client operations:
    1. Download and install NTP
    2. Synchronizing with Ntpdate

      #ntpdate NTP server-side IP

      If the synchronization is successful, but the time is not synchronized, it may be a time zone problem, the easy way to modify the time zone is available:

      Cp/usr/share/zoneinfo/asia/shanghai/etc/localtime

If "No server suitable for synchronization found" appears, check that the NTP server is properly configured and the firewall settings are correct, etc., if not, try synchronizing the NTP server on the network, such as Ntpdate Time.nist.gov (if the client needs to be able to network)

  #date

Show System time

#hwclock

Display System Hardware Time

#hwclock-W

Write system time to system hardware

Timed time synchronization tasks are performed, so we use CRONTAB-E to add timed tasks

* 1/* * * root/usr/sbin/ntpdate 10.0.7.149;hwclock-w

NTP server configuration under Linux

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.