Primeiro, vamos numerar o arquivo de configuração:
#show running-config linenum
Current configuration : 59161 bytes
1 : !
2 : ! Last configuration change at 09:25:35 CDT Tue Aug 16 2005 by root
3 : ! NVRAM config last updated at 09:25:36 CDT Tue Aug 16 2005 by root
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
Depois, vamos exibir a configuração a partir de uma determinada linha:
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
É possível também exibir apenas uma determinada linha:
Router# show running-config linenum | include ( 6 : )Podemos exibir apenas as linhas que contém uma determinada string:
6 : service tcp-keepalives-in
Router# show running-config | include serviceVeja outro exemplo:
service tcp-keepalives-in
service tcp-keepalives-out
service timestamps debug datetime msec localtime show-timezone
service timestamps log datetime msec localtime show-timezone
service password-encryption
Router# show ip route | include 10.83.Obs: Pode-se também utilizar o parâmetro exclude para NÃO exibir determinadas linhas da configuração
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
Para visualizar a configuração a partir de um determinado ponto:
Router# show running-config | begin interface Serial3/0Podemos também filtrar a configuração por interface:
interface Serial3/0
description MPLS T-1
bandwidth 1544
ip address 10.0.100.2 255.255.255.252
no ip proxy-arp
(truncated)
Router# show running-config interface Serial3/0A pesquisa por determinados elementos na configuração pode ser interativa. Vc entra com o comando show running-config e, quando for exibido o prompt –More– , digite barra (/) e a string a ser pesquisada:
Building configuration...
Current configuration : 209 bytes
!
interface Serial3/0
description MPLS T-1
bandwidth 1544
ip address 10.0.100.2 255.255.255.252
no ip proxy-arp
no ip mroute-cache
no fair-queue
no cdp enable
end
/interface Serial3/0Espero que estas dicas sejam úteis e que tenham gostado.
filtering...
interface Serial3/0
description MPLS T-1
bandwidth 1544
ip address 10.0.100.2 255.255.255.252
Até o próximo Post !
Referência:
http://articles.techrepublic.com.com/5100-10878_11-5842782.html?tag=content%3bleftCol
6 comentários:
legal hein Adilson, muito boa dica.
aliás, todos estes posts relacionados a edição de textos, complementos do show, etc., são muito práticos.
valeu!
Caros,
Outra dica é voce utilizar o show running-config partition, veja abaixo alguns exemplos:
switch#show running-config partition ?
access-list All access-list configurations
class-map All class-map configurations
common All remaining unregistered configurations
global-cdp All global cdp configurations
interface Each Interface specific Configurations
ip-as-path All IP as-path configurations
ip-community All IP community list configurations
ip-domain-list All ip domain list configurations
ip-prefix-list All ip prefix-list configurations
ip-static-routes All IP static configurations
line All line mode configurations
policy-map All policy-map configurations
route-map All route-map configurations
router All routing configurations
snmp All SNMP configurations
tacacs All TACACS configurations
switch#show running-config partition access-list
Building configuration...
Current configuration : 947 bytes
!
Configuration of Partition - access-list
!
!
!
access-list 70 permit 110.0.0.0 0.0.0.255
access-list 70 permit 12.6.0.0 0.0.255.255
access-list 70 permit 80.132.0.0 0.0.0.255
access-list 70 permit 80.132.166.32 0.0.0.31
access-list 70 permit 80.18.0.0 0.0.0.255
access-list 70 permit 80.18.6.0 0.0.0.255
access-list 70 permit 80.18.7.0 0.0.0.63
access-list 70 permit 80.18.7.128 0.0.0.7
access-list 70 permit 80.18.8.0 0.0.0.255
access-list 70 permit 80.18.21.0 0.0.0.31
access-list 70 deny any log
access-list 80 remark Acesso SNMP RO
access-list 80 permit 80.18.7.52
access-list 80 permit 80.18.8.21
access-list 80 permit 80.18.8.8
access-list 80 permit 80.18.7.4
access-list 80 permit 80.18.7.14
access-list 80 permit 80.18.7.13
access-list 80 permit 80.18.0.141
access-list 80 permit 80.18.0.140
access-list 80 permit 80.18.0.143
access-list 80 permit 80.18.0.142
access-list 80 deny any
!
end
switch#
Obrigado Sandro,
As dúvidas dos leitores com relação a Expressões Regulares no IOS me fizeram correr atrás de outros parâmetros do comando SHOW que estão inspirando novos Posts.
Aguardem que vem mais !!!
Abs,
Oi Thiago,
Bem Lembrado !
Eu creio que, em alguns IOS, temos que usar o parâmetro section em lugar do partition. Assim temos:
show running-config section access-list
Alguém quer testar ?
Abs,
Adilson,
Acessei o site da Cisco e não localizei o comando "show running-config section", mas sim o "show running-config | section". Segue abaixo um exemplo e no final a referencia do link da Cisco.
roteador#show running-config | ?
append Append redirected output to URL (URLs supporting append operation only)
begin Begin with the line that matches
exclude Exclude lines that match
include Include lines that match
redirect Redirect output to URL
section Filter a section of output
tee Copy output to URL
roteador#show running-config | sec
roteador#show running-config | section ?
LINE Regular Expression
exclude Exclude entire section(s) of output
include Include entire section(s) of output
roteador#show running-config | section access-list
ip access-list extended match_any
access-list 70 permit 156.24.21.4
access-list 70 permit 156.24.21.9
access-list 70 permit 156.24.20.21
access-list 70 permit 89.0.0.0 0.0.0.255
access-list 70 permit 172.16.193.0 0.0.0.255
access-list 70 permit 172.16.194.0 0.0.0.255
access-list 70 permit 156.24.0.0 0.0.0.255
access-list 70 permit 156.24.6.0 0.0.0.255
access-list 70 permit 156.24.7.0 0.0.0.63
access-list 70 permit 156.24.7.128 0.0.0.7
access-list 70 deny any log
access-list 32 permit 156.24.7.52
access-list 32 permit 156.24.20.7
access-list 32 permit 156.24.20.8
access-list 32 permit 156.24.20.21
access-list 32 permit 156.24.20.20
access-list 32 permit 156.24.7.4
access-list 32 permit 156.24.7.14
access-list 32 permit 156.24.7.13
access-list 32 permit 156.24.7.9
access-list 32 permit 156.24.80.141
access-list 32 permit 156.24.80.140
access-list 32 deny any
roteador#
http://www.cisco.com/en/US/docs/ios/12_3t/fun/command/reference/cfrgt_07.html#wp1091202
apesar desse comando ser bem interessante, hoje tentei rodar o comando linenum em um Catalyst 4506 e não funcionou... acho que este recurso deve ser só para os roteadores mesmo...
alguém tentou?
abraço!
Sandro Leite
Postar um comentário