Abner Kou
原创,转载请注明出处
[url]http://abner.cublog.cn[/url]
EsxServer
的时间同步设置
我的服务器出现了这样的情况,
EsxServer
启动的时候,长时间停止在时间同步的位置,最后显示失败“
ntpd
:
Synchronizing with time server
:
[FAILED]
”
本文解决了此问题,并可以作为配置
ESx
时间同步的参考
主要是设置
ntp
同步的服务器地址,在防火墙上允许
ntpClient
通过
如果想让此台
Esxserver
成为
NTP
的服务器,可以将
firewall
服务停掉
配置过程
1
:
# service ntpd restart
重启服务
Shutting down ntpd: [ OK ]
ntpd: Synchronizing with time server: tail /var/ [FAILED]
Starting ntpd: [ OK ]
显示同步失败
2
:
# tail /var/log/messages
查看日志
Apr 14 10:39:41 VmServer07 ntpd: ntpd shutdown succeeded
Apr 14 10:39:41 VmServer07 ntpdate[3402]: can't find host server
Apr 14 10:39:50 VmServer07 ntpdate[3402]: no server suitable for synchronization found
Apr 14 10:39:50 VmServer07 ntpd: failed
显示没有合适的同步服务器
3
:
# vi /etc/ntp.conf
查看
ntp
服务配置文件
restrict kod nomodify notrap noquery nopeer
restrict 127.0.0.1
server 127.127.1.0
driftfile /var/lib/ntp/drift
# Authentication delay. If you use, or plan to use someday, the
修改
server
地址为
192.168.40.5
(
192.168.40.5
为可用的
ntp
服务器地址)
4
:
# vi/etc/ntp/step-tickers
修改
server
地址为
192.168.40.5
Server 192.168.40.5
如果想让次
Esxserver
做为
NTP
服务器可以在此添加网络上的
NTPServer
地址,比如教育网可以添加成
server s2a.time.edu.cn
server s2b.time.edu.cn
server s2c.time.edu.cn
server s2d.time.edu.cn
server s2e.time.edu.cn
)
4
:
# esxcfg-firewall �Cq ntpClient
Service ntpClient is blocked.
显示客户端的查询服务被阻止
5
:
esxcfg-firewall
--enableService ntpClient
开启ntp的客户端查询服务,Esx做为客户端就可以和192.168.40.5进行时间同步了。
6
:所有设定完成,检验一下可否域时间服务器192.168.40.5同步时间
# service ntpd restart
Shutting down ntpd: [ OK ]
ntpd: Synchronizing with time server: [ OK ]
Starting ntpd: [ OK ]
# ntpdate �Cu 192.168.40.5
手动同步时间
14 Apr 16:56:11 ntpdate[3092]: adjust time server 192.168.40.5 offset -0.006880 sec
7:# chkconfig
--
level 345 ntpd on
设置ntpd服务自动启动
8
:# watch “ntpq -p”
可以查询
ntpd
进程运行状态