1,察看所需软件是否安装
[root@ser1 ~]# rpm -q ntp
ntp-4.2.2p1-15.el5_7.1……软件已经安装
2,开始配置ntp服务
# vim /etc/ntp.conf
# Permit time synchronization with our time source,but do not
# permit the source to query or modify the service onthis system.
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeernoquery
restrict 192.168.1.0 mask255.255.255.0 nomodify(客户机可以同步但不可更改时间)
# Permit all access over the loopback interface. This could
# be tightened as well, but to do so would effectsome of
# the administrative functions.
restrict 127.0.0.1
restrict -6 ::1
# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodifynotrap
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool(http://www.pool.ntp.org/join.html).
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org
#broadcast 192.168.1.255 key 42 # broadcast server
#broadcastclient # broadcast client
#broadcast 224.0.1.1 key 42 # multicast server
"/etc/ntp.conf" 50L, 1881C 5,1 顶端
3,开启服务
# service ntpd restart
关闭ntpd: [失败]
启动ntpd: [确定]
# chkconfig ntpd on
4,查看状态(设置后一般5分钟左右生效)
# ntpstat
unsynchronised
time server re-starting
pollingserver every 64 s
…………………
……….
# ntpstat
synchronised to local net at stratum 11
time correct to within74 ms
pollingserver every 64 s
5,客户端同步时间
# ntpdate 192.168.1.2
27 Feb 16:42:32 ntpdate[13387]: the NTP socket is inuse, exiting
# date
2014年02月 27日星期四16:42:45 CST
6,客户端添加cron任务
# crontab –e
30 08 * * * /sbin/ntpdate 192.168.1.2
本文出自 “沙漏” 博客,请务必保留此出处http://1570880775.blog.51cto.com/3105756/1369520
原文:http://1570880775.blog.51cto.com/3105756/1369520