linux时间服务器的搭建
我在学习过程中经常遇到服务器时间不一致导致很多故障,经过了很多次麻烦的经历之后决定写出来,以便于自己以后需要再来拿出来用,也希望可以帮到需要的人
搭建过程
yum install -y ntp ntpdate
备份配置文件
cp /etc/ntp.conf /etc/ntp.conf.bak
将注释掉的去掉,新建配置文章
egrep -v "^$|#" /etc/ntp.conf.bak >/etc/ntp.conf
编辑配置文件
ftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
#允许内网其他机器同步时间
restrict 172.16.1.0 mask 255.255.255.0 nomodify notr