Cisco IOS Shell脚本
:IT学习乐园
:Builder
:20240420
:777

 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后将消失。



域名建站专场
域名建站专场

域名建站专场:域名1元起,免费云解析,一站式建站,买3年...

立刻前往...
华为云容器引擎
华为云容器引擎

提供高可靠性的企业级容器应用管理服务,支持K8应用工具....

立刻前往...
阿里新人特惠专享
阿里新人特惠专享

新用户首购1元起,精选云服务器ECS 1核2G n4 9...

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

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

立刻前往...