編輯 /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 對時,執行:
rpm -qilf /etc/xinetd.conf /etc/init.d/xinetd restart chkconfig time on
之後可看到 37 埠處於監聽狀態。
可使用 zypper install rdate 安裝,再以 rdate -s A 對時。若要每天凌晨一點自動同步,可在 crontab 加入:
00 01 * * * rdate -s 192.168.1.11