ntp时间同步服务部署

+------------------+
|    Author:啊国   | 
+------------------+

时间同步服务器
1、服务端及客户端安装ntp软件

yum -y install ntp

2、配置服务端软件(将主配置文件中原来的主配置文件进行注释)

sed -i 's/server 0.centos.pool.ntp.org iburst/#server 0.centos.pool.ntp.org iburst/g' /etc/ntp.conf
sed -i 's/server 1.centos.pool.ntp.org iburst/#server 0.centos.pool.ntp.org iburst/g' /etc/ntp.conf
sed -i 's/server 2.centos.pool.ntp.org iburst/#server 0.centos.pool.ntp.org iburst/g' /etc/ntp.conf
sed -i 's/server 3.centos.pool.ntp.org iburst/#server 0.centos.pool.ntp.org iburst/g' /etc/ntp.conf

然后自己追加的一条网络时间同步服务

echo "server 127.127.1.0 iburst" >>/etc/ntp.conf

最后进行启动

systemctl restart ntpd

3、配置客户端软件(同理,将原来的注释,自己追加)

sed -i 's/server 0.centos.pool.ntp.org iburst/#server 0.centos.pool.ntp.org iburst/g' /etc/ntp.conf
sed -i 's/server 1.centos.pool.ntp.org iburst/#server 0.centos.pool.ntp.org iburst/g' /etc/ntp.conf
sed -i 's/server 2.centos.pool.ntp.org iburst/#server 0.centos.pool.ntp.org iburst/g' /etc/ntp.conf
sed -i 's/server 3.centos.pool.ntp.org iburst/#server 0.centos.pool.ntp.org iburst/g' /etc/ntp.conf
echo "server 172.16.1.99
restrict 172.16.1.99 nomodify notrap noquery" >>/etc/ntp.conf

然后重新启动

systemctl restart ntpd

最后服务器可以使用ntpdate -u 172.16.1.99命令进行时间同步

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。