龙空技术网

Centos搭建NTP服务器

强爱专研 226

前言:

当前同学们对“centos注销快捷键”可能比较关心,看官们都想要分析一些“centos注销快捷键”的相关内容。那么小编在网上网罗了一些对于“centos注销快捷键””的相关资讯,希望小伙伴们能喜欢,朋友们一起来学习一下吧!

网络时间协议NTP(Network Time Protocol)是用于互联网中时间同步的标准互联网协议。NTP的用途是把计算机的时间同步到某些时间标准。目前采用的时间标准是世界协调时UTC(Universal Time Coordinated)。

就是当你的计算机时间不准确时,将机器接入到互联网,同步一下网上的准确时间,多方便。但是NTP对于我们个人来说并没有什么用,我们自己一台或几台机器,时间准不准有啥关系,最多双11抢购差点时间。

对于企业来说,成百上千的计算机都不能直接访问互联网,时间不统一会严重影响业务,如果一台一台滴去修改,那不得要人命啊。这时搭建一个自己的NTP服务器就很有必要了。

NTP服务器的安装与配置

1.安装

yum install ntp -y

2.修改配置文件

vim /etc/ntp.conf注销这几行 # 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# 时间差异文件driftfile /var/lib/ntp/ntp.drift# 分析统计信息#statsdir /var/log/ntpstats/statistics loopstats peerstats clockstatsfilegen loopstats file loopstats type day enablefilegen peerstats file peerstats type day enablefilegen clockstats file clockstats type day enable# 不允许来自公网上ipv4和ipv6客户端的访问restrict -4 default kod notrap nomodify nopeer noquery limitedrestrict -6 default kod notrap nomodify nopeer noquery limited# 让NTP Server和其自身保持同步,如果在/etc/ntp.conf中定义的server都不可用时,将使用local时间作为ntp服务提供给ntp客户端.restrict 127.0.0.1restrict ::1# 允许这个网段的对时请求.restrict 192.168.123.0 mask 255.255.255.0 nomodify # 配置上游的ntp服务器,并对其放行restrict 10.8.201.9server 10.8.201.9 prefer

3.开机自启动

systemctl enable ntpdsystemctl enable ntpdate

4.防火墙配置

如果开启了防火墙需要放通防火墙端口

firewall-cmd --permanent --add-service=ntp firewall-cmd --reload

5.查看ntp连接状态,将时间写入硬件

ss -tlunp | grep ntpntpq -phwclock -w

6.互联网的NTP地址

下面为阿里云的ntp服务器,可作为上级ntp服务器

ntp1.aliyun.com ntp2.aliyun.com ntp3.aliyun.com ntp4.aliyun.com ntp5.aliyun.com ntp6.aliyun.com ntp7.aliyun.com

标签: #centos注销快捷键