Cisco IOS Shell脚本
:IT学习乐园
:Builder
:20241203
: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份.个人认证新用户绑定邮箱后...

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

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

立刻前往...