网络通信 频道

Linux下的cisco cli小工具

有了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  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.0137

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

 

转载地址:http://www.net130.com/CMS/Pub/Tech/tech_zh/2005_12_15_14126.htm

0
相关文章