NTP是通信协议
NTP服务器的阶层概念:
由于 NTP 时间服务器采用类似阶层架构 (stratum) 来处理时间的同步化, 所以他使用的是类似一般 server/client 的主从架构。网络社会上面有提供一些主要与次要的时间服务器, 这些均属于第一阶及第二阶的时间服务器 (stratum-1, stratum-2)
1, 两台服务器
139(server端)
140(client端)
2.server端
2.1 yum安装
yum install ntp ntpdate
2.2 编辑配置文件
vim /etc/ntp.conf
#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
server 192.168.116.139
fudge 127.127.1.0 stratum 11
2.3. 启动服务
systemctl start ntpd
systemctl enable ntpd.service #设置开机启动服务
- 客户端
3.1 yum安装
yum install ntp ntpdate
3.2 同步时间
ntpdate -d -b 192.168.116.139
3.3 编辑配置文件
和server端相同
3.4 启动服务
systemctl start ntpd
systemctl enable ntpd.service #设置开机启动服务