当前位置:网站首页>Debian 10 NTP 服务配置
Debian 10 NTP 服务配置
2022-08-02 03:20:00 【活加梦】
目录
一、题目要求
NTP
安装 ntp(使用其他 ntp 软件,以下功能均不得分);
在 AppSrv 和 StorageSrv 上创建 CRON 计划任务;
使用 ntpdate 指令,每隔五分钟进行一次时间同步;
二、配置过程
IspSrv
1.下载ntp服务
[email protected]:~# apt -y install ntp
2.进入ntp配置文件
[email protected]:~# vim /etc/ntp.conf
3.修改ntp配置文件
23 #pool 0.debian.pool.ntp.org iburst #注释,关闭从网络上同步
24 #pool 1.debian.pool.ntp.org iburst
25 #pool 2.debian.pool.ntp.org iburst
26 #pool 3.debian.pool.ntp.org iburst
27 server 127.127.1.0 #server指定ntp服务器的地址 将当前主机作为时间服务器
28 fudge 127.127.1.0 stratum 5 #fudge设置时间服务器的层级 stratum 0~15 ,0:表示顶级 , 10:通常用于给局域网主机提供时间服务
#注意:fudge必须和server一块用, 而且是在server的下一行
41 #restrict -4 default kod notrap nomodify nopeer no query limited #注释
42 #restrict -6 default kod notrap nomodify nopeer no query limited
46 restrict 81.6.63.0 mask 255.255.255.0 #允许哪些网段来我这里同步时间
4.重启ntp服务
[email protected]:~# systemctl restart ntp.service
5.放开防火墙端口
[email protected]:~# iptables -A INPUT -p udp --dport 123 -j ACCEPT
[email protected]:~# iptables -A OUTPUT -p udp --sport 123 -j ACCEPT
6.保存规则
[email protected]:~# netfilter-persistent save
RouterSrv
1.放开iptables上对应端口
[email protected]:~# iptables -A FORWARD -p udp --dport 123 -j ACCEPT
2.保存规则
[email protected]:~# netfilter-persistent save
AppSrv
1.安装ntpdate指令
[email protected]:~# apt -y install ntpdate
2.进入CRON服务配置文件
[email protected]:~# vim /etc/crontab
3.创建 CRON 计划任务,每5分钟自动同步4.
*/5 * * * * root /usr/sbin/ntpdate 81.6.63.100 #每5分钟到81.6.63.100自动同步时间
4.重新启动下CRON计划任务
[email protected]:~# systemctl restart cron.service
5.打开防火墙对应的端口
[email protected]:~# iptables -A INPUT -p udp --sport 123 -j ACCEPT
[email protected]:~# netfilter-persistent save
StorageSrv
1.安装ntpdate指令
[email protected]:~# apt -y install ntpdate
2.进入CRON服务配置文件
[email protected]:~# vim /etc/crontab
3.创建 CRON 计划任务,每5分钟自动同步4.
*/5 * * * * root /usr/sbin/ntpdate 81.6.63.100 #每5分钟到81.6.63.100自动同步时间
4.重新启动下CRON计划任务
[email protected]:~# systemctl restart cron.service
5.打开防火墙对应的端口
[email protected]:~# iptables -A INPUT -p udp --sport 123 -j ACCEPT
[email protected]:~# netfilter-persistent save
三、测试截图与评分要求
测试:IspSrv
评分细则:
测试:AppSrv与StorageSrv
评分细则:
边栏推荐
猜你喜欢
随机推荐
@ApiModel 和 @ApiModelProperty
MySQL分区表详解
@Accessors 注解详解
MySQL常见的索引
【深度学习】从LeNet-5识别手写数字入门深度学习
Week 7 Review
PCL—点云数据分割
R16 Type II量化反馈码本的产生
AntV X6制作画板工具(图形,线段,图片上传)
STL entry basics map and set containers
CV-Model [4]: MobileNet v3
小程序组件总结
mysql卸载详细教程
赶紧进来!!!教你用C语言写三子棋小游戏
(转帖)HashCode总结(1)
mysql中如何查看表是否被锁
day11--shell脚本
小程序(开发必备常识)1
Keil开发环境安装教程
RHCSA第二天