一.时间的来源?怎么传播?
时间的来源:现在的标准时间是由原子钟报时的国际标准时间UTC(Universal Time Coordinated,世界协调时),所以NTP获得UTC的时间来源可以是原子钟、天文台、卫星,也可以从Internet上获取。
怎么传播:按层次传播,GPS获取标椎时间,通过网络发送给第一层ntp服务器,然后第一层ntp服务器又传给第二层......一直到客户机
二.ntp服务简介?
概述:ntp是一个网络时间协议,用来使计算机时间同步,ntp可以使计算机对其服务器或时钟源做同步,提供高精度时间校正
运行模式:c/s模式
端口号:123
安装:yum isntall ntp -y
配置文件的位置:/etc/ntp.conf
监听端口,启动服务:
natstat -anptu | grep 123 如果监听不到,就开启服务
然后就systemctl start ntpd 就可监听到,监听到端口就说明服务正常运行
systemctl enable ntpd 设置为开机自启
三.此服务的使用方法?
- 自己的服务器到时钟源去同步时间
ntpdate: 时间同步命令
用法:ntpdate 目标ntp源ip 或 ntpdate 目标ntp源域名
vim /etc/ntp.conf 可以看到下面是由Centos提供的一些ntp时间源
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
ntpdate 0.centos.pool.ntp.org
ntpdate 0.centos.pool.ntp.org #把服务器的时间同步到这个ntp源