多语言展示
当前在线:1601今日阅读:61今日分享:18

ntp服务器安装方法

ntp服务器提供时间校验服务,本实验中的ntp服务器ip 192.168.150.33,ntp服务器需要能通公网自己首先校准时间才好提供服务给内部的客户机
工具/原料
1

ntp-4.2.8p8.tar.gz

2

centos6.5_x64

方法/步骤
1

在ntp的官网上下载源码包wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-4.2/ntp-4.2.8p8.tar.gz

2

解压源码包编译安装tar zxvf ntp-4.2.8p8.tar.gzcd ntp-4.2.8p8./configure --prefix=/usr/local/ntp --enable-all-clocks --enable-parse-clocksmake && make install

4

第二种配置:只允许192.168.150.***网段的客户机进行时间同步在restrict default nomodify notrap noquery(表示默认拒绝所有IP的时间同步)之后增加一行:restrict 192.168.150.0 mask 255.255.255.0 nomodify

5

启动ntpd/usr/local/ntp/bin/ntpd -c /etc/ntp.conf -p /tmp/ntpd.pid

6

在客户机上使用ntpdate 192.168.150.39同步时间,192.168.150.39就是刚才搭建的ntp服务器的IP地址。如果出现“no server suitable for synchronization found”,将ntp服务器上的服务重启下

注意事项
1

客户机可以将同步时间的命令添加到crontab中

2

ntp服务器需要能上公网自己先同步校正时间

推荐信息