centos6安装部署ntp

2021/12/10 7:22:38

本文主要是介绍centos6安装部署ntp,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

环境:

OS:Centos 6

1.检查ntp是否安装
[root@localhost /]# rpm -qa|grep ntp
ntp-4.2.6p5-1.el6.centos.x86_64
ntpdate-4.2.6p5-1.el6.centos.x86_64
fontpackages-filesystem-1.41-1.1.el6.noarch

2.修改配置
vi /etc/ntp.conf

//添加如下配置内容

//默认允许任何主机进行时间同步

restrict default ignore

server cn.pool.ntp.org perfer
server 0.cn.pool.ntp.org
server 1.cn.pool.ntp.org
server asia.pool.ntp.org
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org


restrict cn.pool.ntp.org nomodify notrap noquery
restrict 0.cn.pool.ntp.org nomodify notrap noquery
restrict 1.cn.pool.ntp.org nomodify notrap noquery
restrict asia.pool.ntp.org nomodify notrap noquery
restrict 0.asia.pool.ntp.org nomodify notrap noquery
restrict 1.asia.pool.ntp.org nomodify notrap noquery


server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10

3.设置开机自启动
[root@localhost /]# chkconfig ntpd on

4.启动NTP服务
[root@localhost /]#service ntpd start
[root@localhost /]# service ntpd status

5.查看
ntpstat
ntpq -p



这篇关于centos6安装部署ntp的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程