阿里云ntp服务器(ntp时间同步工具chrony)

Chrony 应用本身已经有几年了,是网络时间协议的 (NTP) 的另一种实现。一直以来众多发行版里标配的都是ntpd对时服务,自rhel7/centos7 起,Chrony做为了发行版里的标配服务,不过老的ntpd服务依旧在rhel7/centos7里可以找到 。Chrony可以同时做为ntp服务的客户端和服务端。默认安装完后有两个程序chronyd和chronyc 。chronyd是一个在系统后台运行的守护进程,chronyc是用来监控chronyd性能和配置其参数程序。chrony时间同步软件,目前centos7系统默认自带。若没安装使用yum -y install chrony进行下载。配置ntp服务-客户端配置1.修改配置文件/etc/chrony.conf配置服务器ip地址(server servier_ip iburst #选择要同步的服务器)局域网或者公网北京时间提供的服务器为:ntpip1,ntpip2 tce环境开出的虚机,默认已经设置好ntp。# Use public servers from the pool.ntp.org project.# Please consider joining the pool (http://www.pool.ntp.org/join.html).#server 0.centos.pool.ntp.org iburst#server 1.centos.pool.ntp.org iburst#server 2.centos.pool.ntp.org iburst#server 3.centos.pool.ntp.org iburstserver ntpip1 iburst# Ignore stratum in source selection.stratumweight 0# Record the rate at which the system clock gains/losses time.driftfile /var/lib/chrony/drift# Enable kernel RTC synchronization.rtcsync# In first three updates step the system clock instead of slew# if the adjustment is larger than 10 seconds.makestep 10 3# Allow NTP client access from local network.#allow 192.168/16# Listen for commands only on localhost.bindcmdaddress 127.0.0.1bindcmdaddress ::1# Serve time even if not synchronized to any NTP server.#local stratum 10keyfile /etc/chrony.keys# Specify the key used as password for chronyc.commandkey 1# Generate command key if missing.generatecommandkey# Disable logging of client accesses.noclientlog# Send a message to syslog if a clock adjustment is larger than 0.5 seconds.logchange 0.5logdir /var/log/chrony#log measurements statistics tracking2.重启服务 systemctl restart chronyd3.client查看同步结果chronyc sources -v #-V 亦可 ,结果为^*则同步完成ntp服务-服务端搭建配置不建议使用虚机作为ntp服务器建议ntp服务器使用物理机或者使用专用ntp服务器server修改主配置文件, vim /etc/chrony.conf,修改allow配置# Use public servers from the pool.ntp.org project.# Please consider joining the pool (http://www.pool.ntp.org/join.html).#server 0.centos.pool.ntp.org iburst#server 1.centos.pool.ntp.org iburst#server 2.centos.pool.ntp.org iburst#server 3.centos.pool.ntp.org iburst# Record the rate at which the system clock gains/losses time.driftfile /var/lib/chrony/drift# Allow the system clock to be stepped in the first three updates# if its offset is larger than 1 second.makestep 1.0 3# Enable kernel synchronization of the real-time clock (RTC).rtcsync# Enable hardware timestamping on all interfaces that support it.#hwtimestamp *# Increase the minimum number of selectable sources required to adjust# the system clock.#minsources 2# Allow NTP client access from local network.allow 127.0.0.1 #允许谁去同步我的时间# Serve time even if not synchronized to a time source.local stratum 10 #不去同步任何人的时间# Specify file containing keys for NTP authentication.#keyfile /etc/chrony.keys# Specify directory for log files.logdir /var/log/chrony# Select which information is logged.#log measurements statistics tracking2.systemctl restart chronyd #重启服务systemctl stop firewalld #防火墙没关的话需要关闭三、NTP 服务器列表Windows系统上自带的两个:time.windows.com 和 time.nist.govMacOS上自带的两个:time.apple.com 和 time.asia.apple.comNTP授时快速域名服务:cn.ntp.org.cn1、阿里云授时服务器#NTP服务器 ntp.aliyun.com 2、国外授时服务器#NTP服务器time.google.comtime.apple.com


本文出自快速备案,转载时请注明出处及相应链接。

本文永久链接: https://www.xiaosb.com/beian/37033/