Chinaunix首页 | 论坛 | 博客
  • 博客访问: 18671897
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类: 系统运维

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 10.0.0.0

ip route  7.201.200.192  255.255.255.192  10.0.0.0243

ip route  160.64.16.224  255.255.255.224  10.0.0.0197

ip route  37.113.130.192  255.255.255.192  10.0.0.0239

ip route  118.240.40.128  255.255.255.128  10.0.0.053

ip route  219.138.155.224  255.255.255.224  10.0.0.0144

ip route  67.231.115.224  255.255.255.224  10.0.0.0187

ip route  10.128.179.128  255.255.255.128  10.0.0.057

ip route  48.184.151.224  255.255.255.224  10.0.0.0148

ip route  73.121.22.224  255.255.255.224  10.0.0.016

ip route  22.224.13.192  255.255.255.192  10.0.0.0250

ip route  95.224.225.224  255.255.255.224  10.0.0.0189

ip route  41.119.101.224  255.255.255.224  10.0.0.0104

ip route  66.66.221.224  255.255.255.224  10.0.0.0110

ip route  127.113.252.0  255.255.252.0  10.0.0.095

ip route  205.36.252.0 style="mso-spacerun: yes">  255.255.252.0  10.0.0.08

ip route  111.36.178.224  255.255.255.224  10.0.0.0136

ip route  59.232.26.224  255.255.255.224  10.0.0.0159

ip route  201.209.189.192  255.255.255.192  10.0.0.0237

ip route  147.183.8.192  255.255.255.192  10.0.0.0227

ip route  164.53.113.192  255.255.255.192  10.0.0.029

ip route  36.69.175.192  255.255.255.192  10.0.0.032

ip route  111.156.45.128  255.255.255.128  10.0.0.05

ip route  135.226.218.224  255.255.255.224  10.0.0.0154

ip route  88.39.181.224  255.255.255.224  10.0.0.0144

ip route  113.172.24.192  255.255.255.192  10.0.0.0224

ip route  70.155.84.128  255.255.255.128  10.0.0.04

ip route  191.193.159.224  255.255.255.224  10.0.0.0151

ip route  93.249.107.0  255.255.255.0  10.0.0.060

ip route  28.119.77.224  255.255.255.224  10.0.0.0136

ip route  213.103.242.224  255.255.255.224  10.0.0.0112

ip route  116.27.62.224  255.255.255.224  10.0.0.0172

ip route  67.61.23.224  255.255.255.224  10.0.0.0196

ip route  137.104.11.224  255.255.255.224  10.0.0.00

ip route  112.53.207.224  255.255.255.224  10.0.0.0192

ip route  27.131.28.224  255.255.255.224  10.0.0.0110

ip route  33.154.252.0  255.255.252.0  10.0.0.080

ip route  29.133.205.0  255.255.255.0  10.0.0.065

ip route  165.25.47.192  255.255.255.192  10.0.0.0228

ip route  103.224.229.224  255.255.255.224  10.0.0.0137PAN lang=EN-US>ip route  159.52.81.128  255.255.255.128  10.0.0.040

ip route  34.46.221.128  255.255.255.128  10.0.0.059

ip route  51.83.95.192  255.255.255.192  10.0.0.0202

ip route  39.36.51.224  255.255.255.224  10.0.0.0136

ip route  35.34.200.224  255.255.255.224  10.0.0.0199

ip route  39.65.122.192  255.255.255.192  10.0.0.0243

ip route  148.238.187.224  255.255.255.224  10.0.0.0149

ip route  70.154.185.224  255.255.255.224  10.0.0.018

ip route  169.181.200.192  255.255.255.192  10.0.0.0217

ip route  134.39.186.224  255.255.255.224  10.0.0.0182

ip route  29.205.182.128  255.255.255.128  10.0.0.051

 

$有时候,监视路由器接口,你可能会出去一会,那怎么办啊。

交给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 0060.474f.b99a

(bia 0060.474f.b99a)

  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 0060.474f.b99a

(bia 0060.474f.b99a)

  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 ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">下面要介绍的是笔者认为非常有用的小工具。

