BlueXIII's Blog

热爱技术,持续学习

0%

K8S离线部署笔记-7-NTP服务

所有主机

1
2
3
4
5
6
# 安装
yum install -y ntp

# 启用服务
systemctl start ntpd
systemctl enable ntpd

服务端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 修改配置
vi /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 127.127.1.0
fudge 127.127.1.0 stratum 0

# 重启服务
systemctl restart ntpd

# 查看状态
ntpq -p
ntpstat

客户端

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# 修改配置
vi /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 10.10.51.77
fudge 10.10.51.77 stratum 0
restrict 10.10.51.77 nomodify notrap noquery

# 重启服务
systemctl restart ntpd

# 手工同步时间
ntpdate -u 10.10.51.77

# 查看状态
ntpq -p
ntpstat