server

mount /dev/cdrom /mnt/cdrom
yum install -y chrony

cd /etc/
echo n | cp -i chrony.conf chrony.conf.bak
#备份配置文件
sed -i "3,6s/^/#/g" chrony.conf

chronyconf="server 10.1.1.3 iburst\nallow 0.0.0.0/0\nlocal stratum 1"
sudo echo -e $chronyconf >> chrony.conf

systemctl enable chronyd
systemctl start chronyd
timedatectl set-ntp on

chronyc sources -v
ps axf | grep chronyd

client

mount /dev/cdrom /mnt/cdrom
yum install  -y chrony
cd /etc/
echo n | cp -i chrony.conf chrony.conf.bak
#备份配置文件
sed -i "3,6s/^/#/g" chrony.conf
chronyconf="server 10.1.1.3 iburst"
echo -e $chronyconf >> chrony.conf
cat /etc/chrony.conf
systemctl enable chronyd
systemctl start chronyd
timedatectl set-ntp on
chronyc sources -v
# *号表示同步成功  ?表示未同步
chronyc tracking
ps axf | grep chronyd
最后修改:2023 年 10 月 23 日
如果觉得我的文章对你有用,请随意赞赏