[Ubuntu/系统时间] 系统时间相关

造冰箱的大熊猫@cnblogs 2022/3/16

1、NTP协议

NTP(Network Time Protocol)是通过网络实现时间同步的通信协议。本机通过该协议访问NTP服务器校正本机时间。

 

2、可用的NTP服务器

服务器提供单位 服务器地址 ping延时 备注
国家授时中心 ntp.ntsc.ac.cn <10ms  
阿里云 time#.aliyun.com ~20ms 将#替换为数字1~7中的某个
腾讯云 time#.cloud.tencent.com ~40ms 将#替换为数字1~5中的某个
中国科学技术大学 ntp.ustc.edu.cn ~20ms  
清华大学 ntp.tuna.tsinghua.edu.cn <10ms  
ntp.org pool.ntp.org >200ms  
#.pool.ntp.org>200ms 将#替换为数字0~3中的某个
asia.pool.ntp.org  
NIST(美国国家标准与计量研究院) 服务器地址详见https://tf.nist.gov/tf-cgi/servers.cgi

 

3、在Ubuntu下同步本机时间

从Ubuntu 16.04开始,使用timedatectltimesyncd(包含在systemd中)替换了传统的ntpdate。

 操作  命令 备注
查询当前时间 date 或 timedatectl  
使能时间同步 sudo timedatectl set-ntp on  
禁止时间同步  sudo timedatectl set-ntp off  
列出所有时区 timedatectl list-timezones  
更改时区 sudo timedatectl time-zone [zone] 将[zone]替换为上一条命令list-timezones得到的时区列表中的某一项

详见<https://ubuntu.com/server/docs/network-ntp>

posted @ 2022-03-16 10:23  造冰箱的大熊猫  阅读(115)  评论(0编辑  收藏  举报