分类: 系统运维
2008-05-22 16:19:57
注:可以参看
有了IOS-Command-toolkit(COSI项目)省了不少事情,这里有n多个小工具,很实用的。
$先说说build-ip-routes.txt。
有的时候,设备很少,想模拟一个很大的网络常常需要手动输入很麻烦。实用build-ip-routes.txt可以自行模拟出这样一种场景。
参数,build-ip-routes.txt <路由条数> <网关>
[root@localhost /]# perl build-ip-routes.txt 50
ip route 7.201.200.192 255.255.255.192
ip route 160.64.16.224 255.255.255.224
ip route 37.113.130.192 255.255.255.192
ip route 118.240.40.128 255.255.255.128
ip route 219.138.155.224 255.255.255.224
ip route 67.231.115.224 255.255.255.224
ip route 10.128.179.128 255.255.255.128
ip route 48.184.151.224 255.255.255.224
ip route 73.121.22.224 255.255.255.224
ip route 22.224.13.192 255.255.255.192
ip route 95.224.225.224 255.255.255.224
ip route 41.119.101.224 255.255.255.224
ip route 66.66.221.224 255.255.255.224
ip route 127.113.252.0 255.255.252.0
ip route 205.36.252.0
style="mso-spacerun: yes"> 255.255.252.0
ip route 111.36.178.224 255.255.255.224
ip route 59.232.26.224 255.255.255.224
ip route 201.209.189.192 255.255.255.192
ip route 147.183.8.192 255.255.255.192
ip route 164.53.113.192 255.255.255.192
ip route 36.69.175.192 255.255.255.192
ip route 111.156.45.128 255.255.255.128
ip route 135.226.218.224 255.255.255.224
ip route 88.39.181.224 255.255.255.224
ip route 113.172.24.192 255.255.255.192
ip route 70.155.84.128 255.255.255.128
ip route 191.193.159.224 255.255.255.224
ip route 93.249.107.0 255.255.255.0
ip route 28.119.77.224 255.255.255.224
ip route 213.103.242.224 255.255.255.224
ip route 116.27.62.224 255.255.255.224
ip route 67.61.23.224 255.255.255.224
ip route 137.104.11.224 255.255.255.224
ip route 112.53.207.224 255.255.255.224
ip route 27.131.28.224 255.255.255.224
ip route 33.154.252.0 255.255.252.0
ip route 29.133.205.0 255.255.255.0
ip route 165.25.47.192 255.255.255.192
ip route 103.224.229.224 255.255.255.224
ip route 34.46.221.128 255.255.255.128
ip route 51.83.95.192 255.255.255.192
ip route 39.36.51.224 255.255.255.224
ip route 35.34.200.224 255.255.255.224
ip route 39.65.122.192 255.255.255.192
ip route 148.238.187.224 255.255.255.224
ip route 70.154.185.224 255.255.255.224
ip route 169.181.200.192 255.255.255.192
ip route 134.39.186.224 255.255.255.224
ip route 29.205.182.128 255.255.255.128
$有时候,监视路由器接口,你可能会出去一会,那怎么办啊。
交给show-interface.txt来做这件事情吧。
[root@localhost /]# expect show-interface.txt
show-interface hostname password enablepassword wait repeat interfacetype number
上面是语法,show-interface.txt ip 密码 enble密码 等待时间 重复次数 接口编号
以上的等待时间的单位是秒。
例:
[root@localhost /]# expect show-interface.txt 192.168.0.254
cisco ccie 10 2 ethernet 0
Sun Dec 11 00:04:04 CST 2005
192.168.0.254
show interface ethernet 0
Ethernet0 is up, line protocol is up
Hardware is QUICC Ethernet, address is
(bia
Internet address is 192.168.0.254/24
MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Queueing strategy: fifo
Output queue 0/40, 0 drops; input queue 1/75, 0 drops
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
44551 packets input, 3189253 bytes, 0 no buffer
Received 11671 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 input packets with dribble condition detected
89877 packets output, 7682145 bytes, 0 underruns(0/0/0)
856 output errors, 0 collisions, 3 interface resets
0 babbles, 0 late collision, 6 deferred
856 lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out
16r1#
Sun Dec 11 00:04:15 CST 2005
192.168.0.254
show interface ethernet 0
Ethernet0 is up, line protocol is up
Hardware is QUICC Ethernet, address is
(bia
Internet address is 192.168.0.254/24
MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
ARP type: ARPA, ARP Timeout 04:00:00
Last input 00:00:00, output 00:00:00, output hang never
Last clearing of "show interface" counters never
Queueing strategy: fifo
Output queue 0/40, 0 drops; input queue 1/75, 0 drops
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
44582 packets input, 3191135 bytes, 0 no buffer
Received 11671 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
0 input packets with dribble condition detected
89909 packets output, 7685226 bytes, 0 underruns(0/0/0)
856 output errors, 0 collisions, 3 interface resets
0 babbles, 0 late collision, 6 deferred
856 lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out
$ function ImgZoom(Id)//重新设置图片大小 防止撑破表格 { var w = $(Id).width; var m = 550; if(w < m) { return; } else { var h = $(Id).height; $(Id).height = parseInt(h*m/w); $(Id).width = m; } } window.onload = function() { var Imgs = $("content").getElementsByTagName("img"); var i=0; for(;i
我们有时候敲错了或者粘贴配置错了,又不能重启清之,这一条一条的no真的是太痛苦了。这里有cnv2no算是救命了!
例如,我们上次粘贴了很多 ip route 的命令(见第一个例子)。
可是我突然发现犯了大错!这时候就用上cnv2no了。
把刚才的错误配置写入一个1.txt的文件之后。
[root@localhost /]# perl cnv2no.txt 1.txt
finished
[root@localhost /]#
[root@localhost /]# ls
1.txt cnv2no.txt no-1.txt
[root@localhost /]# cat no-1.txt
no ip route 7.201.200.192 255.255.255.192
no ip route 160.64.16.224 255.255.255.224
no ip route 37.113.130.192 255.255.255.192
no ip route 118.240.40.128 255.255.255.128
no ip route 219.138.155.224 255.255.255.224
no ip route 67.231.115.224 255.255.255.224
no ip route 10.128.179.128 255.255.255.128
no ip route 48.184.151.224 255.255.255.224
no ip route 73.121.22.224 255.255.255.224
no ip route 22.224.13.192 255.255.255.192
no ip route 95.224.225.224 255.255.255.224
no ip route 41.119.101.224 255.255.255.224
no ip route 66.66.221.224 255.255.255.224
no ip route 127.113.252.0 255.255.252.0
no ip route 205.36.252.0 255.255.252.0
no ip route 111.36.178.224 255.255.255.224
no ip route 59.232.26.224 function ImgZoom(Id)//重新设置图片大小 防止撑破表格 { var w = $(Id).width; var m = 550; if(w < m) { return; } else { var h = $(Id).height; $(Id).height = parseInt(h*m/w); $(Id).width = m; } } window.onload = function() { var Imgs = $("content").getElementsByTagName("img"); var i=0; for(;i
no ip route 201.209.189.192 255.255.255.192
no ip route 147.183.8.192 255.255.255.192
no ip route 164.53.113.192 255.255.255.192
no ip route 36.69.175.192 255.255.255.192
no ip route 111.156.45.128 255.255.255.128
no ip route 135.226.218.224 255.255.255.224
no ip route 88.39.181.224 255.255.255.224
no ip route 113.172.24.192 255.255.255.192
no ip route 70.155.84.128 255.255.255.128
no ip route 191.193.159.224 255.255.255.224
no ip route 93.249.107.0 255.255.255.0
no ip route 28.119.77.224 255.255.255.224
no ip route 213.103.242.224 255.255.255.224
no ip route 116.27.62.224 255.255.255.224
no ip route 67.61.23.224 255.255.255.224
no ip route 137.104.11.224 255.255.255.224
no ip route 112.53.207.224 255.255.255.224
no ip route 27.131.28.224 255.255.255.224
no ip route 33.154.252.0 255.255.252.0
no ip route 29.133.205.0 255.255.255.0
no ip route 165.25.47.192 255.255.255.192
no ip route 103.224.229.224 255.255.255.224
no ip route 159.52.81.128 255.255.255.128
no ip route 34.46.221.128 255.255.255.128
no ip route 51.83.95.192 255.255.255.192
no ip route 39.36.51.224 255.255.255.224
no ip route 35.34.200.224 255.255.255.224
no ip route 39.65.122.192 255.255.255.192
no ip route 148.238.187.224 255.255.255.224
no ip route 70.154.185.224 255.255.255.224
no ip route 169.181.200.192 255.255.255.192
no ip route 134.39.186.224 255.255.255.224
no ip route 29.205.182.128 255.255.255.128
no
[root@localhost /]#
嘿嘿,有多少条它就no多少条。强吧。
$另外还有个工具组合叫sh ip ro
[root@localhost /]# expect show-ip-route-stats.txt 192.168.2.1 cisco cisco 10 2
Sun Dec 11 00:32:12 CST 2005
192.168.2.1
# take the output and save it in a t..."
(file "show-ip-route-stats.txt" line 71)
[root@localhost /]# perl show-ip-route-pl.txt
------------------------------------------
Routing Table Statistics
------------------------------------------
Directly Connected Routes :23
Static Routes :
IGRP Routes :
RIP Routes :
BGP Routes :20
EGP Routes :
OSPF Routes :
OSPF Inter Area Routes :0
OSPF NSSA external type 1 Routes :0
OSPF NSSA external type 2 Routes :0
OSPF external type 1 Routes :0
OSPF external type 2 Routes :0
function ImgZoom(Id)//重新设置图片大小 防止撑破表格 { var w = $(Id).width; var m = 550; if(w < m) { return; } else { var h = $(Id).height; $(Id).height = parseInt(h*m/w); $(Id).width = m; } } window.onload = function() { var Imgs = $("content").getElementsByTagName("img"); var i=0; for(;i
EIGRP External Routes:0
IS-IS :
IS-IS level-1 Routes :0
IS-IS level-2 Routes :0
[root@localhost /]#
这里有路由条目的一点统计信息。