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

原文地址:https://www.cnblogs.com/hxlasky/p/15667998.html