Just another problem

Cisco – Formatação de ‘sh ip eigrp topology’ usando awk

Posted in cisco by Adriano on 07/03/2010

awk ‘{ while(getline > 0){ if($0~/successors/) {printf(“\n%-25s”, substr($2,1,length($2)-1) )}; if($0~/via/) {printf(“%-16s”,$2)} } }’ file.txt

10.10.155.0/24         10.15.50.5     10.15.50.6
10.11.182.11/32        Redistributed
10.11.76.241/32        Redistributed
10.11.191.4/30         Redistributed
10.11.184.0/24         Redistributed
10.10.145.0/24         10.15.50.5     10.15.50.6
10.11.191.8/30         Redistributed
10.11.183.0/24         Redistributed
10.10.146.0/24         10.15.50.5     10.15.50.6
10.11.68.240/28        Redistributed
10.11.182.2/32         Redistributed

Cisco – Ordenar ‘sh ip cache verbose flow’ usando awk

Posted in cisco by Adriano on 26/02/2010

cat cacheflow.txt | awk ‘{line=$0; line = substr(line,1,length(line)-1); getline; print line ” ” $0;}’ > saida.txt

Tagged with:

Cisco 7304 – Hardware list

Posted in cisco by Adriano on 23/07/2009

#sh c7300

This command displays the types of hardware (processors, jacket cards, and line cards) installed in a Cisco 7304 router.

Cisco – Filtro de community (BGP)

Posted in cisco by Adriano on 15/07/2008

Para filtrar uma community no BGP:

ip community-list 1 permit 65000:1234
!
route-map filter_community deny 10
 match community 1
!
route-map filter_community permit 20
!
router bgp 65000
 neighbor 10.10.10.2 route-map filter_community in
!
Tagged with:

Cisco: Key Sequences for Command Edit and Recall

Posted in cisco, tech by Adriano on 16/06/2008
Keyboard Command What You Get
Up arrow or Ctrl-p This displays the most recently used command. If it is pressed again, the next most recent command appears until the history buffer is exhausted. (The p stands for previous.)
Down arrow or Ctrl-n If you have gone too far back into the history buffer, these keys will go forward to the more recently typed commands. (The n is for next.) Left arrow or Ctrl-b This moves the cursor backward in the currently displayed command without deleting characters. (The b stands for back.)
Right arrow or Ctrl-f This moves the cursor forward in the currently displayed command without deleting characters. (The f stands for forward.)
Backspace This moves the cursor backward in the currently displayed command, deleting characters.
Ctrl-a This moves the cursor directly to the first character of the currently displayed command.
Ctrl-e This moves the cursor directly to the end of the currently displayed command.
Esc-b This moves the cursor back one word in the currently displayed command.
Esc-f This moves the cursor forward one word in the currently displayed command.
Ctrl-r This creates a new command prompt, followed by all the characters typed since the last command prompt was written. This is particularly useful if system messages confuse the screen and it is unclear what you have typed so far.

Cisco: Switch between Telnet Sessions

Posted in cisco, tech, tip by Adriano on 05/06/2007

You can switch between sessions by escaping one session and resuming a previously opened session, as follows:

Step 1 Escape out the current session by pressing Ctrl-^ X and return to the EXEC prompt.

Step 2 List the open sessions using the where command. All open sessions associated with the current terminal line are displayed.

Step 3 Type the resume command and the session number to make the connection.

You can also resume the previous session by pressing the Return key.

source: http://cco.cisco.com/en/US/products/sw/iosswrel/ps1818/products_connection_guide_chapter09186a00800805db.html#xtocid1616712

Cisco login script

Posted in cisco, tech by Adriano on 12/10/2006

Script em expect para login automático em equipamentos Cisco (troque o username e a senha):

#!/usr/local/bin/expect

spawn telnet $argv
expect "Username:"

send "username\r"
expect "Password:"

send "*******\r"
expect ">"

send "enable\r"
expect "Password:"

send "********\r"
send "term mon\r"

interact


bgp tips

Posted in bgp, cisco, tech by Adriano on 11/01/2006

Rotas divulgadas ao vizinho:

show ip bgp neighbors A.B.C.D advertised-routes

Soft clear (enviar as rotas ao vizinho, sem remontar toda a tabela):

clear ip bgp A.B.C.D soft out

RIP – Falha na inclusão de rotas

Posted in cisco, rip, tech by Adriano on 10/01/2006

Após inserir rota estática, a rota não aparecia na base de dados do RIP (show ip rip database).

router rip
version 2
!
address-family ipv4 vrf internet
redistribute static route-map vrfinternet-static-in-rip
(...)
exit-address-family
!
ip route vrf internet 10.5.1.0 255.255.252.0 FastEthernet1/0 10.1.1.5
!
ip prefix-list vrfinternet-static-in-rip seq 50 permit 10.5.1.0/22

Solução: clear ip route vrf internet 10.5.1.0 255.255.252.0

Cisco NTP – Configuração

Posted in cisco, ntp, tech by Adriano on 06/01/2006
! Habilita autenticação
!  O uso da chave serve para evitar que o cliente se sincronize com um
!  servidor não autorizado
ntp authenticate

! Chave de autenticação (enviadas aos servidores/peerings), composto por:
! - Um número público (inteiro de 32 bits, de 1 à 4294967295)
! - Uma chave secreta (32 caracteres)
! Obs.: O servidor, peer e clientes devem ter as mesmas chaves
ntp authentication-key 10 md5 SUA_CHAVE_A
ntp authentication-key 20 md5 SUA_CHAVE_B

! Define chaves permitidas (número da chave enviada pelos clientes)
ntp trusted-key 10
ntp trusted-key 20

! Controle de acesso aos serviços NTP
! peer - Lista com as permissões de sincronização deste equipamento aos
!        servidores e peerings (descarta pacotes de servidores não autorizados)
ntp access-group peer 50
!
! serve-only - Lista dos clientes que usarão este equipamento para
!              sincronismo
ntp access-group serve-only 51

! Atualiza o calendário interno
ntp update-calendar

! Número máximo de clientes servidos por este equipamento
ntp max-associations 6

! Associações
! peer - Configura-se nesse modo os equipamentos na mesma LAN
ntp peer 10.1.1.5 key 10 source Loopback0
! server - Neste modo, configura-se os servidores (de preferência
!          de stratums menores)
ntp server 10.2.1.1 key 10 source Loopback0
ntp server 10.2.1.2 key 10 source Loopback0 prefer
ntp server 10.3.1.1 key 20 source Loopback0

! Lista 50 - igual à lista das associações
access-list 50 permit 10.1.1.5
access-list 50 permit 10.2.1.1
access-list 50 permit 10.2.1.2
access-list 50 permit 10.3.1.1
access-list 50 deny   any

! Lista 51 - contém os clientes com permissão para sincronismo neste eqto
access-list 51 permit 10.1.0.0 0.0.255.255
access-list 51 deny   any