Skip to main content

NTP Server


背景

ESXi Server 没有外网访问功能,需要通过内其它机节点的 NTP Server 同步时间。

测试外网
vmkping 8.8.8.8

安装 NTP Server

apt install chrony -y
vim /etc/chrony/chrony.conf

检查是否有外网源:

pool ntp.ubuntu.com        iburst maxsources 4
pool 0.ubuntu.pool.ntp.org iburst maxsources 1
pool 1.ubuntu.pool.ntp.org iburst maxsources 1
pool 2.ubuntu.pool.ntp.org iburst maxsources 2

在最后添加配置:

allow 10.x.x.0/24
验证 NTP 服务状态
chronyc tracking
chronyc sources

配置 ESXi 使用内网 NTP

设置 NTP 服务器
esxcli system ntp set --server "10.x.x.x"
启用 NTP
esxcli system ntp set --enabled true
启动服务
/etc/init.d/ntpd start
查看同步状态
ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*10.x.x.x        139.199.214.202  3 u   36   64  377    0.600  +21.914   1.646

保存当前系统配置(例如网络设置、NTP、存储、用户账号等)到持久化存储。

/sbin/auto-backup.sh