Linux – NTP網路伺服器
Linux 可以透過網路校時,最常見的網路校時為使用 NTP 伺服器,這個服務啟動在 udp port 123。
在叢集的環境下時間校正是非常重要的,如果時間不一致可能導致服務無法正常使用唷~~
-
安裝方式:
- yum install -y ntp (Centos or RedHat 系列)
- apt install -y ntp (Ubuntu 系列)
-
指定NTP伺服器:
- server [IP or hostname] [prefer]
:information_source: server 後端可以接 IP 或主機名稱,至於那個 perfer 表示優先使用的伺服器
:::info
台灣常見的 Time Server :
tick.stdtime.gov.tw
tock.stdtime.gov.tw
time.stdtime.gov.tw
clock.stdtime.gov.tw
watch.stdtime.gov.tw
::: - 範例使用Google NTP伺服器
- server [IP or hostname] [prefer]
-
啟動方式:
- systemctl start ntpd
-
檢測方式:
#觀察啟動的123埠號 netstat -tlunp | grep ntp #檢查連線狀態 ntpstat ntpq -p