Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux綜合 >> 學習 Linux

NTP 時間同步伺服器架設:從外網對時到內網發布

一、在可連外網的伺服器 A 上設定 NTP

編輯 /etc/ntp.conf:

server 202.120.2.101 # 該機器同步的上游 NTP 伺服器
restrict 192.168.1.0 mask 255.255.255.0 nomodify # 允許該網段內網機器同步

啟動並查看狀態:

/etc/init.d/ntp start
/etc/init.d/ntp status

可 ping 上游(如 dns.sjtu.edu.cn)確認能正常對時。

二、在伺服器 A 上開啟 37 埠

讓內網其他機器能與 A 對時,執行:

rpm -qilf /etc/xinetd.conf
/etc/init.d/xinetd restart
chkconfig time on

之後可看到 37 埠處於監聽狀態。

三、內網機器安裝 rdate 對時

可使用 zypper install rdate 安裝,再以 rdate -s A 對時。若要每天凌晨一點自動同步,可在 crontab 加入:

00 01 * * * rdate -s 192.168.1.11
Copyright © Linux教程網 All Rights Reserved