Configuring NTP basic operations in Linux

Source: Internet
Author: User

The computer's system time is generated by a fixed oscillation frequency in the quartz crystal oscillator circuit in the computer.

Date View current time zone
Vim/etc/sysconfig/clock Modifying the time zone configuration file
Zone= "America/new_york"
#改为
Zone= "Asia/shanghai"

cover/etc/localtime
cp-a/usr/share/zoneinfo/asia/shanghai/etc/localtime
Cp:overwrite '/etc/localtime '? Y
Date 111317402016 Modify system time
Hwclock-w synchronizing system time to hardware time

Rpm-qa |grep NTP checks if NTP is installed
Yum Install ntp*-y install NTP

Vim/etc/sysconfig/ntpdateset up sync update local Hwclock
In Linux under the system time on the boot and Hardware time synchronization (synchronization), and then each independently run, then since the two clock running alone, then the time will inevitably produce errors, and NTP by default only update the system time, So we need to set the hardware clock for synchronous adjustment

[email protected] ~]# vim/etc/ntp.conf #ntp配置文件
For more information about this file, see the "the Man pages"
# ntp.conf (5), NTP_ACC (5), Ntp_auth (5), Ntp_clock (5), Ntp_misc (5), Ntp_mon (5).

Driftfile/var/lib/ntp/drift

# Permit time synchronization with We time source, but does not
# permit the source to a query or modify the service on this system.
restrict default Kod nomodify notrap nopeer noquery# Disable all address access to NTPD services
restrict-6 default Kod nomodify notrap nopeer noquery

# Permit All access over the loopback interface. This could
# is tightened as well, but to does so would effect some of
# the administrative functions.
restrict 127.0.0.1# allow native address (127.0.0.1) access to NTPD services
Restrict-6:: 1 #ipv6

# Hosts on local network is less restricted.
Restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap #允许地址段192.168.100.0 access to NTPD services, but does not allow clients in this address segment to modify NTPD server time

# Use public servers from the Pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.rhel.pool.ntp.org
#server 1.rhel.pool.ntp.org
#server 2.rhel.pool.ntp.org

#broadcast 192.168.1.255 AutoKey # Broadcast Server
#broadcastclient # Broadcast Client
#broadcast 224.0.1.1 AutoKey # Multicast Server
#multicastclient 224.0.1.1 # Multicast Client
#manycastserver 239.255.254.254 # Manycast Server
#manycastclient 239.255.254.254 AutoKey # manycast Client

# undisciplined Local Clock. This was a fake driver intended for backup
# and when no outside source of synchronized time is available.
Server 127.127.1.0 # Local clock #外部时间服务器不可用时, as time service in native time
Fudge 127.127.1.0 stratum #设置本地时钟源的层次为10 so that if the NTPD service gets time from the local clock source, NTPD announces the time level
...........................................................

Service ntpd Restart restart services NTP
PS aux | grep ntpd View NTP process
ntpq-p List Current NTP-related states

Vim/etc/selinux/config shutting down the firewall
# This file controls the state of the SELinux on the system.
# selinux= can take one of these three values:
# Enforcing-selinux security policy is enforced.
# Permissive-selinux Prints warnings instead of enforcing.
# disabled-no SELinux policy is loaded.
selinux=Disabled
# selinuxtype= can take one of these the values:
# targeted-targeted processes is protected,
# Mls-multi level Security protection.
selinuxtype=targeted

Ntpdate server address client Synchronization server time

Note: Synchronization takes some time

Configuring NTP basic operations in 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.