用bat脚本,测试DNS信息失效时长

用bat脚本,测试DNS信息失效时长。

CentOS6.4中named.xx.zone的配置:
$TTL=7D
3D ; minimum

测试结果:停止DNS服务,未达到设定的3天的最小期限,DNS信息就失效了。
或者客户端windows2003重启后,DNS信息失效。

1.重启DNS服务
[root@dns3sv named]# service named restart
Stopping named: .[ OK ]
Starting named: [ OK ]

2.编辑bat脚本,并运行

登录DNS客户端。edit wping2h.bat

echo off
:while1
date /t & time /t & ping usdb1.te -n 1 | find "usdb1" & @ping 127.0.0.1 -n 7199 -w 1000 > nul
goto while1

参数说明:
-n 7199个单位,约2小时输出一次结果。
-w 1000毫秒

3.停止DNS服务
[root@dns3sv ~]# date ; service named stop
Thu Sep 12 12:37:17 CST 2014
Stopping named: .[ OK ]

4.ping的结果
1天后DNS信息失效,Windows2003 ping不通域名指向的IP。

E:\>echo off
星期五 2019-09-13
12:36
Pinging usdb1.te [192.168.15.7] with 32 bytes of data:
星期五 2019-09-13
14:36
Pinging usdb1.te [192.168.15.7] with 32 bytes of data:
星期五 2019-09-13
16:36
Pinging usdb1.te [192.168.15.7] with 32 bytes of data:
星期五 2019-09-13
18:36
Pinging usdb1.te [192.168.15.7] with 32 bytes of data:
星期五 2019-09-13
20:36
Pinging usdb1.te [192.168.15.7] with 32 bytes of data:
星期五 2019-09-13
22:36
Pinging usdb1.te [192.168.15.7] with 32 bytes of data:
星期六 2019-09-14
00:35
Pinging usdb1.te [192.168.15.7] with 32 bytes of data:
星期六 2019-09-14
02:35
Pinging usdb1.te [192.168.15.7] with 32 bytes of data:
星期六 2019-09-14
04:35
Pinging usdb1.te [192.168.15.7] with 32 bytes of data:
星期六 2019-09-14
06:35
Pinging usdb1.te [192.168.15.7] with 32 bytes of data:
星期六 2019-09-14
08:35
Pinging usdb1.te [192.168.15.7] with 32 bytes of data:
星期六 2019-09-14
10:35
Pinging usdb1.te [192.168.15.7] with 32 bytes of data:
星期六 2019-09-14
12:35
Ping request could not find host usdb1.te. Please check the name and try again
.
星期六 2019-09-14
14:35
Ping request could not find host usdb1.te. Please check the name and try again
.

[EOF]

猜你喜欢

转载自blog.51cto.com/147655/2460159