Cisco IOS Shell脚本
:IT学习乐园
:Builder
:20241214
:1K+

 tclsh--用来处理Cisco IOS Shell脚本. 脚本可事先用Notepad编辑好,再往CLI控制台里一贴。不是所有的IOS都支持脚本,在12.2(25)S以上的版本才可以。

--------------------------------------------

Router#tclsh
Router(tcl)#proc Test-ping {} {
+>foreach ip {
+>1.1.1.1
+>2.2.2.2
+>} {ping $ip}
+>}

Router(tcl)#Test-ping

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/2/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
Router(tcl)#exit
Router#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  administratively down down   
FastEthernet0/1            unassigned      YES unset  administratively down down   
FastEthernet1/0            unassigned      YES unset  administratively down down   
FastEthernet2/0            unassigned      YES unset  up                    down   
FastEthernet2/1            unassigned      YES unset  up                    down   
FastEthernet2/2            unassigned      YES unset  up                    down   
FastEthernet2/3            unassigned      YES unset  up                    down   
FastEthernet2/4            unassigned      YES unset  up                    down   
FastEthernet2/5            unassigned      YES unset  up                    down   
FastEthernet2/6            unassigned      YES unset  up                    down   
FastEthernet2/7            unassigned      YES unset  up                    down   
FastEthernet2/8            unassigned      YES unset  up                    down   
FastEthernet2/9            unassigned      YES unset  up                    down   
FastEthernet2/10           unassigned      YES unset  up                    down   
FastEthernet2/11           unassigned      YES unset  up                    down   
FastEthernet2/12           unassigned      YES unset  up                    down   
FastEthernet2/13           unassigned      YES unset  up                    down   
FastEthernet2/14           unassigned      YES unset  up                    down   
FastEthernet2/15           unassigned      YES unset  up                    down   
Vlan1                      unassigned      YES unset  up                    down   
Loopback0                  1.1.1.1         YES manual up                    up     
Loopback1                  2.2.2.2         YES manual up                    up   
  

------------------------------------------------

脚本只是临时保存,退出tcl后将消失。



华为内容分发网络
华为内容分发网络

CDN全时包,客户可享受0点到18点期间流量免费.综合价...

立刻前往...
开发者免费试用
开发者免费试用

9:30开抢,每天限量100份.个人认证新用户绑定邮箱后...

立刻前往...
阿里飞天加速计划
阿里飞天加速计划

高校学生免费领用ECS 2.5个月! 助力开发者全生命周...

立刻前往...
腾讯云限时秒杀
腾讯云限时秒杀

热门云产品首单特惠秒杀,1核2G云服务器首年38元。...

立刻前往...