Ntp服务

配置一个ntp客户端一个ntp服务器

安装ntp:yum –y install ntp

配置ntp配置文件

vim /etc/ntp.conf

在# the administrative functions.这句话下添加

restrict 192.168.10.134 nomodify notrap nopeer noquery

在#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap下面

restrict 192.168.10.2 mask 255.255.255.0 nomodify notrap

将0-3注释掉并添加

#server 0.centos.pool.ntp.org iburst

#server 1.centos.pool.ntp.org iburst

#server 2.centos.pool.ntp.org iburst

#server 3.centos.pool.ntp.org iburst

server 127.127.1.0

Fudge 127.127.1.0 stratum 10

这是配置的主节点

子节点:vim /etc/ntp.conf

restrict 192.168.10.133 nomodify notrap nopeer noquery:ip是子节点的ip

restrict 192.168.10.2 mask 255.255.255.0 nomodify notrap:ip是网关

restrict 192.168.10.134 nomodify notrap noquery        :ip是主节点ip

server 192.168.10.134

Fudge 192.168.10.134 stratum 10                     :ip是主节点的ip

配置完成之后

使用/bin/systemctl start ntpd.service启动服务

使用ntpstat查看ntp服务器有无和上层ntp连通

若出现unsynchronised time server re-starting polling server every 8 s

需要等待5-10分钟即可

出现synchronised to local net at stratum 6

   time correct to within 199 ms

   polling server every 64 s

说明主节点正常运行

出现synchronised to NTP server (192.168.10.134) at stratum 7

   time correct to within 888 ms

   polling server every 64 s

说明子节点正常运行

设置开机自启

chkconfig ntpd on

注意:ntp服务默认端口是123,防火墙需要开放123端口

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值