begin 2020年7月5日10:55:03
NTP簡介(What)
網絡時間協議(英語:Network Time Protocol,縮寫:NTP)是在數據網絡潛伏時間可變的計算機系統之間通過分組交換進行時鍾同步的一個網絡協議,位於OSI模型的應用層。
明明說:時間同步協議
NTP的作用(Why)
NTP的作用是為了所有參與計算機的協調世界時(UTC)時間同步到幾毫秒的誤差內。
明明說:小時候家里會報點的老鍾,跑了一段時間后就會慢幾分鍾,然后對着電視里校准。類似地,現在所有的計算機、手機都會跟時鍾服務器同步,給我們提供更准確的時間。
CentOS基於NTP的時間同步(How)
1、安裝ntp:
yum install ntp
2、修改/etc/ntp.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# new(新增)
server ntp1.aliyun.com prefer
server ntp2.aliyun.com
# old(原有)
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
3、時間同步
手工發起同步:
ntpdate ntp1.aliyun.com
date
查看時間是否已經同步
啟動NTP服務:
service ntpd start
設置開機啟動:
chkconfig ntpd on
end 2020年7月5日11:33:50