SUSE 11 SP4 Install NTP

安装NTP服务
zypper -n install ntp

配置NTP
vim /etc/ntp.conf
外部时间服务器不可用时,以本地时间作为时间服务
server 127.127.1.0
# local clock (LCL)

fudge 127.127.1.0  stratum 10

中国这边最活跃的时间服务器
server 210.72.145.44 perfer      


server 202.112.10.36


server 59.124.196.83  



客户端需要同步的ip,有多少个客户端,添加多个

restrict 192.168.31.67   
        

添加允许接收请求的网络范围
restrict 192.168.31.0 mask 255.255.255.0 notrust


关闭防火墙
service SuSEfirewall2_init stop

service SuSEfirewall2_setup stop

chkconfig SuSEfirewall2_init off

chkconfig SuSEfirewall2_setup off

防火墙设置
iptables -I INPUT -p udp -m udp --sport 123 -j ACCEPT


启动ntp
service ntp start

配置开机启动 ntp
chkconfig ntp on

======================================================================================================================================================================

客户端连接
ntpdate  192.168.31.183
ntpdate -d 192.168.31.183

客户端设置定时同步时间

[root@dlp ~]# vi /root/ntpupdate.sh    编辑定时脚本

/usr/sbin/ntpdate 192.168.31.183

[root@dlp ~]# cat /root/ntpupdate.sh   编辑完之后查看

/usr/sbin/ntpdate 192.168.31.183

[root@dlp ~]# crontab -e               编辑定时任务,每五分钟执行一次

*/5 * * * * /root/ntpupdate.sh

[root@dlp ~]# crontab -l

*/5 * * * * /root/ntpupdate.sh            编辑后查看

你可能感兴趣的:(Suse)