ntp时钟服务器

centos7 搭建ntp时钟服务器

服务器配置

# 关闭防火墙,selinux=disabled
1.# 服务器部署
[root@localhost ~]# yum -y install ntp ntpdate
2.# 查找时间同步服务器
https://www.pool.ntp.org/zone/cn
3.# 修改配置文件
[root@localhost ~]# mv /etc/ntp.conf{,.bak}    # 操作之前先备份
[root@localhost ~]# vim /etc/ntp.conf
server 0.asia.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
server 3.asia.pool.ntp.org
server  127.127.1.0  iburst     local  clock     # 当外部时间不可用时,使用本地时间
restrict 192.168.57.2 mask 255.255.255.0 nomodify   # 允许更新的ip地址段
4.# 启动ntp服务
[root@localhost ~]# systemctl enable ntpd --now   # 设为开机启动,并立刻启动服务
5.# 本机测试
[root@localhost ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
+ntp.xtom.com.hk 223.255.185.3    3 u   22   64  377  400.607  881.589  52.922
 fayetteville.nc 132.163.96.2     2 u   94   64  102  434.297  818.850 118.333
*ntpblr.roothost 153.153.36.115   2 u   94   64  376  229.075  948.388  21.710
 ntp.nic.kz      .SHM.            1 u   22   64  237  410.958  781.042  20.402
 LOCAL(0)        .LOCL.           5 l  292   64  360    0.000    0.000   0.000

远程客户端配置

[root@localhost ~]# yum -y install ntpdate     # 远程客户端需要安装ntp客户端
[root@localhost ~]# ntpdate 192.168.57.130
30 Jun 21:48:45 ntpdate[24231]: adjust time server 192.168.57.130 offset 0.002109 sec
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值