ntp时钟同步(离线)

1、操作系统:redhat6.7

2、环境:公司内网,禁止上外网,选择一个服务器为主时钟服务器,其他6个与其同步;

a、主服务器添加的内容:

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1 
restrict -6 ::1
# 允许内网其他机器同步时间 改为自己的网段
 restrict 10.2.XX.XX(自己的主机的IP) mask 255.255.255.0 nomodify notrap

#代码注释

#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst
# 因为是内网,以本地时间作为时间服务
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10
 

b、其他6个从服务器的配置相同,如下:

server 10.2.xx.xx(主服务器IP)

restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery

restrict 127.0.0.1 
restrict -6 ::1

#代码注释

#server 0.rhel.pool.ntp.org iburst
#server 1.rhel.pool.ntp.org iburst
#server 2.rhel.pool.ntp.org iburst
#server 3.rhel.pool.ntp.org iburst

restrict 10.2.xx.xx(主服务器IP)  nomodify notrap noquery
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10

到此为止,配置完成。

主服务器执行:

           ntpdate 10.2.xx.xxx

          service ntpd restart

          chkconfig --level 2345 ntpd on

其他6台服务器,同时或者依次执行:

         service ntpd restart

          chkconfig --level 2345 ntpd on

        ntpdate -u  10.2.xx.xx(主服务器IP)

      等待5分钟左右,查看是否同步(ntpq -p )。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值