****LINUX时间同步配置*****

#检查和ntp服务端口

nc -uz ntp服务地址 123

#ntp和chrony默认配置文件

/etc/ntp.conf(主配置文件)

/etc/ntp/step-tickers(初始服务器列表(某些系统具备该文件))

/etc/chrony.conf(主配置文件)

/etc/chrony.keys(默认密钥文件)

#做好以下配置就可以自动同步时间(最简化,首次自动同步2-10s,后续1-17分钟自动同步)

1、只要在/etc/ntp.conf或者/etc/chrony.conf配置server ntp服务地址 iburst(注意pool地址不要设置,可能导致冲突失败)

2、开启ntpd服务或者chronyd服务,systemctl start ntpd或者systemctl start chronyd

3、开机自启systemctl enable ntpd或者systemctl enable chronyd

#检查同步情况

ntpq -pn(有*号显示同步成功)

ntpstat(synchronised表示同步成功)

chronyc tracking(有*号显示同步成功)

chronyc sources(有*号显示同步成功)

#手动立即同步

ntpdate -u ntp服务地址

chronyc makestep

****硬件时间(RTC表示硬件时间,通常为utc时间,本地时间等于utc+8h)*****

hwclock -s(硬件时间同步到系统时间)

hwclock -w(系统时间同步到硬件时间,最好不要!)

timedatectl status(查看硬件和系统时间)

相关推荐
A小辣椒1 天前
TShark:Wireshark CLI 功能
linux
A小辣椒1 天前
TShark:基础知识
linux
AlfredZhao1 天前
OCI 明明分配了 200G 系统盘,为什么 df 只看到 30G?
linux·oci
AlfredZhao2 天前
vi 删除指定范围的行,不用再反复按 dd
linux·vi
用户9718356334662 天前
银河麒麟 KY10 申威(SW64) 安装 nginx-1.16.1-2.p01.ky10.sw_64.rpm 详细步骤
linux
猪脚踏浪2 天前
linux 拷贝文件或目录到指定的位置
linux
大树883 天前
金刚石散热越强,管路越先见顶
大数据·运维·服务器·人工智能·ai
摇滚侠3 天前
Linux CentOS7 rpm 安装 MySQL 5.7
linux·运维·mysql
霸道流氓气质3 天前
领域驱动设计(DDD)在 Spring Boot 微服务中的实践指南
运维·spring boot·微服务
bush43 天前
嵌入式linux学习记录十四、术语
linux·嵌入式