NTP

Network Time Protocol(NTP)是用来使计算机时间同步化的一种协议,它可以使计算机对其服务器时钟源(如石英钟,GPS等等)做同步化,它可以提供高精准度的时间校正(LAN上与标准间差小于1毫秒,WAN上几十毫秒),且可介由加密确认的方式来防止恶毒的协议攻击。

实验拓扑:

           RHEL5.9_A NTP Client

-------Server1(VM1)---------(VM1) 110

       192.168.150.100          

实验步骤:

1.环境

有关NTP的配置_服务器

[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