Cisco IOS Shell脚本
:IT学习乐园
:Builder
:20220927
:208

 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份.个人认证新用户绑定邮箱后...

立刻前往...
华为企业应用专场
华为企业应用专场

企业建站买1年送2年,商标注册270元起,企业邮箱400...

立刻前往...
阿里ECS新春特惠
阿里ECS新春特惠

2022年2月20日期前,您点击链接,并完成实名认证,即...

立刻前往...