注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 伤离别,痛英年早逝,愿天..
 帮助

在Cisco IOS 中集成script脚本


2007-11-29 21:38:16
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://allens21.blog.51cto.com/103334/52825
hostname R1
interface Loopback0
ip address 2.2.2.2 255.255.255.255 secondary
ip address 3.3.3.3 255.255.255.255 secondary
ip address 4.4.4.4 255.255.255.255 secondary
ip address 1.1.1.1 255.255.255.255

R1#tclsh
R1(tcl)#proc allens {} {
+>(tcl)#foreach i {
+>(tcl)#1.1.1.1
+>(tcl)#2.2.2.2
+>(tcl)#3.3.3.3
+>(tcl)#4.4.4.4
+>(tcl)#} {puts [ exec "ping $i" ] }
+>(tcl)#}

R1(tcl)#
当输入allens时执行ping命令
R1#allens
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/3/4 ms

本文出自 “MY Internetwork Tech” 博客,请务必保留此出处http://allens21.blog.51cto.com/103334/52825





    文章评论
 
2008-03-29 23:10:49
wow,这是什么路由器啊,我好像还没有听说过能这么做的。赶紧尝试一下。
不对啊,我这里也有路由器啊,怎么不支持这个命令呢?

 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: