1. NTP安装
搭建环境两台redhat6.5主机,通过网络10.83.250.0/23连接互通, server 10.83.250.5
client 10.83.250.4
查询NTP安装版本状态
[root@localhost ~]# rpm -qa | grep ntp
fontpackages-filesystem-1.41-1.1.el6.noarch
ntpdate-4.2.6p5-1.el6.x86_64
ntp-4.2.6p5-1.el6.x86_64
如果没安装信息先下载cp到本机进入安装目录安装
rpm -i ntpdate-4.2.6p5-1.el6.x86_64.rpm
rpm -i ntp-4.2.6p5-1.el6.x86_64.rpm
2. 配置文件
备份配置文件,先拷贝一份做备份
cp /etc/ntp.conf /etc/ntp.conf.bak
sever配置文件
[root@NTP-server ~]# vi /etc/ntp.conf
###server config###
server 202.108.6.95
server 202.112.29.82
server cn.ntp.org.cn
server 127.127.1.0 #同步本机clock 时钟;
driftfile /etc/ntp/drift #记录clock 与 bios 事件偏差;
broadcastdelay 0.008 #
#权限控制
restrict 0.0.0.0 nomodify notrap noquery #不允许该网络client 修改、登陆、及时间查询,但可以较时;
restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap #允许向该网络的client提供NTP服务;
#restrict default ignore#默认允许任何主机进行时间同步;
#确保localhost权限足够;
restrict 127.0.0.1
restrict -6 ::1
#level number
fudge 127.127.1.1 stratum 2 #如果远程server地址不可用,ntp客户端会同步自身clock时间;
#ntp log path
statsdir /var/log/ntp/ #状态日志路径
#ntp log file
logfile /var/log/ntp/ntp.log #日志文件
includefile /etc/ntp/crypto/pw #开机启动
keys /etc/ntp/keys #签名验证`
client配置文件
[root@NTP-client ~]# vi /etc/ntp.conf
###client config
#fast ntp server
server 10.83.250.5
server 127.127.1.0
#store last time
driftfile /etc/ntp/drift
#allow upper modify localhost
restrict 0.0.0.0 nomodify notrap noquery
#allow any host
restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap
r