配置情景:
兩台Sun_Microsystems機器,保持兩台主機的時間同步。
配置準備:
了解SUN-OS的版本,系統環境。
#showrev
Hostname: sunapp1
Hostid: 844ad444
Release: 5.10
Kernel architecture: sun4u
Application architecture: sparc
Hardware provider: Sun_Microsystems
Domain:
Kernel version: SunOS 5.10 Generic_127127-11
#more /etc/release
Solaris 10 11/06 s10s_u3wos_10 SPARC
配置服務端:
1.建立/etc/inet/ntp.conf
2.修改/etc/inet/ntp.conf檔案如下格式:
server 127.127.1.0 prefer
fudge 127.127.1.0 stratum 0
driftfile /var/ntp/ntp.drift
statsdir /var/ntp/ntpstats/
filegen peerstats file peerstats type day enable
filegen loopstats file loopstats type day enable
filegen clockstats file clockstats type day enable
3.啟動ntp服務
#cd /usr/lib/inet
#./xntpd -c /etc/inet/ntp.conf -l /var/ntp/ntp.log
4.服務端驗證
5分鐘後檢測服務,運作ntpq –p,顯示類似如下:
#ntpq -p
remote refid st t when poll reach delay offset disp
=====================================================
*LOCAL(0) .LCL. 0 l 51 64 377 0.00 .000 10.03
在LOCAL前看到*号即成功。
配置用戶端:
1.建立/etc/inet/ntp.conf
2. 修改/etc/inet/ntp.conf為如下格式:
請将SERVER-IP替換成真正的ntp的Server IP
peer SERVER-IP
server SERVER-IP
fudge SERVER-IP stratum 0
driftfile /var/ntp/ntp.drift
statsdir /var/ntp/ntpstats/
filegen peerstats file peerstats type day enable
filegen loopstats file loopstats type day enable
filegen clockstats file clockstats type day enable
3.啟動ntp程序
#cd /usr/lib/inet
#./xntpd -c /etc/inet/ntp.conf -l /var/ntp/ntp.log
4.驗證用戶端
Ntp程序重起以後等待5分鐘,運作ntpa –p,顯示類似如下:
#ntpq -p
remote refid st t when poll reach delay offset disp
====================================================
*SERVER-IP .LCL. 1 u 591 1024 377 0.66 0.086 0.14
在SERVER-IP前面顯示*為用戶端同步正常
備注:
1.無論伺服器端還是用戶端的ntp -q顯示結果,reach值代表是否與伺服器端有連接配接,這個數值一直增大,則基本可以判定連接配接正常,同時,disp值也會逐漸變小。
先起伺服器端服務,待伺服器端确認正常後,再起用戶端服務。伺服器啟動和時間同步都需要比較長的一段時間,請耐心等待。
2.修改系統時間的指令
#date mmddHHMM
如date 03311651表示修改事件到3月31号16點51分