正 文

对于路由器命令输出的有效过滤


www.7dspace.com  更新日期:2005-11-8 7:42:20  七度空间


  在一些现网的路由器上输入show run有时候是件很恐怖的事情,如果再要去查找特定的信息更是头痛,下面介绍几种方法来对命令的输出作一些过滤,从而让输出结果更有效。

  1.使用line number

  大家使用ultraedit的时候喜欢选择显示行号,然后可以有效的定位,或者告诉别人第几行出问题了,其实路由器也可以,应该是从12.2 4T开始?没有仔细去查

  使用show running-config linenum 命令得到以下的输出

  Current configuration : 59161 bytes

  1 : !

  2 : ! Last configuration change at 09:25:35 xxxx

  3 : ! NVRAM config last updated at 09:25:36 xxxxx

  4 : !

  5 : version 12.3

  6 : service tcp-keepalives-in

  7 : service tcp-keepalives-out

  8 : service timestamps debug datetime msec localtime show-timezone

  9 : service timestamps log datetime msec localtime show-timezone

  10 : service password-encryption

  这样我们就可以针对行号来进行输出过滤,比如下面命令显示第6行以后的

  Router# show running-config linenum | begin 6 :

  6 : service tcp-keepalives-in

  7 : service tcp-keepalives-out

  8 : service timestamps debug datetime msec localtime show-timezone

  9 : service timestamps log datetime msec localtime show-timezone

  10 : service password-encryption

  2.使用include exclude,begin

  上面的方法不实用是嘛,这个就比较好了,可以针对特定的关键字进行输出。

  在我们日常工作中最常用的就是通过show ip route命令来看路由表,比如你想看关于10.83.x.x的所有路由,你可能会输入

  Router# show ip route 10.83.0.0

  % Subnet not in table

  得不到你想要的是嘛?换这个命令试试

  Router# show ip route | include 10.83.

  O 10.83.100.8/30 [110/2370] via 10.83.100.2, 05:32:27, Serial1/2:0.83

  O 10.83.100.4/30 [110/2115] via 10.20.100.2, 05:32:27, Serial1/2:0.2

  C 10.83.100.0/30 is directly connected, Serial1/2:0.83

  O 10.83.103.0/24 [110/2195] via 10.83.100.2, 05:32:27, Serial1/2:0.83

  好了吧。发挥想像力灵活运用吧

  3.使用/进行搜索

  用过vi的人都比较喜欢/,输入这个字符后就可以对文件进行搜索,其实路由器也可以

  通常我们使用show run命令的输出如果多于一页就会出现

  clock calendar-valid

  ip subnet-zero

  ip cef

  !

  !

  --More--

  在这个状态下你可以空格或者回车来多显示一行或者一页,其实你还可以在这个时候输入/ ,然后后面跟上你要搜索的关键词,

  /clock

  filtering...

  clock source internal

  serial restart-delay 0

  !


上一篇:Java设计模式之虚拟代理模式
下一篇:Oracle:触发Redo写的几个条件
作者:neoshi  来源:论坛 ( 责任编辑:7dspace )
收藏此页】【打印】【关闭
站 内 搜 索
 

热 点 导 读
特 别 推 荐