使用NTP自动同步时间

  • Post author:
  • Post category:其他



目录


步骤


其他常用ntp服务器


步骤

1. 安装 ntp

yum -y install ntp

2.设置开机自启

systemctl enable ntpd
systemctl start ntpd

3. 使用命令同步时间 (使用立即同步,下次还会继续不同步)

ntpdate -u cn.pool.ntp.org



4.


使用 crontab定时自动同步时间 (定时同步,下次过段时间自动同步)


重要!!!

echo "*/20 * * * * /usr/sbin/ntpdate -u ntp1.aliyun.com >/dev/null &" >> /var/spool/cron/root

其他常用ntp服务器

国内:

cn.pool.ntp.org  中国开源免费NTP服务器
ntp1.aliyun.com 阿里云NTP服务器
ntp2.aliyun.com 阿里云NTP服务器
time1.aliyun.com 阿里云NTP服务器
time2.aliyun.com 阿里云NTP服务器

国外:

time1.apple.com 苹果NTP服务器
time2.apple.com 苹果NTP服务器
time3.apple.com 苹果NTP服务器
time4.apple.com 苹果NTP服务器
time5.apple.com 苹果NTP服务器
time1.google.com 谷歌NTP服务器
time2.google.com 谷歌NTP服务器
time3.google.com 谷歌NTP服务器
time4.google.com 谷歌NTP服务器
pool.ntp.org 开源免费NTP服务器



版权声明:本文为weixin_54955442原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。