利用IOS提供的tclsh脚本功能实现快速测试
2012-08-20 14:25
525 查看
在进行大型网络的测试时(比如ccie的lab考试),如何快速的对各个节点进行测试,是非常重要的,IOS提供的tclsh脚本功能可帮助我们实现快速的的测试功能。
在支持tclsh的路由器上配(这里是r4):
ip rcmd rsh-enable
ip rcmd remote-host r4 150.1.4.4 r4 enable
ip rcmd source-interface Loopback0 在其它路由器上配:
ip rcmd rsh-enable
ip rcmd remote-host r4 150.1.4.4 r4 enable
在r4上配:
tclsh
foreach router {
150.1.1.1
150.1.2.2
150.1.3.3
150.1.4.4
150.1.5.5
150.1.6.6
} {
rsh $router shi \^ ip address \[0-9]
} 注意:shi是sh ip int brief的别名
将收集的地址列为如下格式: ip address 150.1.1.1 255.255.255.255
ip address 150.1.11.1 255.255.255.0
ip address 183.1.17.1 255.255.255.0
ip address 183.1.123.1 255.255.255.0 ip address 150.1.2.2 255.255.255.255
ip address 183.1.2.2 255.255.255.0
ip address 183.1.123.2 255.255.255.0 ip address 150.1.3.3 255.255.255.255
ip address 204.12.1.3 255.255.255.0
ip address 183.1.123.3 255.255.255.0
ip address 183.1.0.3 255.255.255.0 ip address 150.1.4.4 255.255.255.255
ip address 183.1.46.4 255.255.255.0
ip address 183.1.0.4 255.255.255.0 ip address 150.1.5.5 255.255.255.255
ip address 183.1.58.5 255.255.255.0
ip address 183.1.0.5 255.255.255.0 ip address 150.1.6.6 255.255.255.255
ip address 183.1.46.6 255.255.255.0
ip address 54.1.1.6 255.255.255.0 将收集的地址列为如下格式:
150.1.1.1
150.1.11.1
183.1.17.1
183.1.123.1
150.1.2.2
183.1.2.2
183.1.123.2
150.1.3.3
204.12.1.3
183.1.123.3
183.1.0.3
150.1.4.4
183.1.46.4
183.1.0.4
150.1.5.5
183.1.58.5
183.1.0.5
150.1.6.6
183.1.46.6
54.1.1.6 在r4上继续执行:
tclsh
foreach router {
150.1.1.1
150.1.2.2
150.1.3.3
150.1.4.4
150.1.5.5
150.1.6.6
} {
puts "\n\n\n\n"
set hostname [rsh $router shi \^hostname]
puts "changing router to $hostname"
puts ""
puts "*************************************************************"
foreach address {
150.1.1.1
150.1.11.1
183.1.17.1
183.1.123.1
150.1.2.2
183.1.2.2
183.1.123.2
150.1.3.3
204.12.1.3
183.1.123.3
183.1.0.3
150.1.4.4
183.1.46.4
183.1.0.4
150.1.5.5
183.1.58.5
183.1.0.5
150.1.6.6
183.1.46.6
54.1.1.6
} {
puts "\n\n\n"
puts $hostname
puts $address
rsh $router ping $address
}
}
本文出自:http://ciscotec.blog.51cto.com/50013/593943
在支持tclsh的路由器上配(这里是r4):
ip rcmd rsh-enable
ip rcmd remote-host r4 150.1.4.4 r4 enable
ip rcmd source-interface Loopback0 在其它路由器上配:
ip rcmd rsh-enable
ip rcmd remote-host r4 150.1.4.4 r4 enable
在r4上配:
tclsh
foreach router {
150.1.1.1
150.1.2.2
150.1.3.3
150.1.4.4
150.1.5.5
150.1.6.6
} {
rsh $router shi \^ ip address \[0-9]
} 注意:shi是sh ip int brief的别名
将收集的地址列为如下格式: ip address 150.1.1.1 255.255.255.255
ip address 150.1.11.1 255.255.255.0
ip address 183.1.17.1 255.255.255.0
ip address 183.1.123.1 255.255.255.0 ip address 150.1.2.2 255.255.255.255
ip address 183.1.2.2 255.255.255.0
ip address 183.1.123.2 255.255.255.0 ip address 150.1.3.3 255.255.255.255
ip address 204.12.1.3 255.255.255.0
ip address 183.1.123.3 255.255.255.0
ip address 183.1.0.3 255.255.255.0 ip address 150.1.4.4 255.255.255.255
ip address 183.1.46.4 255.255.255.0
ip address 183.1.0.4 255.255.255.0 ip address 150.1.5.5 255.255.255.255
ip address 183.1.58.5 255.255.255.0
ip address 183.1.0.5 255.255.255.0 ip address 150.1.6.6 255.255.255.255
ip address 183.1.46.6 255.255.255.0
ip address 54.1.1.6 255.255.255.0 将收集的地址列为如下格式:
150.1.1.1
150.1.11.1
183.1.17.1
183.1.123.1
150.1.2.2
183.1.2.2
183.1.123.2
150.1.3.3
204.12.1.3
183.1.123.3
183.1.0.3
150.1.4.4
183.1.46.4
183.1.0.4
150.1.5.5
183.1.58.5
183.1.0.5
150.1.6.6
183.1.46.6
54.1.1.6 在r4上继续执行:
tclsh
foreach router {
150.1.1.1
150.1.2.2
150.1.3.3
150.1.4.4
150.1.5.5
150.1.6.6
} {
puts "\n\n\n\n"
set hostname [rsh $router shi \^hostname]
puts "changing router to $hostname"
puts ""
puts "*************************************************************"
foreach address {
150.1.1.1
150.1.11.1
183.1.17.1
183.1.123.1
150.1.2.2
183.1.2.2
183.1.123.2
150.1.3.3
204.12.1.3
183.1.123.3
183.1.0.3
150.1.4.4
183.1.46.4
183.1.0.4
150.1.5.5
183.1.58.5
183.1.0.5
150.1.6.6
183.1.46.6
54.1.1.6
} {
puts "\n\n\n"
puts $hostname
puts $address
rsh $router ping $address
}
}
本文出自:http://ciscotec.blog.51cto.com/50013/593943
相关文章推荐
- 利用IOS提供的tclsh脚本功能实现快速测试
- 利用shell脚本实现计划任务功能
- 利用ST提供的USB例程实现USB IAP功能
- [JAVA语言学习][小技巧]利用Batch批处理脚本实现控制台快速编译执行JAVA程序
- 地址方法[ios开发]利用有道翻译API实现简单的翻译功能地址方法
- 利用shell脚本实现计划任务功能 V1.2
- 利用ST提供的USB例程实现USB IAP功能
- 利用ST提供的USB例程实现USB IAP功能
- 利用shell + python + expect实现类似xshell功能(测试环境:ubuntu)
- 利用ST提供的USB例程实现USB IAP功能
- 利用 Ant 的 SQL Task 来实现自己的 Java 执行 SQL 脚本文件的功能
- ios利用短信SKD实现短信验证(使用mob网站提供的免费接口)
- [STM32入门]---利用ST提供的USB例程实现USB IAP功能
- 利用 ICEpdf 快速实现 pdf 文件预览功能
- svn利用钩子脚本功能实现代码同步到web目录
- [ios开发]利用有道翻译API实现简单的翻译功能
- 利用UIActivityController调用ios系统自带的分享功能,实现微信发布多图的功能
- [ios开发]利用有道翻译API实现简单的翻译功能
- iOS 8.0 毛玻璃效果利用UIVisualEffectView快速实现
- iOS开发:一个瀑布流的设计与实现(已实现缓存池功能,该功能使得瀑布流cell可以循环利用)