当前位置: > CentOS > CentOS服务器 > 环境配置 >

CentOS 6.7局域网内搭建NTP服务器

时间:2015-11-30 15:54来源:IT 作者:IT
1、安装ntp-4.2.8p4版本
cd /home/yongzhen/tools/
wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p4.tar.gz
ll
tar xf ntp-4.2.8p4.tar.gz 
cd ntp-4.2.8p4
./configure --prefix=/usr/local/ntp --enable-all-clocks --enable-parse-clocks
echo $?
make&&make install
echo $?
vi /etc/ntp.conf
在restrict default nomodify notrap noquery(表示默认拒绝所有IP的时间同步)之后增加一行:
restrict 172.16.1.0 mask 255.255.255.0 nomodify
/usr/local/ntp/bin/ntpd -c /etc/ntp.conf -p /tmp/ntpd.pid
ps -ef |grep ntp

2、在客户端测试

[root@m01 ~]# ntpdate 172.16.1.3  
28 Nov 07:50:35 ntpdate[5316]: adjust time server  172.16.1.3 offset -0.001200 sec

以上提示结果说明已经成功配置好ntp服务器

(责任编辑:IT)
------分隔线----------------------------