NTP同步服务使用

NTP简介

网络时间协议(英语:Network Time Protocol,缩写:NTP)是在数据网络潜伏时间可变的计算机系统之间通过分组交换进行时钟同步的一个网络协议,位于OSI模型的应用层。

NTP的作用

NTP的作用是为了所有参与计算机的协调世界时(UTC)时间同步到几毫秒的误差内。

CentOS基于NTP的时间同步

  • 安装ntp:
sudo yum -y install ntp
  • 修改/etc/ntp.conf
Use public servers from the pool.ntp.org project. 
Please consider joining the pool (http://www.pool.ntp.org/join.html)
# new(新增) 
server ntp1.aliyun.com prefer 
server ntp2.aliyun.com
# old(原有) server 0.centos.pool.ntp.org iburst server 
# centos.pool.ntp.org iburst server 
# centos.pool.ntp.org iburst server 
# centos.pool.ntp.org iburst
  • 设置时区
    sudo timedatectl set-timezone Asia/Shanghai
    # 或者 sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
  • 时间同步 手工发起同步:
    sudo ntpdate ntp1.aliyun.com

查看时间是否有变更

  • 启动NTP服务:
    sudo systemctl enable ntpd.service sudo systemctl start ntpd.service
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值