我们有时候敲错了或者粘贴配置错了,又不能重启清之,这一条一条的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  10.0.0.0243

no ip route  160.64.16.224  255.255.255.224  10.0.0.0197

no ip route  37.113.130.192  255.255.255.192  10.0.0.0239

no ip route  118.240.40.128  255.255.255.128  10.0.0.053

no ip route  219.138.155.224  255.255.255.224  10.0.0.0144

no ip route  67.231.115.224  255.255.255.224  10.0.0.0187

no ip route  10.128.179.128  255.255.255.128  10.0.0.057

no ip route  48.184.151.224  255.255.255.224  10.0.0.0148

no ip route  73.121.22.224  255.255.255.224  10.0.0.016

no ip route  22.224.13.192  255.255.255.192  10.0.0.0250

no ip route  95.224.225.224  255.255.255.224  10.0.0.0189

no ip route  41.119.101.224  255.255.255.224  10.0.0.0104

no ip route  66.66.221.224  255.255.255.224  10.0.0.0110

no ip route  127.113.252.0  255.255.252.0  10.0.0.095

no ip route  205.36.252.0  255.255.252.0  10.0.0.08

no ip route  111.36.178.224  255.255.255.224  10.0.0.0136

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 yes">  255.255.255.224  10.0.0.0159

no ip route  201.209.189.192  255.255.255.192  10.0.0.0237

no ip route  147.183.8.192  255.255.255.192  10.0.0.0227

no ip route  164.53.113.192  255.255.255.192  10.0.0.029

no ip route  36.69.175.192  255.255.255.192  10.0.0.032

no ip route  111.156.45.128  255.255.255.128  10.0.0.05

no ip route  135.226.218.224  255.255.255.224  10.0.0.0154

no ip route  88.39.181.224  255.255.255.224  10.0.0.0144

no ip route  113.172.24.192  255.255.255.192  10.0.0.0224

no ip route  70.155.84.128  255.255.255.128  10.0.0.04

no ip route  191.193.159.224  255.255.255.224  10.0.0.0151

no ip route  93.249.107.0  255.255.255.0  10.0.0.060

no ip route  28.119.77.224  255.255.255.224  10.0.0.0136

no ip route  213.103.242.224  255.255.255.224  10.0.0.0112

no ip route  116.27.62.224  255.255.255.224  10.0.0.0172

no ip route  67.61.23.224  255.255.255.224  10.0.0.0196

no ip route  137.104.11.224  255.255.255.224  10.0.0.00

no ip route  112.53.207.224  255.255.255.224  10.0.0.0192

no ip route  27.131.28.224  255.255.255.224  10.0.0.0110

no ip route  33.154.252.0  255.255.252.0  10.0.0.080

no ip route  29.133.205.0  255.255.255.0  10.0.0.065

no ip route  165.25.47.192  255.255.255.192  10.0.0.0228

no ip route  103.224.229.224  255.255.255.224  10.0.0.0137

no ip route  159.52.81.128  255.255.255.128  10.0.0.040

no ip route  34.46.221.128  255.255.255.128  10.0.0.059 >

no ip route  51.83.95.192  255.255.255.192  10.0.0.0202

no ip route  39.36.51.224  255.255.255.224  10.0.0.0136

no ip route  35.34.200.224  255.255.255.224  10.0.0.0199

no ip route  39.65.122.192  255.255.255.192  10.0.0.0243

no ip route  148.238.187.224  255.255.255.224  10.0.0.0149

no ip route  70.154.185.224  255.255.255.224  10.0.0.018

no ip route  169.181.200.192  255.255.255.192  10.0.0.0217

no ip route  134.39.186.224  255.255.255.224  10.0.0.0182

no ip route  29.205.182.128  255.255.255.128  10.0.0.051

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 New Roman">EIGRP Internal Routes:0

EIGRP External Routes:0

IS-IS               :

IS-IS level-1 Routes :0

IS-IS level-2 Routes :0

[root@localhost /]#

这里有路由条目的一点统计信息。 

阅读(555) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~