Linux网络时间协议:ntp

1.协议和端口

         udp:123

2.工作原理

        客户端(C)开启一个随机端口与服务端(S)的udp123端口建立连接,同时发送时间同步请求,当S收到C的请求后,会给C发送一个校对时间,C根据收到S发来的时间进行调整,进而与S时间同步.。

3.安装与配置

3.1下载程序包并安装

     ntp 

    ##官方下载地址:http://support.ntp.org/bin/view/Main/SoftwareDownloads

    >>yum install ntp -y

3.2确定时区

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

3.3修改配置文件

 >>vim /etc/ntp.conf
 #权限方面
    restrict default kod nomodify notrap nopeer noquery
    restrict -6 default kod nomodify notrap nopeer noquery
    restrict 172.25.10.0 mask 255.255.255.0 nomodify notrap
   #服务设定
     server 127.127.1.0 

3.4启动服务

 >>systemctl restart ntpd
#查看服务状态
  >>netstat -lanu | grep 123

3.5客户端时间同步
3.5.1手动同步

   >>ntpdate 172.25.10.2

3.5.2配置文件同步

   ##安装ntp

   >>yum install ntp -y
   >>vim /etc/ntp.conf
  ##增加服务

  server 172.25.10.2
   >> systemctl restart ntpd

 ###欢迎关注交流:

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

runqu

你的鼓励是我创作的最大动力~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值