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


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.830 [1102370] via 10.83.100.2, 05:32:27, Serial1/2:0.83 O 10.83.100.430 [1102115] 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 [1102195] 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 !

原文:DRL BLOG

comments powered by Disqus