NTP
Network Time Protocol(NTP)是用來使計算機時間同步化的一種協議,它可以使計算機對其服務器或時鐘源(如石英鐘,GPS等等)做同步化,它可以提供高精準度的時間校正(LAN上與標準間差小於1毫秒,WAN上幾十毫秒),且可介由加密確認的方式來防止惡毒的協議***。
實驗拓撲:
RHEL5.9_A NTP Client
-------Server1(VM1)---------(VM1) 110
192.168.150.100
實驗步驟:
1.環境
[root@dns1 ~]# service ntpd restart
關閉 ntpd: [失敗]
啓動 ntpd: [確定]
[root@dns1 ~]# service ntpd restart
關閉 ntpd: [確定]
啓動 ntpd: [確定]
[root@dns1 ~]# chkconfig ntpd on
[root@dns1 ~]# netstat -anltup | grep ntpd
udp 0 0 192.168.150.100:123 0.0.0.0:* 3772/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 3772/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 3772/ntpd
udp 0 0 ::1:123 :::* 3772/ntpd
udp 0 0 fe80::20c:29ff:fe16:a393:123 :::* 3772/ntpd
udp 0 0 :::123 :::* 3772/ntpd
客戶端驗證
1、首先調整時間,使之與服務器時間不一致
[root@dns1 ~]# date
2013年 11月 20日 星期三 10:25:28 CST
[root@dns1 ~]# date 111819302013
2、與服務器同步
[root@dns1 ~]# ntpdate 192.168.150.100
20 Nov 11:09:29 ntpdate[5798]: adjust time server 192.168.10.254 offset -0.000004 sec
[root@dns1 ~]# hwclock --systohc 寫入硬件
3、與crond配合使用
[root@dns1 ~]# crontab -e
0 10 * * * /sbin/ntpdate 192.168.150.100
[root@dns1 ~]# service crond restart
[root@dns1 ~]# chkconfig crond on