打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
配置centos 7 ntp server

配置centos 7ntp server


1.关闭防火墙

值得注意的是centos7防火墙在iptables的基础上增加了firewalld,两个都需要关闭或者放行。

2.安装ntp server


使用 rpm -qantp可以查看是否已安装ntp服务,如果已安装则直接跳到步骤3,如果没有参考如下:

1yum安装

#yum -y install ntp

#

此种安装方式需要连接到互联网。

2rpm安装

#rpm -ivhntp-4.2.2p1-9.el5_4.1.rpm

3)源码安装

#tar -xzvfntp-4.2.4p6.tar.gz

#./configure --prefix=/usr/local/ntp &&make && make install

 

本次我使用的是第一种安装方式。

3.配置ntp


1#vi /etc/ntp.conf

2##########################################

####restrict参数####

kod 使用kod技术防范“kiss of death”攻击

ignore 拒绝任何NTP连接

nomodify 用户端不能使用ntpc,ntpq修改时间服务器参数,但是可以进行网络校时

noquery 用户端不能使用ntpc,ntpq查询时间服务器参数,不可以进行网络校时

notrap 不提供远程日志功能

notrust 拒绝没有认证的客户端

restrict ip 或者 restrict IP地址 + mask + 子网掩码 + 参数 例如:

restrict default nomodify notrap nopeer noquery#默认拒绝所有访问

restrict 211.71.14.254 mask 255.255.255.0#添加允许211.71.14.254/24网段访问

restrict 10.111.1.1 mask 255.0.0.0 nomodify#添加10.0.0.0/8网段访问,不可以修改服务器时间参数


####server 参数####

server + ip 或者 server + hostname

使用prefer参数可以设置优先上级服务器 例如:

server 202.112.128.33 prefer#默认上级时间服务器为202.112.128.33

server 202.112.10.60#备用上级时间服务器为202.112.10.60

fudge 127.127.1.0 stratum 3#设置本地时间级别是3,如果上级时间服务器均失效,对外发布本地时间,时间层级是4

driftfile /var/lib/ntp/drift#本地与上层服务器BIOS晶片振荡频率差值保存目录,不需要修改!

keys /etc/ntp/keys#可以借此来给客户端设置认证信息,不需要修改!

以上ntp配置完成!

4.启动ntp server 服务并在client端测试

 

1)启动前的准备

#ntpdate 202.112.128.33#更新系统时间

#hwclock sysctohc#设置硬件时钟与系统时钟同步

2)启动ntpd

[root@localhost log]# service ntpd start#启动ntp服务

Redirecting to /bin/systemctl startntpd.service

[root@localhost log]# cat /var/log/messages#查看日志信息

......

Nov 23 21:37:06 localhost systemd: Started NetworkTime Service.

3)测试

 

 

#ntpdate 211.71.14.159#centos测试

除了在linux测试还可以选择在windows测试,本次测试选择的是在windows server 2008 R2和一台windows7测试,其中2008IP 地址是10.x.x.xwindows7是另外一个网段的公网地址,均可以正常使用时间服务.


至于windows7为什么可以我还在找原因,然后来完善!

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
【源】从零自学Hadoop(04):Linux准备下
NTP服务及时间同步(CentOS6.x)
linux下ntp时间服务器的搭建与配置
大数据技术学习分享:Hadoop集群同步
Linux 时间同步
设置局域网时间同步
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服