1、安装NTP

# yum -y install ntp


2、修改主配置文件

# vim /etc/ntp.conf

...

10 restrict 192.168.10.0 mask 255.255.255.0 nomodify

...


3、启动服务

# service ntpd start

# chkconfig ntpd on


4、验证

# netstat -tulnp | grep ntp

udp        0      0 192.168.100.2:123           0.0.0.0:*            3338/ntpd          

udp        0      0 127.0.0.1:123               0.0.0.0:*            3338/ntpd          

udp        0      0 0.0.0.0:123                 0.0.0.0:*            3338/ntpd          

udp        0      0 fe80::20c:29ff:fed5:496:123 :::*                 3338/ntpd          

udp        0      0 ::1:123                     :::*                 3338/ntpd          

udp        0      0 :::123                      :::*                3338/ntpd          

     


客户端验证

1、首先调整时间,使之与服务器时间不一致

# date

Tue Apr 29 21:59:35 CST 2014

# date 043019302014


2、与服务器同步

# ntpdate 192.168.10.1


3、与crond配合使用

# crontab -e

0 10 * * * /sbin/ntpdate 192.168.10.1


# service crond restart

# chkconfig crond on