Linux配置自動時間同步

2021-06-29 09:42:50 字數 923 閱讀 3119

時間同步命令:

ntpdata time.windows.com

自動時間同步:

需要配置/etc/crontab檔案,實現自動執行任務

讓linux從time.windows.com自動同步時間

vi /etc/crontab

加上一句:

00 0 1 * * root ntpdate -s time.windows.com

time.nist.gov 是乙個時間伺服器.

linux時間伺服器配置(192.168.10.1)

1). # rpm -ivh ntp-4.1.2-4.el3.1.i386.rpm

2). # vi /etc/ntp.conf

注釋一行

restrict default ignore

加入一行

restrict 192.168.10.0 mask 255.255.255.0 notrust nomodify notrap

3). # vi /etc/ntp/step-tickers

加入一行

pool.ntp.org

這樣每次ntpd啟動時,會自動連線該國際標準時間伺服器;

4). # service ntpd start

5). # netstat -an |grep 123

確保該埠以udp方式開放

時間客戶端配置(192.168.10.2)

1). # ntpdate 192.168.10.2

應該顯示同步成功

2). # crond -e

加入0-59/10 * * * * /usr/sbin/ntpdate 192.168.10.1

表示每隔10分鐘同步一次時間

Linux 自動同步時間

一,用ntpdate從時間伺服器更新時間 如果你的linux系統根本沒有ntpdate這個命令 yum install ntp 安裝完了之後,你不要做什麼配置,也不需要,直接測試一下 root localhost ntpdate s1a.time.edu.cn 12 jun 14 48 04 ntp...

linux自動同步時間

讓linux自動同步時間 shunz vi etc crontab 加上一句 00 0 1 root rdate s time.nist.gov time.nist.gov 是乙個時間伺服器.date 檢視系統時間 hwclock 檢視bios時間 加入計畫任務,每天和ntp時間伺服器同步 可用的n...

linux時間同步配置

假設有三颱伺服器 yitian1 yitian2 yitian3 要使這三颱伺服器時間同步有兩種方式,一種是每個伺服器都和公網上的時間伺服器同步,另外一種是其中一台伺服器 yitian1 和公網上的時間伺服器同步,然後其他伺服器 yitian2和yitian3 和yitian1時間同步 一般在比較大...