Linux——時間

時間同步

1.服務端
yum install chrony -y ##安裝服務
這裏寫圖片描述
vim /etc/chrony.conf ##主配置文件
21 # Allow NTP client access from local network.
22 allow 172.25.0.0/24 ##允許誰去同步我的時間
28 # Serve time even if not synchronized to any NTP server.
29 local stratum 10 ##不去同步任何人的時間,時間同步服務器級別

systemctl restart chronyd
systemctl stop firewalld

2.客戶端
vim /etc/chrony.conf
這裏寫圖片描述
3 server 0.rhel.pool.ntp.org iburst
4 server 1.rhel.pool.ntp.org iburst====> server ntpserverip iburst
5 server 2.rhel.pool.ntp.org iburst====>
6 server 3.rhel.pool.ntp.org iburst
這裏寫圖片描述
systemctl restart chronyd

[root@localhost ~]# chronyc sources -v
這裏寫圖片描述

timedatectl命令
這裏寫圖片描述
timedatectl status ##顯示當前時間信息
這裏寫圖片描述
timedatectl set-time ##設定當前時間
這裏寫圖片描述
這裏寫圖片描述
timedatectl set-local-rtc 0|1 ##設定是否使用utc時間

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章