原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://delxu.blog.51cto.com/975660/307513
【推荐阅读】
这篇最好:http://wiki.ubuntu.org.cn/Quick_HOWTO_:_Ch24_:_The_NTP_Server/zh
NTP 命令行:http://www.linux-consulting.com/NTP/NTP.Commands.txt
Timekeep Best Practice for Linux Guest:http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006427
https://www.vmware.com/pdf/vmware_timekeeping.pdf
NTP 命令行:http://www.linux-consulting.com/NTP/NTP.Commands.txt
Timekeep Best Practice for Linux Guest:http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006427
https://www.vmware.com/pdf/vmware_timekeeping.pdf
==========================================
/etc/ntp.conf 文件是ESX/Linux NTP的主要配置文件
启动,停止,重启NTP,用下面的命令:
[root@bigboy tmp]# service ntpd start
[root@bigboy tmp]# service ntpd stop
[root@bigboy tmp]# service ntpd restart
使用下面的命令检查NTP服务是否运行
[root@bigboy tmp]# pgrep ntpd
检查ntp同步状况
[root@bigboy tmp]# ntpq -p
手动和某一服务器同步(必须要跟服务器地址),运行这个命令要求先关闭ntpd服务。用service ntpd stop来停止ntpd
[root@bigboy tmp]# ntpdate 0.pool.ntp.org
ntpdate 命令在smallfry机器上运行了3次去同步192.168.1.100服务器的时间,不过它必须在ntpd进程停止的时候运行,所以你要先停止ntpd,运行ntpdate,然后再运行ntpd.
[root@smallfry tmp]# service ntpd stop
[root@smallfry tmp]# ntpdate -u 192.168.1.100
Looking for host 192.168.1.100 and service ntp
host found : bigboy.my-site.com
12 Aug 08:03:38 ntpdate[2472]: step time server 192.168.1.100 offset 28993.084943 sec
[root@smallfry tmp]# ntpdate -u 192.168.1.100
Looking for host 192.168.1.100 and service ntp
host found : bigboy.my-site.com
12 Aug 08:03:40 ntpdate[2472]: step time server 192.168.1.100 offset 2.467652 sec
[root@smallfry tmp]# ntpdate -u 192.168.1.100
Looking for host 192.168.1.100 and service ntp
host found : bigboy.my-site.com
12 Aug 08:03:42 ntpdate[2472]: step time server 192.168.1.100 offset 0.084943 sec
[root@smallfry tmp]# service ntpd start
[root@smallfry tmp]#
[root@smallfry tmp]# ntpdate -u 192.168.1.100
Looking for host 192.168.1.100 and service ntp
host found : bigboy.my-site.com
12 Aug 08:03:38 ntpdate[2472]: step time server 192.168.1.100 offset 28993.084943 sec
[root@smallfry tmp]# ntpdate -u 192.168.1.100
Looking for host 192.168.1.100 and service ntp
host found : bigboy.my-site.com
12 Aug 08:03:40 ntpdate[2472]: step time server 192.168.1.100 offset 2.467652 sec
[root@smallfry tmp]# ntpdate -u 192.168.1.100
Looking for host 192.168.1.100 and service ntp
host found : bigboy.my-site.com
12 Aug 08:03:42 ntpdate[2472]: step time server 192.168.1.100 offset 0.084943 sec
[root@smallfry tmp]# service ntpd start
[root@smallfry tmp]#
排错时候查看有关ntpd的日志
[root@smallfry tmp]# cat /var/log/messages | grep ntpd
本文出自 “delxu Tech Notebook” 博客,请务必保留此出处http://delxu.blog.51cto.com/975660/307513