关于Centos7使用Chrony时间同步记录

# 安装时间同步【centos7默认已经安装】
yum -y install chrony
systemctl enable chronyd
systemctl start chronyd
systemctl restart chronyd

# 编辑时间同步
# NTP服务器:
# 210.72.145.44 (国家授时中心服务器IP地址))
# ntp.sjtu.edu.cn 202.120.2.101 (上海交通大学网络中心NTP服务器地址)
vim /etc/chrony.conf
server 210.72.145.44 iburst
server ntp.sjtu.edu.cn iburst

# 查看时间同步状态
timedatectl status
# 开启网络时间同步
timedatectl set-ntp true

# 查看 ntp_servers
chronyc sources -v
# 查看 ntp_servers 状态
chronyc sourcestats -v
# 查看 ntp_servers 是否在线
chronyc activity -v
# 查看 ntp 详细信息
chronyc tracking -v

# 查看日期时间、时区及 NTP 状态
timedatectl

# 查看时区列表
timedatectl list-timezones
timedatectl list-timezones |  grep  -E "Asia/S.*"
# 修改时区
timedatectl set-timezone Asia/Shanghai
# 修改日期时间[一般不需要设置]
timedatectl set-time "2021-09-89 15:20:20"
# 开启 NTP
timedatectl set-ntp true/flase

firewall-cmd --add-service=ntp --permanent
firewall-cmd --reload
posted @ 2021-09-08 15:23  刘文江  阅读(9)  评论(0)    收藏  举报  来源