****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(查看硬件和系统时间)

相关推荐
2023自学中2 分钟前
从键盘输入 ./aaa 到程序运行,中间发生了什么?
linux·嵌入式
keyipatience6 分钟前
13.系统调用与进程管理全解析
linux
xingyuzhisuan7 分钟前
风冷还是水冷?RTX 4090服务器散热方案对比
运维·服务器·ai·gpu算力
你今天努力了吗?*—*8 分钟前
4.1 Linux 日志排查
linux·运维·服务器
小狗爱吃黄桃罐头11 分钟前
宋宝华:原理和实战解析Linux中如何正确地使用内存屏障
linux·内存屏障
山上三树14 分钟前
操作系统如何实现各种功能
linux·运维·服务器
妹妹够啦21 分钟前
PyCharm创建venv环境
linux·运维·服务器
Tim风声(网络工程师)29 分钟前
iMaster NCE-Campus和iMaster NCE-Fabric的区别
运维·fabric
我爱小疯喵喵31 分钟前
5 Linux apt下载软件包
linux·运维·服务器
坚持就完事了33 分钟前
Linux中的tr命令
linux·运维·服务器