学校的ntp服务器配置解释

ntp服务器

学校提供ntp服务器用来校内同步

学校的ntp服务器的ip为

1
192.168.150.1

推荐使用的ntp服务器列表

阿里 腾讯 校内 三个足够

  • ntp.aliyun.com
  • time1.cloud.tencent.com
  • 192.168.150.1

其中有一些打印机和门屏没有被授予外网权限,才被迫使用学校内的ntp服务器。
从层级和准确度上来看,阿里和腾讯的更加优秀。

使用工具

使用chrony而不是ntp,参考这篇文章 同步时间,为什么我选 Chrony 而不是 NTP ?

核心用法

先检查系统中是否存在chrony或者ntp服务

1
sudo ps aux | grep -E "ntpd|chronyd"

安装chrony

1
yum install chrony

开启服务,开机自自动,检查服务状态三连

1
2
3
systemctl start chronyd.service
systemctl enable chronyd.service
systemctl status chronyd.service

编辑配置文件,在ubuntu上文件路径是/etc/chrony/chrony.conf

1
vi /etc/chrony.conf

注释掉初始的pool.ntp.org iburst

1
2
3
4
5
6
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (https://www.pool.ntp.org/join.html).
# pool pool.ntp.org iburst
server ntp.aliyun.com minpoll 4 maxpoll 10 iburst
server 192.168.150.1 minpoll 4 maxpoll 10 iburst
server time1.cloud.tencent.com minpoll 4 maxpoll 10 iburst

重启服务

1
systemctl restart chronyd.service

使用chrony相关命令检查

1
2
chronyc tracking
chronyc -n sources -v

参考的网络资源

同步时间,为什么我选 Chrony 而不是 NTP ?
国内常用NTP服务器地址
阿里云NTP指南