NTP服务器时间配置

简介

ntp服务器是一个同步时间都服务器。

开启ntpd

1.查看状态(可以看到状态为:inactive,也就是没有启动ntp服务)

[root@localhost]$ systemctl status ntpd
● ntpd.service - Network Time Service
   Loaded: loaded (/usr/lib/systemd/system/ntpd.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

2.启动

[root@localhost]# systemctl start ntpd

3.设置开机启动

[root@node1 ~]# systemctl enable ntpd

查看ntpd信息

# ntptime
#ntpd -pn

测试方式

测试地址

测试代码

./client ip
./client -s
./client -c

预测结果

两台是同一台机子 两台不同机子
两台都有ntp 差值趋紧0 线性
两台都没有ntp
一台有ntp,一台没有
两台都有ntp,但是同步到不同ntp
两台都有ntp,第一台作为第二台都ntp

猜你喜欢

转载自blog.csdn.net/dreaming317/article/details/132590960