银河麒麟V10 SP2 server 搭建 ntp服务端


目录

前言

一、Ntp

二、使用步骤

1.矫正本机时区/时间

2.配置主配置文件

 3.重启ntp服务

三.客户端配置



前言

ntp服务作为内网常用的时钟同步服务,在集群的搭建中有比较常见的使用

一、Ntp

Ntp 作为内网常用的时钟同步服务,在银河麒麟V10 SP1 到 SP2 服务器操作系统当中默认继承了相关软件包。

二、使用步骤

1.矫正本机时区/时间

1.# cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

2.# date -s "12/10/16 09:44"

3.# hwclock -w   把系统时间同步到硬件时间

2.配置主配置文件

driftfile /var/lib/ntp/drift  记录上次的ntp服务与上层ntp服务连接所花费的时间

restrict default kod nomodify notrap nopeer noquery   //对默认的客户端拒绝所有操作
restrict -6 default kod nomodify notrap nopeer noquery  //针对ipv6的设置

restrict 127.0.0.1       //允许本地地址一切的操作              127.0.0.1本地回环地址
restrict -6 ::1


server 0.rhel.pool.ntp.org iburst           //设置上层服务器做同步ip地址(内网ntp服务器的上一级ntp服务器)
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地址,根据实际网络来指定
fudge 127.127.1.0 stratum 10 //这行是服务器的层次。设置为0则为顶级 0—16

server 192.168.1.5
fudge 192.168.1.5 stratum 10


server 201.72.145.44   //中国国家时间授权中心  设定服务器

 3.重启ntp服务

5./etc/init.d/ntpd restart
6.netstat -tulnp | grep ntp 
7.ntpstat 检测服务器自身是否同步  
8.ntpstat 查看服务器状态(重启ntp需要5分钟)
ntpstat 
synchronised to local net at stratum 11   //进行时间校对的ntp服务器
time correct to within 12 ms  //本地主机与上层ntp服务器的时间差
polling server every 64 s  //下次同步时间(更新频率)

三.客户端配置

客户端:
同步:
ntpdate ip
手动设置
ntpdate 192.168.1.5 

ntp一般只能同步系统时钟
vim /etc/sysconfig/ntpd  
SYNC_HWCLOCK=yes

hwclock -w

计划任务 每分钟去同步
crontab -e 
* * * * * /usr/sbin/ntpdate 192.168.1.5
* * * * * /usr/sbin/hwclock -w

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值