Ntp时间服务器搭建

 

环境介绍

两台centos7

192.168.5.129

192.168.5.133

 

首先server端安装ntp

Yum -y install ntp

修改配置文件

Vi /etc/ntp.conf

 

# For more information about this file, see the man pages
# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

driftfile /var/lib/ntp/drift

# Permit time synchronization with our time source, but do not
# permit the source to query or modify the service on this system.
restrict default nomodify notrap nopeer noquery

# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict 127.0.0.1
restrict ::1

# Hosts on local network are less restricted.
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst  
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 127.127.1.0 iburst
server 127.127.1.0 fudge
127.127.1.0 stratum 8

 

 

server ntp.ntsc.ac.cn
server cn.ntp.org.cn

重启ntp服务

Systemctl restart ntpd

客户机安装ntpdate

Yum -y install ntpdate

Ntpdate -u 192.168.5.129

Server端同步系统时间

Date -s ‘13:58:00 2021-6-17’

 

[root@localhost ~]# date -s '2021-6-17 14:48:00'
2021年 06月 17日 星期四 14:48:00 CST
[root@localhost ~]# ntpdate -u 192.168.5.133
17 Jun 14:48:24 ntpdate[21808]: no server suitable for synchronization found
[root@localhost ~]# date
2021年 06月 17日 星期四 14:48:26 CST

s

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值