十單元補充:時間同步
#####4.如何同步系統時間######
1.服務端
yum install chrony -y ##安裝服務
vim /etc/chrony.conf ##主配置文件
22 # Allow NTP client access from local network.
23 allow 192.168/16 ##允許誰去同步我的時間
29 # Serve time even if not synchronized to any NTP server.
30 local stratum 10 ##不去同步任何人的時間,時間同步服務器級別
system 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@foundation50 ~]# chronyc sources -v
210 Number of sources = 1
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| / xxxx = adjusted offset,
|| Log2(Polling interval) -. | yyyy = measured offset,
|| \ | zzzz = estimated error.
|| | |
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^? bogon 0 10 0 10y +0ns[ +0ns] +/- 0ns
###5.timedatectl命令###
timedatectl status ##顯示當前時間信息
set-time HH:mm:ss ##設定當前時間
set-timezone ##設定當前時區
set-local-rtc 0|1 ##設定是否使用utc時間
1.服務端
yum install chrony -y ##安裝服務
vim /etc/chrony.conf ##主配置文件
22 # Allow NTP client access from local network.
23 allow 192.168/16 ##允許誰去同步我的時間
29 # Serve time even if not synchronized to any NTP server.
30 local stratum 10 ##不去同步任何人的時間,時間同步服務器級別
system 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@foundation50 ~]# chronyc sources -v
210 Number of sources = 1
.-- Source mode '^' = server, '=' = peer, '#' = local clock.
/ .- Source state '*' = current synced, '+' = combined , '-' = not combined,
| / '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
|| .- xxxx [ yyyy ] +/- zzzz
|| / xxxx = adjusted offset,
|| Log2(Polling interval) -. | yyyy = measured offset,
|| \ | zzzz = estimated error.
|| | |
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^? bogon 0 10 0 10y +0ns[ +0ns] +/- 0ns
###5.timedatectl命令###
timedatectl status ##顯示當前時間信息
set-time HH:mm:ss ##設定當前時間
set-timezone ##設定當前時區
set-local-rtc 0|1 ##設定是否使用utc時間
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.